|
1 | 1 | const js = require('@eslint/js') |
2 | | -const tseslint = require('typescript-eslint') |
| 2 | +const tsPlugin = require('@typescript-eslint/eslint-plugin') |
3 | 3 | const unicorn = require('eslint-plugin-unicorn') |
4 | 4 | const importPlugin = require('eslint-plugin-import') |
5 | 5 |
|
6 | | -module.exports = tseslint.config( |
7 | | - js.configs.recommended, |
8 | | - { |
9 | | - plugins: { |
10 | | - '@typescript-eslint': tseslint.plugin, |
11 | | - unicorn, |
12 | | - import: importPlugin, |
13 | | - }, |
14 | | - languageOptions: { |
15 | | - ecmaVersion: 2020, |
16 | | - sourceType: 'module', |
17 | | - }, |
18 | | - rules: { |
19 | | - quotes: ['error', 'single', { avoidEscape: true }], |
20 | | - camelcase: ['error', { properties: 'never' }], |
21 | | - semi: ['error', 'never'], |
22 | | - eqeqeq: ['error', 'always'], |
23 | | - 'prefer-const': 'error', |
24 | | - 'no-multiple-empty-lines': [2, { max: 1, maxEOF: 1 }], |
25 | | - 'array-bracket-spacing': ['error', 'never'], |
26 | | - 'brace-style': ['error', '1tbs', { allowSingleLine: true }], |
27 | | - 'comma-spacing': ['error', { before: false, after: true }], |
28 | | - 'no-lonely-if': 'error', |
29 | | - 'dot-notation': 'error', |
30 | | - 'no-else-return': 'error', |
31 | | - 'no-tabs': 'error', |
32 | | - 'no-trailing-spaces': ['error', { skipBlankLines: false, ignoreComments: false }], |
33 | | - 'no-var': 'error', |
34 | | - 'unicode-bom': ['error', 'never'], |
35 | | - curly: ['error', 'all'], |
36 | | - 'object-curly-spacing': ['error', 'always'], |
37 | | - 'keyword-spacing': ['error'], |
38 | | - 'require-atomic-updates': 0, |
39 | | - 'linebreak-style': ['error', 'unix'], |
40 | | - 'unicorn/prefer-node-protocol': ['error'], |
41 | | - 'unicorn/template-indent': ['error'], |
42 | | - 'import/extensions': ['error', 'ignorePackages'], |
43 | | - 'no-restricted-syntax': ['error', 'IfStatement > ExpressionStatement > AssignmentExpression'], |
44 | | - 'unicorn/prefer-ternary': 'error', |
45 | | - }, |
| 6 | +module.exports = js.configs.recommended |
| 7 | + |
| 8 | +module.exports = { |
| 9 | + ...js.configs.recommended, |
| 10 | + plugins: { |
| 11 | + '@typescript-eslint': tsPlugin, |
| 12 | + unicorn, |
| 13 | + import: importPlugin, |
46 | 14 | }, |
47 | | - { |
48 | | - files: ['**/*.ts'], |
49 | | - rules: { |
50 | | - 'no-unused-vars': 'off', |
51 | | - '@typescript-eslint/no-unused-vars': 'error', |
52 | | - '@typescript-eslint/consistent-type-imports': 'error', |
53 | | - 'no-undef': 'off', |
54 | | - 'no-redeclare': 'off', |
55 | | - }, |
| 15 | + languageOptions: { |
| 16 | + ecmaVersion: 2020, |
| 17 | + sourceType: 'module', |
| 18 | + }, |
| 19 | + rules: { |
| 20 | + quotes: ['error', 'single', { avoidEscape: true }], |
| 21 | + camelcase: ['error', { properties: 'never' }], |
| 22 | + semi: ['error', 'never'], |
| 23 | + eqeqeq: ['error', 'always'], |
| 24 | + 'prefer-const': 'error', |
| 25 | + 'no-multiple-empty-lines': [2, { max: 1, maxEOF: 1 }], |
| 26 | + 'array-bracket-spacing': ['error', 'never'], |
| 27 | + 'brace-style': ['error', '1tbs', { allowSingleLine: true }], |
| 28 | + 'comma-spacing': ['error', { before: false, after: true }], |
| 29 | + 'no-lonely-if': 'error', |
| 30 | + 'dot-notation': 'error', |
| 31 | + 'no-else-return': 'error', |
| 32 | + 'no-tabs': 'error', |
| 33 | + 'no-trailing-spaces': ['error', { skipBlankLines: false, ignoreComments: false }], |
| 34 | + 'no-var': 'error', |
| 35 | + 'unicode-bom': ['error', 'never'], |
| 36 | + curly: ['error', 'all'], |
| 37 | + 'object-curly-spacing': ['error', 'always'], |
| 38 | + 'keyword-spacing': ['error'], |
| 39 | + 'require-atomic-updates': 0, |
| 40 | + 'linebreak-style': ['error', 'unix'], |
| 41 | + 'unicorn/prefer-node-protocol': ['error'], |
| 42 | + 'unicorn/template-indent': ['error'], |
| 43 | + 'import/extensions': ['error', 'ignorePackages'], |
| 44 | + 'no-restricted-syntax': ['error', 'IfStatement > ExpressionStatement > AssignmentExpression'], |
| 45 | + 'unicorn/prefer-ternary': 'error', |
56 | 46 | }, |
57 | | - { |
58 | | - files: ['**/*.test.ts'], |
59 | | - rules: { |
60 | | - 'dot-notation': 'off', |
| 47 | + overrides: [ |
| 48 | + { |
| 49 | + files: ['**/*.ts'], |
| 50 | + parser: '@typescript-eslint/parser', |
| 51 | + rules: { |
| 52 | + 'no-unused-vars': 'off', |
| 53 | + '@typescript-eslint/no-unused-vars': 'error', |
| 54 | + '@typescript-eslint/consistent-type-imports': 'error', |
| 55 | + 'no-undef': 'off', |
| 56 | + 'no-redeclare': 'off', |
| 57 | + }, |
| 58 | + }, |
| 59 | + { |
| 60 | + files: ['**/*.test.ts'], |
| 61 | + rules: { |
| 62 | + 'dot-notation': 'off', |
| 63 | + }, |
61 | 64 | }, |
62 | | - } |
63 | | -) |
| 65 | + ], |
| 66 | +} |
0 commit comments