1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.recommended = void 0;
|
4 | const tslib_1 = require("tslib");
|
5 | const node_module_1 = require("node:module");
|
6 | const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
7 | const base_1 = require("./base");
|
8 | const overrides = [
|
9 | Object.assign({ files: ['*.md', '*.mdx'], extends: 'plugin:mdx/overrides' }, base_1.base),
|
10 | {
|
11 | files: '**/*.{md,mdx}/**',
|
12 | extends: 'plugin:mdx/code-blocks',
|
13 | },
|
14 | ];
|
15 | exports.recommended = {
|
16 | overrides,
|
17 | };
|
18 | const getImportMetaUrl = () => {
|
19 | try {
|
20 | return new Function('return import.meta.url')();
|
21 | }
|
22 | catch (_a) {
|
23 | return node_path_1.default.resolve(process.cwd(), '__test__.js');
|
24 | }
|
25 | };
|
26 | const cjsRequire = typeof require === 'undefined' ? (0, node_module_1.createRequire)(getImportMetaUrl()) : require;
|
27 | const addPrettierRules = () => {
|
28 | try {
|
29 | cjsRequire.resolve('prettier');
|
30 | const { meta } = cjsRequire('eslint-plugin-prettier');
|
31 | const version = (meta === null || meta === void 0 ? void 0 : meta.version) || '';
|
32 | const [major, minor, patch] = version.split('.');
|
33 | if (+major > 5 ||
|
34 | (+major === 5 &&
|
35 | (+minor > 1 || (+minor === 1 && Number.parseInt(patch) >= 2)))) {
|
36 | return;
|
37 | }
|
38 | overrides.push({
|
39 | files: '*.md',
|
40 | rules: {
|
41 | 'prettier/prettier': [
|
42 | 'error',
|
43 | {
|
44 | parser: 'markdown',
|
45 | },
|
46 | ],
|
47 | },
|
48 | }, {
|
49 | files: '*.mdx',
|
50 | rules: {
|
51 | 'prettier/prettier': [
|
52 | 'error',
|
53 | {
|
54 | parser: 'mdx',
|
55 | },
|
56 | ],
|
57 | },
|
58 | });
|
59 | }
|
60 | catch (_a) { }
|
61 | };
|
62 | addPrettierRules();
|
63 |
|
\ | No newline at end of file |