@allthings/eslint-config 2.2.3 → 3.0.0-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/README.md +27 -7
  2. package/index.js +351 -424
  3. package/node.js +317 -389
  4. package/package.json +10 -5
package/index.js CHANGED
@@ -1,439 +1,366 @@
1
- /*
2
- * @rushstack/eslint-patch is used to include plugins as dev
3
- * dependencies instead of imposing them as peer dependencies
4
- *
5
- * https://www.npmjs.com/package/@rushstack/eslint-patch
6
- */
7
- const keptPaths = []
8
- const sortedPaths = []
9
- const cwd = process.cwd().replace(/\\/g, '/')
10
- const originalPaths = require.resolve.paths('eslint-plugin-import')
1
+ import stylisticPlugin from '@stylistic/eslint-plugin'
2
+ import tsPlugin from '@typescript-eslint/eslint-plugin'
3
+ import globals from 'globals'
4
+ import jsxA11yPlugin from 'eslint-plugin-jsx-a11y'
5
+ import importPlugin from 'eslint-plugin-import'
6
+ import jestPlugin from 'eslint-plugin-jest'
7
+ import preferArrowPlugin from 'eslint-plugin-prefer-arrow'
8
+ import prettierConfig from 'eslint-plugin-prettier/recommended'
9
+ import reactPlugin from 'eslint-plugin-react'
10
+ import reactHooksPlugin from 'eslint-plugin-react-hooks'
11
+ import simpleImportSortPlugin from 'eslint-plugin-simple-import-sort'
12
+ import typescriptSortKeysPlugin from 'eslint-plugin-typescript-sort-keys'
13
+ import unicornPlugin from 'eslint-plugin-unicorn'
11
14
 
