|
1 | | -import path from 'node:path' |
2 | | -import { fileURLToPath } from 'node:url' |
3 | | -import { FlatCompat } from '@eslint/eslintrc' |
4 | 1 | import js from '@eslint/js' |
5 | | -import typescriptEslint from '@typescript-eslint/eslint-plugin' |
6 | | -import tsParser from '@typescript-eslint/parser' |
| 2 | +import prettier from 'eslint-config-prettier/flat' |
7 | 3 | import importX from 'eslint-plugin-import-x' |
8 | | - |
9 | | -const __filename = fileURLToPath(import.meta.url) |
10 | | -const __dirname = path.dirname(__filename) |
11 | | -const compat = new FlatCompat({ |
12 | | - baseDirectory: __dirname, |
13 | | - recommendedConfig: js.configs.recommended, |
14 | | - allConfig: js.configs.all, |
15 | | -}) |
| 4 | +import nodePlugin from 'eslint-plugin-n' |
| 5 | +import tseslint from 'typescript-eslint' |
16 | 6 |
|
17 | 7 | export default [ |
18 | | - ...compat.extends( |
19 | | - 'eslint:recommended', |
20 | | - 'plugin:n/recommended', |
21 | | - 'plugin:@typescript-eslint/recommended', |
22 | | - 'prettier' |
23 | | - ), |
24 | | - { |
25 | | - plugins: { |
26 | | - '@typescript-eslint': typescriptEslint, |
27 | | - 'import-x': importX, |
28 | | - }, |
29 | | - |
30 | | - languageOptions: { |
31 | | - globals: { |
32 | | - fetch: false, |
33 | | - Response: false, |
34 | | - Request: false, |
35 | | - addEventListener: false, |
36 | | - }, |
| 8 | + js.configs.recommended, |
| 9 | + nodePlugin.configs["flat/recommended"], |
| 10 | + tseslint.configs.recommended, |
| 11 | + { |
| 12 | + plugins: { |
| 13 | + '@typescript-eslint': tseslint.plugin, |
| 14 | + 'import-x': importX, |
| 15 | + }, |
| 16 | + languageOptions: { |
| 17 | + globals: { |
| 18 | + fetch: false, |
| 19 | + Response: false, |
| 20 | + Request: false, |
| 21 | + addEventListener: false, |
| 22 | + }, |
37 | 23 |
|
38 | | - parser: tsParser, |
39 | | - ecmaVersion: 2021, |
40 | | - sourceType: 'module', |
41 | | - }, |
| 24 | + ecmaVersion: 2021, |
| 25 | + sourceType: 'module', |
| 26 | + }, |
42 | 27 |
|
43 | | - rules: { |
44 | | - curly: ['error', 'all'], |
45 | | - quotes: ['error', 'single'], |
46 | | - semi: ['error', 'never'], |
47 | | - 'no-debugger': ['error'], |
| 28 | + rules: { |
| 29 | + curly: ['error', 'all'], |
| 30 | + quotes: ['error', 'single'], |
| 31 | + semi: ['error', 'never'], |
| 32 | + 'no-debugger': ['error'], |
48 | 33 |
|
49 | | - 'no-empty': [ |
50 | | - 'warn', |
51 | | - { |
52 | | - allowEmptyCatch: true, |
53 | | - }, |
54 | | - ], |
| 34 | + 'no-empty': [ |
| 35 | + 'warn', |
| 36 | + { |
| 37 | + allowEmptyCatch: true, |
| 38 | + }, |
| 39 | + ], |
55 | 40 |
|
56 | | - 'no-process-exit': 'off', |
57 | | - 'no-useless-escape': 'off', |
| 41 | + 'no-process-exit': 'off', |
| 42 | + 'no-useless-escape': 'off', |
58 | 43 |
|
59 | | - 'prefer-const': [ |
60 | | - 'warn', |
61 | | - { |
62 | | - destructuring: 'all', |
63 | | - }, |
64 | | - ], |
| 44 | + 'prefer-const': [ |
| 45 | + 'warn', |
| 46 | + { |
| 47 | + destructuring: 'all', |
| 48 | + }, |
| 49 | + ], |
65 | 50 |
|
66 | | - 'import-x/consistent-type-specifier-style': ['error', 'prefer-top-level'], |
67 | | - 'import-x/order': [ |
68 | | - 'error', |
69 | | - { |
70 | | - groups: ['external', 'builtin', 'internal', 'parent', 'sibling', 'index'], |
71 | | - alphabetize: { |
72 | | - order: 'asc', |
73 | | - caseInsensitive: true, |
74 | | - }, |
75 | | - }, |
76 | | - ], |
77 | | - 'import-x/no-duplicates': 'error', |
| 51 | + 'import-x/consistent-type-specifier-style': ['error', 'prefer-top-level'], |
| 52 | + 'import-x/order': [ |
| 53 | + 'error', |
| 54 | + { |
| 55 | + groups: [ |
| 56 | + 'external', |
| 57 | + 'builtin', |
| 58 | + 'internal', |
| 59 | + 'parent', |
| 60 | + 'sibling', |
| 61 | + 'index', |
| 62 | + ], |
| 63 | + alphabetize: { |
| 64 | + order: 'asc', |
| 65 | + caseInsensitive: true, |
| 66 | + }, |
| 67 | + }, |
| 68 | + ], |
| 69 | + 'import-x/no-duplicates': 'error', |
78 | 70 |
|
79 | | - 'n/no-missing-import': 'off', |
80 | | - 'n/no-missing-require': 'off', |
81 | | - 'n/no-deprecated-api': 'off', |
82 | | - 'n/no-unpublished-import': 'off', |
83 | | - 'n/no-unpublished-require': 'off', |
84 | | - 'n/no-unsupported-features/es-syntax': 'off', |
85 | | - 'n/no-unsupported-features/node-builtins': 'off', |
| 71 | + 'n/no-missing-import': 'off', |
| 72 | + 'n/no-missing-require': 'off', |
| 73 | + 'n/no-deprecated-api': 'off', |
| 74 | + 'n/no-unpublished-import': 'off', |
| 75 | + 'n/no-unpublished-require': 'off', |
| 76 | + 'n/no-unsupported-features/es-syntax': 'off', |
| 77 | + 'n/no-unsupported-features/node-builtins': 'off', |
86 | 78 |
|
87 | | - '@typescript-eslint/consistent-type-imports': [ |
88 | | - 'error', |
89 | | - { |
90 | | - prefer: 'type-imports', |
91 | | - }, |
92 | | - ], |
93 | | - '@typescript-eslint/no-empty-object-type': 'off', |
94 | | - '@typescript-eslint/no-unsafe-function-type': 'off', |
95 | | - '@typescript-eslint/no-empty-function': [ |
96 | | - 'error', |
97 | | - { |
98 | | - allow: ['arrowFunctions'], |
99 | | - }, |
100 | | - ], |
101 | | - '@typescript-eslint/no-unused-expressions': 'off', |
102 | | - '@typescript-eslint/no-empty-interface': 'off', |
103 | | - '@typescript-eslint/no-explicit-any': 'warn', |
104 | | - '@typescript-eslint/no-inferrable-types': 'off', |
105 | | - '@typescript-eslint/no-require-imports': 'off', |
106 | | - '@typescript-eslint/no-unused-vars': 'warn', |
107 | | - '@typescript-eslint/no-var-requires': 'off', |
108 | | - }, |
109 | | - }, |
| 79 | + '@typescript-eslint/consistent-type-imports': [ |
| 80 | + 'error', |
| 81 | + { |
| 82 | + prefer: 'type-imports', |
| 83 | + }, |
| 84 | + ], |
| 85 | + '@typescript-eslint/no-empty-object-type': 'off', |
| 86 | + '@typescript-eslint/no-unsafe-function-type': 'off', |
| 87 | + '@typescript-eslint/no-empty-function': [ |
| 88 | + 'error', |
| 89 | + { |
| 90 | + allow: ['arrowFunctions'], |
| 91 | + }, |
| 92 | + ], |
| 93 | + '@typescript-eslint/no-unused-expressions': 'off', |
| 94 | + '@typescript-eslint/no-empty-interface': 'off', |
| 95 | + '@typescript-eslint/no-explicit-any': 'warn', |
| 96 | + '@typescript-eslint/no-inferrable-types': 'off', |
| 97 | + '@typescript-eslint/no-require-imports': 'off', |
| 98 | + '@typescript-eslint/no-unused-vars': 'warn', |
| 99 | + '@typescript-eslint/no-var-requires': 'off', |
| 100 | + }, |
| 101 | + }, |
| 102 | + prettier, |
110 | 103 | ] |
0 commit comments