|
1 | | -module.exports = { |
2 | | - env: { |
3 | | - browser: true, |
4 | | - es6: true, |
5 | | - node: true |
6 | | - }, |
7 | | - extends: [ |
8 | | - 'eslint:recommended', |
9 | | - 'plugin:@typescript-eslint/recommended-type-checked', |
10 | | - 'plugin:@typescript-eslint/stylistic-type-checked', |
11 | | - 'prettier' |
12 | | - ], |
13 | | - parser: '@typescript-eslint/parser', |
14 | | - parserOptions: { project: './tsconfig.json' }, |
15 | | - plugins: ['eslint-plugin-prefer-arrow', '@typescript-eslint'], |
16 | | - rules: { |
17 | | - '@typescript-eslint/class-literal-property-style': ['error', 'getters'], |
18 | | - '@typescript-eslint/consistent-generic-constructors': 'error', |
19 | | - '@typescript-eslint/consistent-indexed-object-style': 'warn', |
20 | | - '@typescript-eslint/consistent-type-assertions': 'error', |
21 | | - '@typescript-eslint/dot-notation': 'error', |
22 | | - '@typescript-eslint/explicit-function-return-type': 'off', |
23 | | - '@typescript-eslint/explicit-module-boundary-types': 'off', |
24 | | - '@typescript-eslint/naming-convention': [ |
25 | | - 'warn', |
26 | | - { |
27 | | - selector: 'variable', |
28 | | - format: ['camelCase', 'UPPER_CASE', 'PascalCase'], |
29 | | - leadingUnderscore: 'forbid', |
30 | | - trailingUnderscore: 'forbid' |
| 1 | +const tsPlugin = require('@typescript-eslint/eslint-plugin'); |
| 2 | +const tsParser = require('@typescript-eslint/parser'); |
| 3 | +const preferArrow = require('eslint-plugin-prefer-arrow'); |
| 4 | +const prettier = require('eslint-config-prettier'); |
| 5 | +const js = require('@eslint/js'); |
| 6 | +const globals = require('globals'); |
| 7 | + |
| 8 | +module.exports = [ |
| 9 | + js.configs.recommended, |
| 10 | + ...tsPlugin.configs['flat/recommended-type-checked'], |
| 11 | + ...tsPlugin.configs['flat/stylistic-type-checked'], |
| 12 | + prettier, |
| 13 | + { |
| 14 | + plugins: { |
| 15 | + 'prefer-arrow': preferArrow |
| 16 | + }, |
| 17 | + languageOptions: { |
| 18 | + globals: { |
| 19 | + ...globals.browser, |
| 20 | + ...globals.es2015, |
| 21 | + ...globals.node |
31 | 22 | }, |
32 | | - { |
33 | | - selector: ['property', 'accessor'], |
34 | | - modifiers: ['private'], |
35 | | - format: ['camelCase'], |
36 | | - leadingUnderscore: 'allow' |
37 | | - }, |
38 | | - { |
39 | | - selector: ['variable', 'function'], |
40 | | - format: ['camelCase'], |
41 | | - leadingUnderscore: 'allow' |
42 | | - } |
43 | | - ], |
44 | | - '@typescript-eslint/no-shadow': [ |
45 | | - 'error', |
46 | | - { |
47 | | - hoist: 'all' |
48 | | - } |
49 | | - ], |
50 | | - '@typescript-eslint/no-unused-expressions': 'error', |
51 | | - '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }], |
52 | | - '@typescript-eslint/prefer-for-of': 'error', |
53 | | - '@typescript-eslint/prefer-function-type': 'error', |
54 | | - '@typescript-eslint/prefer-optional-chain': 'error', |
55 | | - '@typescript-eslint/prefer-readonly': 'error', |
56 | | - '@typescript-eslint/restrict-template-expressions': ['error', { allowBoolean: true, allowNumber: true }], |
57 | | - '@typescript-eslint/unified-signatures': 'error', |
58 | | - 'dot-notation': 'off', |
59 | | - eqeqeq: ['error', 'smart'], |
60 | | - 'guard-for-in': 'error', |
61 | | - 'linebreak-style': 'off', |
62 | | - 'max-classes-per-file': ['error', 1], |
63 | | - 'new-parens': ['error', 'always'], |
64 | | - 'no-bitwise': 'error', |
65 | | - 'no-caller': 'error', |
66 | | - 'no-console': ['error', { allow: ['warn', 'error'] }], |
67 | | - 'no-empty-function': 'off', |
68 | | - 'no-eval': 'error', |
69 | | - 'no-new-wrappers': 'error', |
70 | | - 'no-shadow': 'off', |
71 | | - 'no-throw-literal': 'error', |
72 | | - 'no-trailing-spaces': 'error', |
73 | | - 'no-undef-init': 'error', |
74 | | - 'no-unused-expressions': 'off', |
75 | | - 'no-var': 'error', |
76 | | - 'object-shorthand': 'error', |
77 | | - 'one-var': ['error', 'never'], |
78 | | - 'prefer-arrow/prefer-arrow-functions': 'error', |
79 | | - 'prefer-const': 'error', |
80 | | - radix: 'error', |
81 | | - 'spaced-comment': [ |
82 | | - 'error', |
83 | | - 'always', |
84 | | - { |
85 | | - markers: ['/'] |
86 | | - } |
87 | | - ] |
| 23 | + parser: tsParser, |
| 24 | + parserOptions: { project: './tsconfig.json' } |
| 25 | + }, |
| 26 | + rules: { |
| 27 | + '@typescript-eslint/class-literal-property-style': ['error', 'getters'], |
| 28 | + '@typescript-eslint/consistent-generic-constructors': 'error', |
| 29 | + '@typescript-eslint/consistent-indexed-object-style': 'warn', |
| 30 | + '@typescript-eslint/consistent-type-assertions': 'error', |
| 31 | + '@typescript-eslint/dot-notation': 'error', |
| 32 | + '@typescript-eslint/explicit-function-return-type': 'off', |
| 33 | + '@typescript-eslint/explicit-module-boundary-types': 'off', |
| 34 | + '@typescript-eslint/naming-convention': [ |
| 35 | + 'warn', |
| 36 | + { |
| 37 | + selector: 'variable', |
| 38 | + format: ['camelCase', 'UPPER_CASE', 'PascalCase'], |
| 39 | + leadingUnderscore: 'forbid', |
| 40 | + trailingUnderscore: 'forbid' |
| 41 | + }, |
| 42 | + { |
| 43 | + selector: ['property', 'accessor'], |
| 44 | + modifiers: ['private'], |
| 45 | + format: ['camelCase'], |
| 46 | + leadingUnderscore: 'allow' |
| 47 | + }, |
| 48 | + { |
| 49 | + selector: ['variable', 'function'], |
| 50 | + format: ['camelCase'], |
| 51 | + leadingUnderscore: 'allow' |
| 52 | + } |
| 53 | + ], |
| 54 | + '@typescript-eslint/no-shadow': [ |
| 55 | + 'error', |
| 56 | + { |
| 57 | + hoist: 'all' |
| 58 | + } |
| 59 | + ], |
| 60 | + '@typescript-eslint/no-unused-expressions': 'error', |
| 61 | + '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }], |
| 62 | + '@typescript-eslint/prefer-for-of': 'error', |
| 63 | + '@typescript-eslint/prefer-function-type': 'error', |
| 64 | + '@typescript-eslint/prefer-optional-chain': 'error', |
| 65 | + '@typescript-eslint/prefer-readonly': 'error', |
| 66 | + '@typescript-eslint/restrict-template-expressions': ['error', { allowBoolean: true, allowNumber: true }], |
| 67 | + '@typescript-eslint/unified-signatures': 'error', |
| 68 | + 'dot-notation': 'off', |
| 69 | + eqeqeq: ['error', 'smart'], |
| 70 | + 'guard-for-in': 'error', |
| 71 | + 'linebreak-style': 'off', |
| 72 | + 'max-classes-per-file': ['error', 1], |
| 73 | + 'new-parens': ['error', 'always'], |
| 74 | + 'no-bitwise': 'error', |
| 75 | + 'no-caller': 'error', |
| 76 | + 'no-console': ['error', { allow: ['warn', 'error'] }], |
| 77 | + 'no-empty-function': 'off', |
| 78 | + 'no-eval': 'error', |
| 79 | + 'no-new-wrappers': 'error', |
| 80 | + 'no-shadow': 'off', |
| 81 | + 'no-throw-literal': 'error', |
| 82 | + 'no-trailing-spaces': 'error', |
| 83 | + 'no-undef-init': 'error', |
| 84 | + 'no-unused-expressions': 'off', |
| 85 | + 'no-var': 'error', |
| 86 | + 'object-shorthand': 'error', |
| 87 | + 'one-var': ['error', 'never'], |
| 88 | + 'prefer-arrow/prefer-arrow-functions': 'error', |
| 89 | + 'prefer-const': 'error', |
| 90 | + radix: 'error', |
| 91 | + 'spaced-comment': [ |
| 92 | + 'error', |
| 93 | + 'always', |
| 94 | + { |
| 95 | + markers: ['/'] |
| 96 | + } |
| 97 | + ] |
| 98 | + } |
88 | 99 | } |
89 | | -}; |
| 100 | +]; |
0 commit comments