12
- // eslint throws a conflict error when plugins resolve to different
13
- // locations, since we want to lock our dependencies by default
14
- // but also need to allow using user dependencies this updates
15
- // our resolve paths to first check the cwd and iterate to
16
- // eslint-config-next's dependencies if needed
17
-
18
- for (let i = originalPaths.length - 1; i >= 0; i--) {
19
- const currentPath = originalPaths[i]
20
-
21
- if (currentPath.replace(/\\/g, '/').startsWith(cwd)) {
22
- sortedPaths.push(currentPath)
23
- } else {
24
- keptPaths.unshift(currentPath)
25
- }
26
- }
27
-
28
- // maintain order of node_modules outside cwd
29
- sortedPaths.push(...keptPaths)
30
-
31
- const hookPropertyMap = new Map(
32
- [
33
- ['eslint-plugin-unicorn', 'eslint-plugin-unicorn'],
34
- ['eslint-plugin-jest', 'eslint-plugin-jest'],
35
- ['eslint-plugin-import', 'eslint-plugin-import'],
36
- ['eslint-plugin-react', 'eslint-plugin-react'],
37
- ['eslint-plugin-react-hooks', 'eslint-plugin-react-hooks'],
38
- ['eslint-plugin-jsx-a11y', 'eslint-plugin-jsx-a11y'],
39
- [
40
- 'eslint-plugin-typescript-sort-keys',
41
- 'eslint-plugin-typescript-sort-keys',
42
- ],
43
- ['eslint-plugin-prefer-arrow', 'eslint-plugin-prefer-arrow'],
44
- ['eslint-plugin-simple-import-sort', 'eslint-plugin-simple-import-sort'],
45
- ['@stylistic/eslint-plugin', '@stylistic/eslint-plugin'],
46
- ].map(([request, replacement]) => [
47
- request,
48
- require.resolve(replacement, { paths: sortedPaths }),
49
- ]),
50
- )
51
-
52
- const mod = require('module')
53
- const resolveFilename = mod._resolveFilename
54
- mod._resolveFilename = function (request, parent, isMain, options) {
55
- const hookResolved = hookPropertyMap.get(request)
56
- if (hookResolved) {
57
- request = hookResolved
58
- }
59
- return resolveFilename.call(mod, request, parent, isMain, options)
60
- }
61
-
62
- require('@rushstack/eslint-patch/modern-module-resolution')
63
-
64
- module.exports = {
65
- extends: [
66
- 'plugin:unicorn/recommended',
67
- 'plugin:import/recommended',
68
- 'plugin:import/typescript',
69
- 'eslint:recommended',
70
- 'plugin:@typescript-eslint/recommended-type-checked',
71
- 'plugin:@typescript-eslint/stylistic-type-checked',
72
- 'plugin:typescript-sort-keys/recommended',
73
- 'plugin:react/recommended',
74
- 'plugin:react-hooks/recommended-legacy',
75
- 'plugin:react/jsx-runtime',
76
- 'plugin:prettier/recommended',
77
- ],
78
- plugins: [
79
- '@stylistic',
80
- 'unicorn',
81
- 'jest',
82
- 'import',
83
- 'react',
84
- 'react-hooks',
85
- 'jsx-a11y',
86
- 'typescript-sort-keys',
87
- 'prefer-arrow',
88
- 'simple-import-sort',
89
- ],
90
- rules: {
91
- '@stylistic/member-delimiter-style': [
92
- 'error',
93
- {
94
- multiline: {
95
- delimiter: 'none',
96
- requireLast: true,
97
- },
98
- singleline: {
99
- delimiter: 'semi',
100
- requireLast: false,
101
- },
15
+ export default [
16
+ ...tsPlugin.configs['flat/recommended-type-checked'],
17
+ ...tsPlugin.configs['flat/stylistic-type-checked'],
18
+ unicornPlugin.configs['flat/recommended'],
19
+ importPlugin.flatConfigs.recommended,
20
+ importPlugin.flatConfigs.typescript,
21
+ reactPlugin.configs.flat.recommended,
22
+ reactPlugin.configs.flat['jsx-runtime'],
23
+ jsxA11yPlugin.flatConfigs.recommended,
24
+ reactHooksPlugin.configs['recommended-latest'],
25
+ {
26
+ languageOptions: {
27
+ globals: {
28
+ ...globals.browser,
29
+ ...globals.node,
30
+ ...jestPlugin.environments.globals.globals,
102
31
  },
103
- ],
104
- '@stylistic/quotes': [
105
- 'error',
106
- 'single',
107
- {
108
- avoidEscape: true,
109
- },
110
- ],
111
- '@stylistic/semi': ['error', 'never'],
112
- '@stylistic/type-annotation-spacing': 'error',
113
- '@typescript-eslint/adjacent-overload-signatures': 'error',
114
- '@typescript-eslint/array-type': [
115
- 'error',
116
- {
117
- default: 'array',
118
- },
119
- ],
120
- '@typescript-eslint/consistent-type-assertions': 'error',
121
- '@typescript-eslint/consistent-type-definitions': 'off',
122
- '@typescript-eslint/explicit-function-return-type': 'off',
123
- '@typescript-eslint/explicit-module-boundary-types': [
124
- 'warn', // TODO: strict later
125
- {
126
- allowArgumentsExplicitlyTypedAsAny: true,
127
- allowDirectConstAssertionInArrowFunctions: true,
128
- allowHigherOrderFunctions: false,
129
- allowTypedFunctionExpressions: false,
130
- },
131
- ],
132
- '@typescript-eslint/naming-convention': [
133
- 'error',
134
- {
135
- custom: {
136
- match: true,
137
- regex: '^I[A-Z]',
32
+ parserOptions: {
33
+ ecmaFeatures: {
34
+ jsx: true,
138
35
  },
139
- format: ['PascalCase'],
140
- selector: 'interface',
141
- },
142
- ],
143
- '@typescript-eslint/no-base-to-string': 'warn',
144
- // need for tests' mockups
145
- '@typescript-eslint/no-empty-function': 'warn',
146
- '@typescript-eslint/no-empty-interface': 'error',
147
- '@typescript-eslint/no-explicit-any': 'warn',
148
- // turn on later
149
- '@typescript-eslint/no-floating-promises': 'warn',
150
- '@typescript-eslint/no-for-in-array': 'error',
151
- '@typescript-eslint/no-inferrable-types': 'error',
152
- '@typescript-eslint/no-misused-new': 'error',
153
- '@typescript-eslint/no-namespace': 'error',
154
- '@typescript-eslint/no-redundant-type-constituents': 'warn',
155
- '@typescript-eslint/no-require-imports': 'warn',
156
- '@typescript-eslint/no-shadow': [
157
- 'error',
158
- {
159
- hoist: 'all',
160
- },
161
- ],
162
- '@typescript-eslint/no-this-alias': 'error',
163
- '@typescript-eslint/no-unnecessary-type-assertion': 'warn',
164
- '@typescript-eslint/no-unsafe-argument': 'warn',
165
- '@typescript-eslint/no-unsafe-assignment': 'warn',
166
- '@typescript-eslint/no-unsafe-call': 'warn',
167
- '@typescript-eslint/no-unsafe-enum-comparison': 'off',
168
- '@typescript-eslint/no-unsafe-member-access': 'off',
169
- '@typescript-eslint/no-unsafe-return': 'warn',
170
- '@typescript-eslint/no-unused-expressions': 'error',
171
- '@typescript-eslint/no-unused-vars': [
172
- 'error',
173
- { varsIgnorePattern: '^jsx$' },
174
- ],
175
- '@typescript-eslint/no-use-before-define': 'error',
176
- '@typescript-eslint/no-var-requires': 'error',
177
- '@typescript-eslint/prefer-for-of': 'error',
178
- '@typescript-eslint/prefer-function-type': 'error',
179
- '@typescript-eslint/prefer-namespace-keyword': 'error',
180
- '@typescript-eslint/prefer-nullish-coalescing': 'off',
181
- '@typescript-eslint/prefer-promise-reject-errors': 'warn',
182
- '@typescript-eslint/restrict-template-expressions': 'warn',
183
- '@typescript-eslint/triple-slash-reference': [
184
- 'error',
185
- {
186
- path: 'always',
187
- types: 'prefer-import',
188
- lib: 'always',
189
- },
190
- ],
191
- '@typescript-eslint/typedef': 'error',
192
- '@typescript-eslint/unified-signatures': 'error',
193
- 'arrow-body-style': ['error', 'as-needed'],
194
- complexity: [
195
- 'error',
196
- {
197
- max: 15,
198
- },
199
- ],
200
- 'constructor-super': 'error',
201
- eqeqeq: ['error', 'smart'],
202
- 'guard-for-in': 'error',
203
- 'id-denylist': [
204
- 'error',
205
- 'any',
206
- 'Number',
207
- 'number',
208
- 'String',
209
- 'string',
210
- 'Boolean',
211
- 'boolean',
212
- 'Undefined',
213
- 'undefined',
214
- ],
215
- 'id-match': 'error',
216
- 'import/no-anonymous-default-export': [
217
- 'error',
218
- {
219
- allowAnonymousClass: false,
220
- allowAnonymousFunction: false,
221
- allowArray: false,
222
- allowArrowFunction: true,
223
- allowCallExpression: true,
224
- // The true value here is for backward compatibility
225
- allowLiteral: false,
226
- allowObject: true,
227
- },
228
- ],
229
- 'import/no-extraneous-dependencies': [
230
- 'error',
231
- {
232
- devDependencies: true,
233
- },
234
- ],
235
- 'jest/no-disabled-tests': 'warn',
236
- 'jest/no-focused-tests': 'error',
237
- 'jest/no-identical-title': 'error',
238
- 'jest/valid-expect': 'error',
239
- 'max-classes-per-file': ['error', 1],
240
- 'no-bitwise': 'error',
241
- 'no-caller': 'error',
242
- 'no-cond-assign': 'error',
243
- 'no-console': 'error',
244
- 'no-debugger': 'error',
245
- 'no-duplicate-case': 'error',
246
- 'no-duplicate-imports': 'error',
247
- 'no-empty': 'error',
248
- 'no-eval': 'error',
249
- 'no-extra-bind': 'error',
250
- 'no-multiple-empty-lines': 'error',
251
- 'no-new-func': 'error',
252
- 'no-new-wrappers': 'error',
253
- 'no-param-reassign': 'error',
254
- 'no-redeclare': 'error',
255
- 'no-return-await': 'error',
256
- 'no-sequences': 'error',
257
- 'no-sparse-arrays': 'error',
258
- 'no-template-curly-in-string': 'error',
259
- 'no-throw-literal': 'error',
260
- 'no-trailing-spaces': 'error',
261
- 'no-undef-init': 'error',
262
- 'no-unsafe-finally': 'error',
263
- 'no-unused-labels': 'error',
264
- 'no-var': 'error',
265
- 'object-shorthand': 'error',
266
- 'one-var': ['error', 'never'],
267
- 'padding-line-between-statements': [
268
- 'error',
269
- {
270
- blankLine: 'always',
271
- prev: '*',
272
- next: 'return',
36
+ ecmaVersion: 2021,
37
+ project: 'tsconfig.json',
38
+ sourceType: 'module',
39
+ warnOnUnsupportedTypeScriptVersion: false,
273
40
  },
274
- ],
275
- 'prefer-arrow/prefer-arrow-functions': 'warn',
276
- 'prefer-const': 'error',
277
- 'prefer-object-spread': 'error',
278
- 'prefer-template': 'error',
279
- quotes: ['error', 'single', { avoidEscape: true }],
280
- radix: 'error',
281
- 'react-hooks/exhaustive-deps': 'error',
282
- 'react/jsx-curly-brace-presence': [
283
- 'error',
284
- {
285
- children: 'never',
286
- props: 'never',
287
- },
288
- ],
289
- 'react/jsx-sort-props': [
290
- 2,
291
- {
292
- noSortAlphabetically: false,
41
+ },
42
+ plugins: {
43
+ '@stylistic': stylisticPlugin,
44
+ 'jest': jestPlugin,
45
+ 'prefer-arrow': preferArrowPlugin,
46
+ 'simple-import-sort': simpleImportSortPlugin,
47
+ 'typescript-sort-keys': typescriptSortKeysPlugin,
48
+ },
49
+ settings: {
50
+ react: { version: 'detect' },
51
+ 'import/parsers': {
52
+ '@typescript-eslint/parser': ['.ts', '.mts', '.cts', '.tsx', '.d.ts'],
293
53
  },
294
- ],
295
- 'react/react-in-jsx-scope': 'off',
296
- 'react/no-unknown-property': ['error', { ignore: ['css'] }],
297
- 'react/jsx-uses-react': 'error',
298
- 'react/jsx-uses-vars': 'error',
299
- 'simple-import-sort/imports': 'error',
300
- 'simple-import-sort/exports': 'error',
301
- 'sort-keys': 'error',
302
- 'spaced-comment': [
303
- 'error',
304
- 'always',
305
- {
306
- markers: ['/'],
54
+ 'import/resolver': {
55
+ node: { extensions: ['.js', '.jsx', '.ts', '.tsx'] },
56
+ typescript: { alwaysTryTypes: true },
307
57
  },
308
- ],
309
- 'unicorn/better-regex': 'off',
310
- 'unicorn/consistent-existence-index-check': 'off',
311
- 'unicorn/expiring-todo-comments': 'off',
312
- 'unicorn/filename-case': [
313
- 'warn',
314
- {
315
- cases: {
316
- camelCase: true,
317
- pascalCase: true,
58
+ },
59
+ rules: {
60
+ // typescript-sort-keys (no native flat config)
61
+ 'typescript-sort-keys/interface': 'error',
62
+ 'typescript-sort-keys/string-enum': 'error',
63
+ // react-hooks override (recommended-latest has exhaustive-deps as 'warn')
64
+ 'react-hooks/exhaustive-deps': 'error',
65
+ '@stylistic/member-delimiter-style': [
66
+ 'error',
67
+ {
68
+ multiline: {
69
+ delimiter: 'none',
70
+ requireLast: true,
71
+ },
72
+ singleline: {
73
+ delimiter: 'semi',
74
+ requireLast: false,
75
+ },
318
76
  },
319
- },
320
- ],
321
- 'unicorn/import-style': 'warn',
322
- 'unicorn/no-anonymous-default-export': 'off',
323
- 'unicorn/no-array-reduce': 'off',
324
- 'unicorn/no-await-expression-member': 'warn',
325
- 'unicorn/no-console-spaces': 'off',
326
- 'unicorn/no-document-cookie': 'warn',
327
- 'unicorn/no-empty-file': 'off',
328
- 'unicorn/no-hex-escape': 'warn',
329
- 'unicorn/no-invalid-remove-event-listener': 'warn',
330
- 'unicorn/no-nested-ternary': 'off',
331
- // because we have a lot of logic depends on null
332
- 'unicorn/no-null': 'warn',
333
- 'unicorn/no-object-as-default-parameter': 'warn',
334
- 'unicorn/no-single-promise-in-promise-methods': 'warn',
335
- 'unicorn/no-unreadable-array-destructuring': 'off',
336
- 'unicorn/no-unsafe-regex': 'off',
337
- 'unicorn/no-unused-properties': 'warn',
338
- 'unicorn/no-zero-fractions': 'off',
339
- 'unicorn/prevent-abbreviations': [
340
- 'error',
341
- {
342
- allowList: {
343
- params: true,
344
- props: true,
77
+ ],
78
+ '@stylistic/quotes': [
79
+ 'error',
80
+ 'single',
81
+ {
82
+ avoidEscape: true,
345
83
  },
346
- replacements: {
347
- params: {
348
- properties: false,
84
+ ],
85
+ '@stylistic/semi': ['error', 'never'],
86
+ '@stylistic/type-annotation-spacing': 'error',
87
+ '@typescript-eslint/adjacent-overload-signatures': 'error',
88
+ '@typescript-eslint/array-type': [
89
+ 'error',
90
+ {
91
+ default: 'array',
92
+ },
93
+ ],
94
+ '@typescript-eslint/consistent-type-assertions': 'error',
95
+ '@typescript-eslint/consistent-type-definitions': 'off',
96
+ '@typescript-eslint/explicit-function-return-type': 'off',
97
+ '@typescript-eslint/explicit-module-boundary-types': [
98
+ 'warn', // TODO: strict later
99
+ {
100
+ allowArgumentsExplicitlyTypedAsAny: true,
101
+ allowDirectConstAssertionInArrowFunctions: true,
102
+ allowHigherOrderFunctions: false,
103
+ allowTypedFunctionExpressions: false,
104
+ },
105
+ ],
106
+ '@typescript-eslint/naming-convention': [
107
+ 'error',
108
+ {
109
+ custom: {
110
+ match: true,
111
+ regex: '^I[A-Z]',
349
112
  },
350
- props: {
351
- properties: false,
113
+ format: ['PascalCase'],
114
+ selector: 'interface',
115
+ },
116
+ ],
117
+ '@typescript-eslint/no-base-to-string': 'warn',
118
+ // need for tests' mockups
119
+ '@typescript-eslint/no-empty-function': 'warn',
120
+ '@typescript-eslint/no-empty-interface': 'error',
121
+ '@typescript-eslint/no-explicit-any': 'warn',
122
+ // turn on later
123
+ '@typescript-eslint/no-floating-promises': 'warn',
124
+ '@typescript-eslint/no-for-in-array': 'error',
125
+ '@typescript-eslint/no-inferrable-types': 'error',
126
+ '@typescript-eslint/no-misused-new': 'error',
127
+ '@typescript-eslint/no-namespace': 'error',
128
+ '@typescript-eslint/no-redundant-type-constituents': 'warn',
129
+ '@typescript-eslint/no-require-imports': 'warn',
130
+ '@typescript-eslint/no-shadow': [
131
+ 'error',
132
+ {
133
+ hoist: 'all',
134
+ },
135
+ ],
136
+ '@typescript-eslint/no-this-alias': 'error',
137
+ '@typescript-eslint/no-unnecessary-type-assertion': 'warn',
138
+ '@typescript-eslint/no-unsafe-argument': 'warn',
139
+ '@typescript-eslint/no-unsafe-assignment': 'warn',
140
+ '@typescript-eslint/no-unsafe-call': 'warn',
141
+ '@typescript-eslint/no-unsafe-enum-comparison': 'off',
142
+ '@typescript-eslint/no-unsafe-member-access': 'off',
143
+ '@typescript-eslint/no-unsafe-return': 'warn',
144
+ '@typescript-eslint/no-unused-expressions': 'error',
145
+ '@typescript-eslint/no-unused-vars': [
146
+ 'error',
147
+ { varsIgnorePattern: '^jsx$' },
148
+ ],
149
+ '@typescript-eslint/no-use-before-define': 'error',
150
+ '@typescript-eslint/no-var-requires': 'error',
151
+ '@typescript-eslint/prefer-for-of': 'error',
152
+ '@typescript-eslint/prefer-function-type': 'error',
153
+ '@typescript-eslint/prefer-namespace-keyword': 'error',
154
+ '@typescript-eslint/prefer-nullish-coalescing': 'off',
155
+ '@typescript-eslint/prefer-promise-reject-errors': 'warn',
156
+ '@typescript-eslint/restrict-template-expressions': 'warn',
157
+ '@typescript-eslint/triple-slash-reference': [
158
+ 'error',
159
+ {
160
+ path: 'always',
161
+ types: 'prefer-import',
162
+ lib: 'always',
163
+ },
164
+ ],
165
+ '@typescript-eslint/typedef': 'error',
166
+ '@typescript-eslint/unified-signatures': 'error',
167
+ 'arrow-body-style': ['error', 'as-needed'],
168
+ complexity: [
169
+ 'error',
170
+ {
171
+ max: 15,
172
+ },
173
+ ],
174
+ 'constructor-super': 'error',
175
+ eqeqeq: ['error', 'smart'],
176
+ 'guard-for-in': 'error',
177
+ 'id-denylist': [
178
+ 'error',
179
+ 'any',
180
+ 'Number',
181
+ 'number',
182
+ 'String',
183
+ 'string',
184
+ 'Boolean',
185
+ 'boolean',
186
+ 'Undefined',
187
+ 'undefined',
188
+ ],
189
+ 'id-match': 'error',
190
+ 'import/no-anonymous-default-export': [
191
+ 'error',
192
+ {
193
+ allowAnonymousClass: false,
194
+ allowAnonymousFunction: false,
195
+ allowArray: false,
196
+ allowArrowFunction: true,
197
+ allowCallExpression: true,
198
+ // The true value here is for backward compatibility
199
+ allowLiteral: false,
200
+ allowObject: true,
201
+ },
202
+ ],
203
+ 'import/no-extraneous-dependencies': [
204
+ 'error',
205
+ {
206
+ devDependencies: true,
207
+ },
208
+ ],
209
+ 'jest/no-disabled-tests': 'warn',
210
+ 'jest/no-focused-tests': 'error',
211
+ 'jest/no-identical-title': 'error',
212
+ 'jest/valid-expect': 'error',
213
+ 'max-classes-per-file': ['error', 1],
214
+ 'no-bitwise': 'error',
215
+ 'no-caller': 'error',
216
+ 'no-cond-assign': 'error',
217
+ 'no-console': 'error',
218
+ 'no-debugger': 'error',
219
+ 'no-duplicate-case': 'error',
220
+ 'no-duplicate-imports': 'error',
221
+ 'no-empty': 'error',
222
+ 'no-eval': 'error',
223
+ 'no-extra-bind': 'error',
224
+ 'no-multiple-empty-lines': 'error',
225
+ 'no-new-func': 'error',
226
+ 'no-new-wrappers': 'error',
227
+ 'no-param-reassign': 'error',
228
+ 'no-redeclare': 'error',
229
+ 'no-return-await': 'error',
230
+ 'no-sequences': 'error',
231
+ 'no-sparse-arrays': 'error',
232
+ 'no-template-curly-in-string': 'error',
233
+ 'no-throw-literal': 'error',
234
+ 'no-trailing-spaces': 'error',
235
+ 'no-undef-init': 'error',
236
+ 'no-unsafe-finally': 'error',
237
+ 'no-unused-labels': 'error',
238
+ 'no-var': 'error',
239
+ 'object-shorthand': 'error',
240
+ 'one-var': ['error', 'never'],
241
+ 'padding-line-between-statements': [
242
+ 'error',
243
+ {
244
+ blankLine: 'always',
245
+ prev: '*',
246
+ next: 'return',
247
+ },
248
+ ],
249
+ 'prefer-arrow/prefer-arrow-functions': 'warn',
250
+ 'prefer-const': 'error',
251
+ 'prefer-object-spread': 'error',
252
+ 'prefer-template': 'error',
253
+ quotes: ['error', 'single', { avoidEscape: true }],
254
+ radix: 'error',
255
+ 'react/jsx-curly-brace-presence': [
256
+ 'error',
257
+ {
258
+ children: 'never',
259
+ props: 'never',
260
+ },
261
+ ],
262
+ 'react/jsx-sort-props': [
263
+ 2,
264
+ {
265
+ noSortAlphabetically: false,
266
+ },
267
+ ],
268
+ 'react/jsx-uses-react': 'error',
269
+ 'react/jsx-uses-vars': 'error',
270
+ 'react/no-unknown-property': ['error', { ignore: ['css'] }],
271
+ 'react/react-in-jsx-scope': 'off',
272
+ 'simple-import-sort/exports': 'error',
273
+ 'simple-import-sort/imports': 'error',
274
+ 'sort-keys': 'error',
275
+ 'spaced-comment': [
276
+ 'error',
277
+ 'always',
278
+ {
279
+ markers: ['/'],
280
+ },
281
+ ],
282
+ 'unicorn/better-regex': 'off',
283
+ 'unicorn/consistent-existence-index-check': 'off',
284
+ 'unicorn/expiring-todo-comments': 'off',
285
+ 'unicorn/filename-case': [
286
+ 'warn',
287
+ {
288
+ cases: {
289
+ camelCase: true,
290
+ pascalCase: true,
352
291
  },
353
292
  },
354
- },
355
- ],
356
- 'unicorn/prefer-export-from': 'off',
357
- 'unicorn/prefer-global-this': 'warn',
358
- 'unicorn/prefer-includes': 'off',
359
- 'unicorn/prefer-math-min-max': 'warn',
360
- 'unicorn/prefer-module': 'warn',
361
- 'unicorn/prefer-optional-catch-binding': 'off',
362
- 'unicorn/prefer-prototype-methods': 'off',
363
- 'unicorn/prefer-query-selector': 'off',
364
- 'unicorn/prefer-regexp-test': 'off',
365
- 'unicorn/prefer-set-has': 'off',
366
- 'unicorn/prefer-set-size': 'off',
367
- 'unicorn/prefer-string-raw': 'off',
368
- 'unicorn/prefer-string-replace-all': 'off',
369
- 'unicorn/prefer-structured-clone': 'warn',
370
- 'unicorn/prefer-node-protocol': 'off',
371
- 'unicorn/relative-url-style': 'off',
372
- 'unicorn/switch-case-braces': 'off',
373
- 'unicorn/template-indent': 'off',
374
- 'use-isnan': 'error',
375
- },
376
- parser: '@typescript-eslint/parser',
377
- parserOptions: {
378
- ecmaFeatures: {
379
- jsx: true,
380
- },
381
- ecmaVersion: 2021,
382
- project: 'tsconfig.json',
383
- sourceType: 'module',
384
- warnOnUnsupportedTypeScriptVersion: false,
385
- },
386
- settings: {
387
- react: {
388
- version: 'detect',
389
- },
390
- 'import/parsers': {
391
- [require.resolve('@typescript-eslint/parser')]: [
392
- '.ts',
393
- '.mts',
394
- '.cts',
395
- '.tsx',
396
- '.d.ts',
397
293
  ],
398
- },
399
- 'import/resolver': {
400
- [require.resolve('eslint-import-resolver-node')]: {
401
- extensions: ['.js', '.jsx', '.ts', '.tsx'],
402
- },
403
- [require.resolve('eslint-import-resolver-typescript')]: {
404
- alwaysTryTypes: true,
405
- },
294
+ 'unicorn/import-style': 'warn',
295
+ 'unicorn/no-anonymous-default-export': 'off',
296
+ 'unicorn/no-array-reduce': 'off',
297
+ 'unicorn/no-await-expression-member': 'warn',
298
+ 'unicorn/no-console-spaces': 'off',
299
+ 'unicorn/no-document-cookie': 'warn',
300
+ 'unicorn/no-empty-file': 'off',
301
+ 'unicorn/no-hex-escape': 'warn',
302
+ 'unicorn/no-invalid-remove-event-listener': 'warn',
303
+ 'unicorn/no-nested-ternary': 'off',
304
+ // because we have a lot of logic depends on null
305
+ 'unicorn/no-null': 'warn',
306
+ 'unicorn/no-object-as-default-parameter': 'warn',
307
+ 'unicorn/no-single-promise-in-promise-methods': 'warn',
308
+ 'unicorn/no-unreadable-array-destructuring': 'off',
309
+ 'unicorn/no-unsafe-regex': 'off',
310
+ 'unicorn/no-unused-properties': 'warn',
311
+ 'unicorn/no-zero-fractions': 'off',
312
+ 'unicorn/prefer-export-from': 'off',
313
+ 'unicorn/prefer-global-this': 'warn',
314
+ 'unicorn/prefer-includes': 'off',
315
+ 'unicorn/prefer-math-min-max': 'warn',
316
+ 'unicorn/prefer-module': 'warn',
317
+ 'unicorn/prefer-node-protocol': 'off',
318
+ 'unicorn/prefer-optional-catch-binding': 'off',
319
+ 'unicorn/prefer-prototype-methods': 'off',
320
+ 'unicorn/prefer-query-selector': 'off',
321
+ 'unicorn/prefer-regexp-test': 'off',
322
+ 'unicorn/prefer-set-has': 'off',
323
+ 'unicorn/prefer-set-size': 'off',
324
+ 'unicorn/prefer-string-raw': 'off',
325
+ 'unicorn/prefer-string-replace-all': 'off',
326
+ 'unicorn/prefer-structured-clone': 'warn',
327
+ 'unicorn/prevent-abbreviations': [
328
+ 'error',
329
+ {
330
+ allowList: {
331
+ params: true,
332
+ props: true,
333
+ },
334
+ replacements: {
335
+ params: {
336
+ properties: false,
337
+ },
338
+ props: {
339
+ properties: false,
340
+ },
341
+ },
342
+ },
343
+ ],
344
+ 'unicorn/relative-url-style': 'off',
345
+ 'unicorn/switch-case-braces': 'off',
346
+ 'unicorn/template-indent': 'off',
347
+ 'use-isnan': 'error',
406
348
  },
407
349
  },
408
- env: {
409
- browser: true,
410
- node: true,
411
- 'jest/globals': true,
412
- },
413
- globals: {
414
- describe: true,
415
- expect: true,
416
- fetch: false,
417
- it: true,
418
- jest: true,
419
- MutationObserver: true,
420
- },
421
- overrides: [
422
- {
423
- // because of jest
424
- files: ['*.test.ts'],
425
- rules: {
426
- '@typescript-eslint/explicit-function-return-type': 'off',
427
- '@typescript-eslint/no-empty-function': 'off',
428
- '@typescript-eslint/no-explicit-any': 'off',
429
- '@typescript-eslint/no-misused-promises': 'off',
430
- '@typescript-eslint/no-unsafe-return': 'off',
431
- '@typescript-eslint/no-unsafe-assignment': 'off',
432
- '@typescript-eslint/require-await': 'off',
433
- 'unicorn/no-array-callback-reference': 'off',
434
- 'unicorn/no-await-expression-member': 'off',
435
- },
350
+ {
351
+ // because of jest
352
+ files: ['**/*.test.ts'],
353
+ rules: {
354
+ '@typescript-eslint/explicit-function-return-type': 'off',
355
+ '@typescript-eslint/no-empty-function': 'off',
356
+ '@typescript-eslint/no-explicit-any': 'off',
357
+ '@typescript-eslint/no-misused-promises': 'off',
358
+ '@typescript-eslint/no-unsafe-assignment': 'off',
359
+ '@typescript-eslint/no-unsafe-return': 'off',
360
+ '@typescript-eslint/require-await': 'off',
361
+ 'unicorn/no-array-callback-reference': 'off',
362
+ 'unicorn/no-await-expression-member': 'off',
436
363
  },
437
- ],
438
- root: true,
439
- }
364
+ },
365
+ prettierConfig,
366
+ ]