|
1 | | -import { fixupConfigRules, fixupPluginRules } from '@eslint/compat'; |
2 | | -import typescriptEslint from '@typescript-eslint/eslint-plugin'; |
3 | | -import _import from 'eslint-plugin-import'; |
| 1 | +import neostandard from 'neostandard'; |
| 2 | +import tseslint from 'typescript-eslint'; |
4 | 3 | import jest from 'eslint-plugin-jest'; |
5 | 4 | import prettier from 'eslint-plugin-prettier'; |
6 | | -import tsParser from '@typescript-eslint/parser'; |
7 | | -import path from 'node:path'; |
8 | | -import { fileURLToPath } from 'node:url'; |
9 | | -import js from '@eslint/js'; |
10 | | -import { FlatCompat } from '@eslint/eslintrc'; |
| 5 | +import prettierConfig from 'eslint-config-prettier'; |
11 | 6 |
|
12 | | -const __filename = fileURLToPath(import.meta.url); |
13 | | -const __dirname = path.dirname(__filename); |
14 | | -const compat = new FlatCompat({ |
15 | | - baseDirectory: __dirname, |
16 | | - recommendedConfig: js.configs.recommended, |
17 | | - allConfig: js.configs.all |
18 | | -}); |
19 | | - |
20 | | -export default [ |
| 7 | +export default tseslint.config( |
| 8 | + ...neostandard({ |
| 9 | + ts: true, |
| 10 | + }), |
21 | 11 | { |
22 | | - ignores: ['**/coverage', '**/dist', '**/node_modules', '**/*.js'] |
| 12 | + ignores: ['**/coverage', '**/dist', '**/node_modules', 'eslint.config.mjs'], |
23 | 13 | }, |
24 | | - ...fixupConfigRules( |
25 | | - compat.extends( |
26 | | - 'eslint:recommended', |
27 | | - 'plugin:@typescript-eslint/eslint-recommended', |
28 | | - 'plugin:@typescript-eslint/recommended', |
29 | | - 'plugin:@typescript-eslint/recommended-type-checked', |
30 | | - 'plugin:@typescript-eslint/stylistic-type-checked', |
31 | | - 'airbnb-base', |
32 | | - 'prettier', |
33 | | - 'plugin:import/recommended', |
34 | | - 'plugin:import/errors', |
35 | | - 'plugin:import/warnings', |
36 | | - 'plugin:jest/all' |
37 | | - ) |
38 | | - ), |
39 | 14 | { |
40 | | - plugins: { |
41 | | - '@typescript-eslint': fixupPluginRules(typescriptEslint), |
42 | | - import: fixupPluginRules(_import), |
43 | | - jest: fixupPluginRules(jest), |
44 | | - prettier |
45 | | - }, |
46 | | - |
| 15 | + files: ['**/*.ts', '**/*.mts', '**/*.cts', '**/*.tsx'], |
47 | 16 | languageOptions: { |
48 | | - parser: tsParser, |
49 | | - ecmaVersion: 5, |
50 | | - sourceType: 'script', |
51 | | - |
52 | 17 | parserOptions: { |
53 | | - project: true |
54 | | - } |
55 | | - }, |
56 | | - |
57 | | - settings: { |
58 | | - 'import/parsers': { |
59 | | - '@typescript-eslint/parser': ['.ts', '.tsx'] |
| 18 | + project: true, |
60 | 19 | }, |
61 | | - |
62 | | - 'import/resolver': { |
63 | | - typescript: { |
64 | | - alwaysTryTypes: true, |
65 | | - project: '.' |
66 | | - } |
67 | | - } |
68 | 20 | }, |
69 | | - |
| 21 | + plugins: { |
| 22 | + jest, |
| 23 | + prettier, |
| 24 | + }, |
70 | 25 | rules: { |
| 26 | + ...jest.configs.all.rules, |
| 27 | + ...prettierConfig.rules, |
71 | 28 | 'prettier/prettier': ['error'], |
72 | | - |
73 | | - 'import/extensions': [ |
74 | | - 'error', |
75 | | - 'always', |
76 | | - { |
77 | | - pattern: { |
78 | | - ts: 'never' |
79 | | - } |
80 | | - } |
81 | | - ], |
82 | | - |
83 | 29 | 'no-restricted-syntax': 0, |
84 | 30 | 'no-console': 'off', |
85 | 31 | 'no-underscore-dangle': 0, |
86 | | - |
87 | 32 | 'no-plusplus': [ |
88 | 33 | 'error', |
89 | 34 | { |
90 | | - allowForLoopAfterthoughts: true |
91 | | - } |
| 35 | + allowForLoopAfterthoughts: true, |
| 36 | + }, |
92 | 37 | ], |
93 | | - |
94 | 38 | 'no-shadow': 'off', |
95 | 39 | '@typescript-eslint/no-shadow': 'error', |
96 | 40 | 'no-unused-vars': 'off', |
97 | | - '@typescript-eslint/no-unused-vars': 'error', |
| 41 | + '@typescript-eslint/no-unused-vars': [ |
| 42 | + 'error', |
| 43 | + { |
| 44 | + argsIgnorePattern: '^_', |
| 45 | + }, |
| 46 | + ], |
98 | 47 | 'no-use-before-define': 'off', |
99 | | - '@typescript-eslint/no-use-before-define': 'error' |
100 | | - } |
101 | | - }, |
102 | | - { |
103 | | - files: ['**/*.ts', '**/*.mts', '**/*.cts', '**/*.tsx'], |
104 | | - |
105 | | - rules: { |
106 | | - '@typescript-eslint/explicit-function-return-type': 'error' |
107 | | - } |
108 | | - }, |
109 | | - { |
110 | | - ignores: ["dist/*", "coverage/*", "node_modules/*", "eslint.config.mjs"] |
| 48 | + '@typescript-eslint/no-use-before-define': 'error', |
| 49 | + '@typescript-eslint/explicit-function-return-type': 'error', |
| 50 | + }, |
111 | 51 | } |
112 | | -]; |
| 52 | +); |
0 commit comments