|
| 1 | +import jsLint from "@eslint/js" |
| 2 | +import stylistic from "@stylistic/eslint-plugin" |
| 3 | +import globals from "globals" |
| 4 | +import tsLint from "typescript-eslint" |
| 5 | +// const __filename = fileURLToPath(import.meta.url); |
| 6 | +// const __dirname = path.dirname(__filename); |
| 7 | +// const compat = new FlatCompat({ |
| 8 | +// baseDirectory: __dirname, |
| 9 | +// recommendedConfig: js.configs.recommended, |
| 10 | +// allConfig: js.configs.all |
| 11 | +// }); |
| 12 | + |
| 13 | +export default [ |
| 14 | + // config parsers |
| 15 | + { |
| 16 | + files: ["src/*.{js,mjs,cjs,ts,mts,jsx,tsx}"] |
| 17 | + }, |
| 18 | + |
| 19 | + { |
| 20 | + files: ["tests/*.{js,mjs,cjs,ts,mts,jsx,tsx}"], |
| 21 | + languageOptions: { |
| 22 | + globals: { |
| 23 | + ...globals.browser, |
| 24 | + ...globals.node, |
| 25 | + ...globals.mocha, |
| 26 | + ...globals.jest |
| 27 | + } |
| 28 | + } |
| 29 | + }, |
| 30 | + // config envs |
| 31 | + { |
| 32 | + languageOptions: { |
| 33 | + globals: { |
| 34 | + ...globals.browser, ...globals.node |
| 35 | + } |
| 36 | + } |
| 37 | + }, |
| 38 | + // syntax rules |
| 39 | + jsLint.configs.recommended, |
| 40 | + ...tsLint.configs.recommended, |
| 41 | + // code style rules |
| 42 | + // disable legacy conflict rules about code style |
| 43 | + stylistic.configs["disable-legacy"], |
| 44 | + // you can customize or use a preset |
| 45 | + stylistic.configs.customize({ |
| 46 | + indent: 2, |
| 47 | + quotes: "double", |
| 48 | + semi: false, |
| 49 | + commaDangle: "never" |
| 50 | + }) |
| 51 | + // { |
| 52 | + // ignores: [ |
| 53 | + // "**/node_modules/", |
| 54 | + // "**/dist/", |
| 55 | + // "**/lib_cjs/", |
| 56 | + // "**/lib_es/", |
| 57 | + // "**/exampless/", |
| 58 | + // ], |
| 59 | + // }, |
| 60 | + // ...compat.extends( |
| 61 | + // "eslint:recommended", |
| 62 | + // "plugin:@typescript-eslint/recommended", |
| 63 | + // ), { |
| 64 | + // plugins: { |
| 65 | + // "@typescript-eslint": typescriptEslint, |
| 66 | + // }, |
| 67 | + |
| 68 | + // rules: { |
| 69 | + // "no-undef": "error", |
| 70 | + // "no-var": "error", |
| 71 | + // "prefer-const": "error", |
| 72 | + // "no-const-assign": "error", |
| 73 | + // "one-var": ["error", "never"], |
| 74 | + // "sort-imports": "off", |
| 75 | + // "no-control-regex": "off", |
| 76 | + // }, |
| 77 | + // } |
| 78 | +] |
0 commit comments