|
| 1 | +// @ts-check |
| 2 | +import { defineConfig } from 'eslint/config'; |
| 3 | +import eslint from '@eslint/js'; |
1 | 4 | import tseslint from 'typescript-eslint'; |
| 5 | +import stylistic from '@stylistic/eslint-plugin'; |
2 | 6 |
|
3 | | -export default tseslint.config( |
| 7 | +export default defineConfig( |
4 | 8 | { |
5 | | - ignores: ['dist'] |
| 9 | + ignores: [ |
| 10 | + 'dist', |
| 11 | + 'eslint.config.js', |
| 12 | + 'vite.config.ts', |
| 13 | + 'vitest.config.ts' |
| 14 | + ] |
6 | 15 | }, |
7 | | - ...tseslint.configs.strict, |
8 | | - ...tseslint.configs.stylistic, |
| 16 | + eslint.configs.recommended, |
| 17 | + tseslint.configs.strictTypeChecked, |
| 18 | + tseslint.configs.stylisticTypeChecked, |
9 | 19 | { |
10 | | - files: ['src/**/*.ts'], |
| 20 | + plugins: { |
| 21 | + '@stylistic': stylistic |
| 22 | + }, |
11 | 23 | languageOptions: { |
12 | 24 | ecmaVersion: 2015, |
13 | 25 | sourceType: 'module', |
14 | | - globals: { |
15 | | - self: 'readonly' |
16 | | - }, |
17 | 26 | parserOptions: { |
18 | | - project: './tsconfig.json' |
| 27 | + projectService: true |
19 | 28 | } |
20 | 29 | }, |
21 | 30 | rules: { |
| 31 | + '@typescript-eslint/no-confusing-void-expression': ['error', { ignoreArrowShorthand: true }], |
22 | 32 | '@typescript-eslint/no-extraneous-class': 'off', |
23 | | - '@typescript-eslint/no-unused-vars': ['error', { 'caughtErrors': 'none' }], |
24 | | - '@typescript-eslint/unified-signatures': ['error', { 'ignoreDifferentlyNamedParameters': true }], |
25 | | - 'array-bracket-spacing': ['warn', 'never'], |
26 | | - 'array-callback-return': 'error', |
27 | | - 'constructor-super': 'error', |
28 | | - 'for-direction': 'error', |
29 | | - 'getter-return': 'error', |
30 | | - 'no-async-promise-executor': 'error', |
31 | | - 'no-class-assign': 'error', |
32 | | - 'no-compare-neg-zero': 'error', |
33 | | - 'no-cond-assign': 'error', |
34 | | - 'no-const-assign': 'error', |
35 | | - 'no-constant-binary-expression': 'error', |
36 | | - 'no-constant-condition': 'error', |
37 | | - 'no-constructor-return': 'error', |
38 | | - 'no-control-regex': 'error', |
39 | | - 'no-debugger': 'error', |
40 | | - 'no-dupe-args': 'error', |
41 | | - 'no-dupe-class-members': 'error', |
42 | | - 'no-dupe-else-if': 'error', |
43 | | - 'no-dupe-keys': 'error', |
44 | | - 'no-duplicate-case': 'error', |
45 | | - 'no-empty-character-class': 'error', |
46 | | - 'no-empty-pattern': 'error', |
47 | | - 'no-ex-assign': 'error', |
48 | | - 'no-fallthrough': 'error', |
49 | | - 'no-func-assign': 'error', |
50 | | - 'no-import-assign': 'error', |
51 | | - 'no-inner-declarations': 'error', |
52 | | - 'no-invalid-regexp': 'error', |
53 | | - 'no-irregular-whitespace': 'error', |
54 | | - 'no-loss-of-precision': 'error', |
55 | | - 'no-misleading-character-class': 'error', |
56 | | - 'no-new-native-nonconstructor': 'error', |
57 | | - 'no-new-symbol': 'error', |
58 | | - 'no-obj-calls': 'error', |
59 | | - 'no-self-assign': 'error', |
60 | | - 'no-self-compare': 'error', |
61 | | - 'no-setter-return': 'error', |
62 | | - 'no-sparse-arrays': 'error', |
63 | | - 'no-template-curly-in-string': 'error', |
64 | | - 'no-this-before-super': 'error', |
65 | | - 'no-undef': 'error', |
66 | | - 'no-unexpected-multiline': 'error', |
67 | | - 'no-unmodified-loop-condition': 'error', |
68 | | - 'no-unreachable': 'error', |
69 | | - 'no-unreachable-loop': 'error', |
70 | | - 'no-unsafe-finally': 'error', |
71 | | - 'no-unsafe-negation': 'error', |
72 | | - 'no-unsafe-optional-chaining': 'error', |
73 | | - 'no-unused-private-class-members': 'error', |
74 | | - 'no-use-before-define': 'error', |
75 | | - 'no-useless-backreference': 'error', |
76 | | - 'require-atomic-updates': 'error', |
77 | | - 'use-isnan': 'error', |
78 | | - 'valid-typeof': 'error', |
| 33 | + '@typescript-eslint/no-unused-vars': ['error', { caughtErrors: 'none' }], |
| 34 | + '@typescript-eslint/restrict-template-expressions': ['error', { allowNever: true }], |
| 35 | + '@typescript-eslint/unified-signatures': ['error', { ignoreDifferentlyNamedParameters: true }], |
| 36 | + |
79 | 37 | 'accessor-pairs': 'error', |
| 38 | + 'array-callback-return': 'error', |
80 | 39 | 'block-scoped-var': 'error', |
81 | 40 | 'consistent-return': 'error', |
82 | 41 | 'curly': 'error', |
83 | 42 | 'default-case-last': 'error', |
84 | | - 'dot-notation': 'error', |
85 | 43 | 'eqeqeq': ['error', 'smart'], |
86 | 44 | 'func-name-matching': 'error', |
87 | | - 'func-style': ['error', 'expression', { 'overrides': { 'namedExports': 'ignore' } }], |
| 45 | + 'func-style': ['error', 'expression', { overrides: { namedExports: 'ignore' } }], |
88 | 46 | 'grouped-accessor-pairs': 'error', |
89 | | - 'id-denylist': 'error', |
90 | | - 'id-match': 'error', |
91 | 47 | 'max-depth': 'error', |
92 | 48 | 'max-nested-callbacks': 'error', |
93 | 49 | 'new-cap': 'error', |
94 | | - 'no-array-constructor': 'error', |
95 | 50 | 'no-caller': 'error', |
96 | | - 'no-delete-var': 'error', |
| 51 | + 'no-constructor-return': 'error', |
97 | 52 | 'no-div-regex': 'error', |
98 | 53 | 'no-else-return': 'error', |
99 | 54 | 'no-empty-static-block': 'error', |
100 | 55 | 'no-eval': 'error', |
101 | 56 | 'no-extend-native': 'error', |
102 | 57 | 'no-extra-bind': 'error', |
103 | | - 'no-extra-boolean-cast': 'error', |
104 | 58 | 'no-extra-label': 'error', |
105 | | - 'no-extra-semi': 'error', |
106 | | - 'no-floating-decimal': 'error', |
107 | | - 'no-global-assign': 'error', |
108 | 59 | 'no-implicit-globals': 'error', |
109 | 60 | 'no-implied-eval': 'error', |
110 | 61 | 'no-iterator': 'error', |
111 | 62 | 'no-label-var': 'error', |
112 | 63 | 'no-labels': 'error', |
113 | 64 | 'no-lone-blocks': 'error', |
114 | 65 | 'no-lonely-if': 'error', |
115 | | - 'no-loop-func': 'error', |
116 | | - 'no-multi-assign': ['error', { 'ignoreNonDeclaration': true }], |
| 66 | + 'no-multi-assign': ['error', { ignoreNonDeclaration: true }], |
117 | 67 | 'no-multi-str': 'error', |
118 | 68 | 'no-negated-condition': 'error', |
119 | 69 | 'no-new': 'error', |
120 | 70 | 'no-new-func': 'error', |
121 | | - 'no-new-object': 'error', |
122 | 71 | 'no-new-wrappers': 'error', |
123 | | - 'no-nonoctal-decimal-escape': 'error', |
124 | | - 'no-octal': 'error', |
| 72 | + 'no-object-constructor': 'error', |
125 | 73 | 'no-octal-escape': 'error', |
126 | 74 | 'no-proto': 'error', |
127 | | - 'no-regex-spaces': 'error', |
128 | | - 'no-restricted-exports': 'error', |
129 | | - 'no-restricted-globals': 'error', |
130 | | - 'no-restricted-imports': 'error', |
131 | | - 'no-restricted-properties': 'error', |
132 | | - 'no-restricted-syntax': 'error', |
133 | 75 | 'no-return-assign': 'error', |
134 | | - 'no-return-await': 'error', |
135 | 76 | 'no-script-url': 'error', |
| 77 | + 'no-self-compare': 'error', |
136 | 78 | 'no-sequences': 'error', |
137 | | - 'no-shadow': 'error', |
138 | 79 | 'no-shadow-restricted-names': 'error', |
139 | | - 'no-throw-literal': 'error', |
| 80 | + 'no-template-curly-in-string': 'error', |
140 | 81 | 'no-undef-init': 'error', |
| 82 | + 'no-unmodified-loop-condition': 'error', |
141 | 83 | 'no-unneeded-ternary': 'error', |
142 | | - 'no-unused-expressions': 'error', |
143 | | - 'no-unused-labels': 'error', |
| 84 | + 'no-unreachable-loop': 'error', |
144 | 85 | 'no-useless-call': 'error', |
145 | | - 'no-useless-catch': 'error', |
146 | 86 | 'no-useless-computed-key': 'error', |
147 | 87 | 'no-useless-concat': 'error', |
148 | | - 'no-useless-escape': 'error', |
149 | 88 | 'no-useless-rename': 'error', |
150 | 89 | 'no-useless-return': 'error', |
151 | 90 | 'no-void': 'error', |
152 | | - 'no-warning-comments': 'warn', |
153 | | - 'no-with': 'error', |
| 91 | + 'no-warning-comments': 'error', |
154 | 92 | 'operator-assignment': 'error', |
155 | | - 'prefer-const': 'error', |
156 | 93 | 'prefer-exponentiation-operator': 'error', |
157 | 94 | 'prefer-numeric-literals': 'error', |
158 | 95 | 'prefer-object-has-own': 'error', |
159 | 96 | 'prefer-object-spread': 'error', |
160 | | - 'prefer-promise-reject-errors': ['error', { 'allowEmptyReject': true }], |
| 97 | + 'prefer-promise-reject-errors': ['error', { allowEmptyReject: true }], |
161 | 98 | 'prefer-regex-literals': 'error', |
162 | 99 | 'prefer-rest-params': 'error', |
163 | 100 | 'prefer-spread': 'error', |
164 | 101 | 'radix': 'error', |
165 | | - 'require-await': 'error', |
166 | | - 'require-yield': 'error', |
| 102 | + 'require-atomic-updates': 'error', |
167 | 103 | 'symbol-description': 'error', |
| 104 | + 'unicode-bom': 'error', |
168 | 105 | 'yoda': 'error', |
169 | | - 'arrow-spacing': 'warn', |
170 | | - 'block-spacing': 'warn', |
171 | | - 'comma-dangle': 'warn', |
172 | | - 'comma-spacing': 'warn', |
173 | | - 'comma-style': 'warn', |
174 | | - 'computed-property-spacing': 'warn', |
175 | | - 'dot-location': ['warn', 'property'], |
176 | | - 'eol-last': 'warn', |
177 | | - 'func-call-spacing': 'warn', |
178 | | - 'generator-star-spacing': 'warn', |
179 | | - 'implicit-arrow-linebreak': 'warn', |
180 | | - 'indent': ['warn', 2, { 'ignoreComments': true }], |
181 | | - 'jsx-quotes': 'warn', |
182 | | - 'key-spacing': 'warn', |
183 | | - 'keyword-spacing': 'warn', |
184 | | - 'linebreak-style': 'warn', |
185 | | - 'lines-between-class-members': 'warn', |
186 | | - 'new-parens': 'warn', |
187 | | - 'no-extra-parens': ['warn', 'functions'], |
188 | | - 'no-mixed-spaces-and-tabs': 'warn', |
189 | | - 'no-multi-spaces': ['warn', { 'ignoreEOLComments': true }], |
190 | | - 'no-tabs': 'warn', |
191 | | - 'no-trailing-spaces': 'warn', |
192 | | - 'no-whitespace-before-property': 'warn', |
193 | | - 'nonblock-statement-body-position': 'warn', |
194 | | - 'object-curly-newline': 'warn', |
195 | | - 'object-curly-spacing': ['warn', 'always'], |
196 | | - 'padding-line-between-statements': 'warn', |
197 | | - 'quotes': ['warn', 'single'], |
198 | | - 'rest-spread-spacing': 'warn', |
199 | | - 'semi': 'warn', |
200 | | - 'semi-spacing': 'warn', |
201 | | - 'semi-style': 'warn', |
202 | | - 'space-before-blocks': 'warn', |
203 | | - 'space-in-parens': 'warn', |
204 | | - 'space-infix-ops': 'warn', |
205 | | - 'space-unary-ops': 'warn', |
206 | | - 'switch-colon-spacing': 'warn', |
207 | | - 'template-curly-spacing': 'warn', |
208 | | - 'template-tag-spacing': 'warn', |
209 | | - 'unicode-bom': 'warn', |
210 | | - 'wrap-iife': ['warn', 'any'], |
211 | | - 'yield-star-spacing': 'warn' |
| 106 | + |
| 107 | + '@stylistic/array-bracket-spacing': ['warn', 'never'], |
| 108 | + '@stylistic/arrow-spacing': 'warn', |
| 109 | + '@stylistic/block-spacing': 'warn', |
| 110 | + '@stylistic/comma-dangle': 'warn', |
| 111 | + '@stylistic/comma-spacing': 'warn', |
| 112 | + '@stylistic/comma-style': 'warn', |
| 113 | + '@stylistic/computed-property-spacing': 'warn', |
| 114 | + '@stylistic/dot-location': ['warn', 'property'], |
| 115 | + '@stylistic/eol-last': 'warn', |
| 116 | + '@stylistic/function-call-spacing': 'warn', |
| 117 | + '@stylistic/generator-star-spacing': 'warn', |
| 118 | + '@stylistic/implicit-arrow-linebreak': 'warn', |
| 119 | + '@stylistic/indent': ['warn', 2, { ignoreComments: true }], |
| 120 | + '@stylistic/jsx-quotes': 'warn', |
| 121 | + '@stylistic/key-spacing': 'warn', |
| 122 | + '@stylistic/keyword-spacing': 'warn', |
| 123 | + '@stylistic/linebreak-style': 'warn', |
| 124 | + '@stylistic/lines-between-class-members': 'warn', |
| 125 | + '@stylistic/member-delimiter-style': ['warn', { multiline: { delimiter: 'semi', requireLast: true }, singleline: { delimiter: 'semi', requireLast: false } }], |
| 126 | + '@stylistic/new-parens': 'warn', |
| 127 | + '@stylistic/no-extra-parens': ['warn', 'functions'], |
| 128 | + '@stylistic/no-extra-semi': 'warn', |
| 129 | + '@stylistic/no-floating-decimal': 'warn', |
| 130 | + '@stylistic/no-mixed-spaces-and-tabs': 'warn', |
| 131 | + '@stylistic/no-multi-spaces': ['warn', { ignoreEOLComments: true }], |
| 132 | + '@stylistic/no-tabs': 'warn', |
| 133 | + '@stylistic/no-trailing-spaces': 'warn', |
| 134 | + '@stylistic/no-whitespace-before-property': 'warn', |
| 135 | + '@stylistic/nonblock-statement-body-position': 'warn', |
| 136 | + '@stylistic/object-curly-newline': 'warn', |
| 137 | + '@stylistic/object-curly-spacing': ['warn', 'always'], |
| 138 | + '@stylistic/padding-line-between-statements': 'warn', |
| 139 | + '@stylistic/quotes': ['warn', 'single'], |
| 140 | + '@stylistic/rest-spread-spacing': 'warn', |
| 141 | + '@stylistic/semi': 'warn', |
| 142 | + '@stylistic/semi-spacing': 'warn', |
| 143 | + '@stylistic/semi-style': 'warn', |
| 144 | + '@stylistic/space-before-blocks': 'warn', |
| 145 | + '@stylistic/space-in-parens': 'warn', |
| 146 | + '@stylistic/space-infix-ops': 'warn', |
| 147 | + '@stylistic/space-unary-ops': 'warn', |
| 148 | + '@stylistic/switch-colon-spacing': 'warn', |
| 149 | + '@stylistic/template-curly-spacing': 'warn', |
| 150 | + '@stylistic/template-tag-spacing': 'warn', |
| 151 | + '@stylistic/wrap-iife': ['warn', 'any'], |
| 152 | + '@stylistic/yield-star-spacing': 'warn' |
212 | 153 | } |
213 | 154 | } |
214 | 155 | ); |
0 commit comments