@allthings/eslint-config 2.2.2 → 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 +352 -408
  3. package/node.js +321 -363
  4. package/package.json +20 -15
package/index.js CHANGED
@@ -1,422 +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/no-base-to-string': 'warn',
121
- '@typescript-eslint/consistent-type-assertions': 'error',
122
- '@typescript-eslint/consistent-type-definitions': 'off',
123
- '@typescript-eslint/explicit-function-return-type': 'off',
124
- '@typescript-eslint/explicit-module-boundary-types': [
125
- 'warn', // TODO: strict later
126
- {
127
- allowArgumentsExplicitlyTypedAsAny: true,
128
- allowDirectConstAssertionInArrowFunctions: true,
129
- allowHigherOrderFunctions: false,
130
- allowTypedFunctionExpressions: false,
131
- },
132
- ],
133
- '@typescript-eslint/naming-convention': [
134
- 'error',
135
- {
136
- custom: {
137
- match: true,
138
- regex: '^I[A-Z]',
32
+ parserOptions: {
33
+ ecmaFeatures: {
34
+ jsx: true,
139
35
  },
140
- format: ['PascalCase'],
141
- selector: 'interface',
142
- },
143
- ],
144
- '@typescript-eslint/no-empty-function': 'error',
145
- '@typescript-eslint/no-empty-interface': 'error',
146
- '@typescript-eslint/no-explicit-any': 'warn',
147
- '@typescript-eslint/no-for-in-array': 'error',
148
- '@typescript-eslint/no-inferrable-types': 'error',
149
- '@typescript-eslint/no-misused-new': 'error',
150
- '@typescript-eslint/no-namespace': 'error',
151
- '@typescript-eslint/no-redundant-type-constituents': 'warn',
152
- '@typescript-eslint/no-require-imports': 'warn',
153
- '@typescript-eslint/no-shadow': [
154
- 'error',
155
- {
156
- hoist: 'all',
157
- },
158
- ],
159
- '@typescript-eslint/no-this-alias': 'error',
160
- '@typescript-eslint/no-unnecessary-type-assertion': 'warn',
161
- '@typescript-eslint/no-unsafe-argument': 'warn',
162
- '@typescript-eslint/no-unsafe-assignment': 'warn',
163
- '@typescript-eslint/no-unsafe-call': 'warn',
164
- '@typescript-eslint/no-unsafe-enum-comparison': 'off',
165
- '@typescript-eslint/no-unsafe-member-access': 'off',
166
- '@typescript-eslint/no-unsafe-return': 'warn',
167
- '@typescript-eslint/no-unused-expressions': 'error',
168
- '@typescript-eslint/no-unused-vars': [
169
- 'error',
170
- { varsIgnorePattern: '^jsx$' },
171
- ],
172
- '@typescript-eslint/no-use-before-define': 'error',
173
- '@typescript-eslint/no-var-requires': 'error',
174
- '@typescript-eslint/prefer-for-of': 'error',
175
- '@typescript-eslint/prefer-function-type': 'error',
176
- '@typescript-eslint/prefer-namespace-keyword': 'error',
177
- '@typescript-eslint/prefer-nullish-coalescing': 'off',
178
- '@typescript-eslint/prefer-promise-reject-errors': 'warn',
179
- '@typescript-eslint/restrict-template-expressions': 'warn',
180
- '@typescript-eslint/triple-slash-reference': [
181
- 'error',
182
- {
183
- path: 'always',
184
- types: 'prefer-import',
185
- lib: 'always',
186
- },
187
- ],
188
- '@typescript-eslint/typedef': 'error',
189
- '@typescript-eslint/unified-signatures': 'error',
190
- 'arrow-body-style': ['error', 'as-needed'],
191
- complexity: [
192
- 'error',
193
- {
194
- max: 15,
195
- },
196
- ],
197
- 'constructor-super': 'error',
198
- eqeqeq: ['error', 'smart'],
199
- 'guard-for-in': 'error',
200
- 'id-denylist': [
201
- 'error',
202
- 'any',
203
- 'Number',
204
- 'number',
205
- 'String',
206
- 'string',
207
- 'Boolean',
208
- 'boolean',
209
- 'Undefined',
210
- 'undefined',
211
- ],
212
- 'id-match': 'error',
213
- 'import/no-anonymous-default-export': [
214
- 'error',
215
- {
216
- allowAnonymousClass: false,
217
- allowAnonymousFunction: false,
218
- allowArray: false,
219
- allowArrowFunction: true,
220
- allowCallExpression: true,
221
- // The true value here is for backward compatibility
222
- allowLiteral: false,
223
- allowObject: true,
224
- },
225
- ],
226
- 'import/no-extraneous-dependencies': [
227
- 'error',
228
- {
229
- devDependencies: true,
230
- },
231
- ],
232
- 'jest/no-disabled-tests': 'warn',
233
- 'jest/no-focused-tests': 'error',
234
- 'jest/no-identical-title': 'error',
235
- 'jest/valid-expect': 'error',
236
- 'max-classes-per-file': ['error', 1],
237
- 'no-bitwise': 'error',
238
- 'no-caller': 'error',
239
- 'no-cond-assign': 'error',
240
- 'no-console': 'error',
241
- 'no-debugger': 'error',
242
- 'no-duplicate-case': 'error',
243
- 'no-duplicate-imports': 'error',
244
- 'no-empty': 'error',
245
- 'no-eval': 'error',
246
- 'no-extra-bind': 'error',
247
- 'no-multiple-empty-lines': 'error',
248
- 'no-new-func': 'error',
249
- 'no-new-wrappers': 'error',
250
- 'no-param-reassign': 'error',
251
- 'no-redeclare': 'error',
252
- 'no-return-await': 'error',
253
- 'no-sequences': 'error',
254
- 'no-sparse-arrays': 'error',
255
- 'no-template-curly-in-string': 'error',
256
- 'no-throw-literal': 'error',
257
- 'no-trailing-spaces': 'error',
258
- 'no-undef-init': 'error',
259
- 'no-unsafe-finally': 'error',
260
- 'no-unused-labels': 'error',
261
- 'no-var': 'error',
262
- 'object-shorthand': 'error',
263
- 'one-var': ['error', 'never'],
264
- 'padding-line-between-statements': [
265
- 'error',
266
- {
267
- blankLine: 'always',
268
- prev: '*',
269
- next: 'return',
36
+ ecmaVersion: 2021,
37
+ project: 'tsconfig.json',
38
+ sourceType: 'module',
39
+ warnOnUnsupportedTypeScriptVersion: false,
270
40
  },
271
- ],
272
- 'prefer-arrow/prefer-arrow-functions': 'warn',
273
- 'prefer-const': 'error',
274
- 'prefer-object-spread': 'error',
275
- 'prefer-template': 'error',
276
- quotes: ['error', 'single', { avoidEscape: true }],
277
- radix: 'error',
278
- 'react-hooks/exhaustive-deps': 'error',
279
- 'react/jsx-curly-brace-presence': [
280
- 'error',
281
- {
282
- children: 'never',
283
- props: 'never',
284
- },
285
- ],
286
- 'react/jsx-sort-props': [
287
- 2,
288
- {
289
- 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'],
290
53
  },
291
- ],
292
- 'react/react-in-jsx-scope': 'off',
293
- 'react/no-unknown-property': ['error', { ignore: ['css'] }],
294
- 'react/jsx-uses-react': 'error',
295
- 'react/jsx-uses-vars': 'error',
296
- 'simple-import-sort/imports': 'error',
297
- 'simple-import-sort/exports': 'error',
298
- 'sort-keys': 'error',
299
- 'spaced-comment': [
300
- 'error',
301
- 'always',
302
- {
303
- markers: ['/'],
54
+ 'import/resolver': {
55
+ node: { extensions: ['.js', '.jsx', '.ts', '.tsx'] },
56
+ typescript: { alwaysTryTypes: true },
304
57
  },
305
- ],
306
- 'unicorn/better-regex': 'off',
307
- 'unicorn/expiring-todo-comments': 'off',
308
- 'unicorn/filename-case': [
309
- 'warn',
310
- {
311
- cases: {
312
- camelCase: true,
313
- 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
+ },
314
76
  },
315
- },
316
- ],
317
- 'unicorn/import-style': 'warn',
318
- 'unicorn/no-anonymous-default-export': 'off',
319
- 'unicorn/no-array-reduce': 'off',
320
- 'unicorn/no-console-spaces': 'off',
321
- 'unicorn/no-document-cookie': 'warn',
322
- 'unicorn/no-empty-file': 'off',
323
- 'unicorn/no-hex-escape': 'warn',
324
- 'unicorn/no-invalid-remove-event-listener': 'warn',
325
- 'unicorn/no-nested-ternary': 'off',
326
- 'unicorn/no-object-as-default-parameter': 'warn',
327
- 'unicorn/no-single-promise-in-promise-methods': 'warn',
328
- 'unicorn/no-unreadable-array-destructuring': 'off',
329
- 'unicorn/no-unsafe-regex': 'off',
330
- 'unicorn/no-unused-properties': 'warn',
331
- 'unicorn/no-zero-fractions': 'off',
332
- 'unicorn/prevent-abbreviations': [
333
- 'error',
334
- {
335
- allowList: {
336
- props: true,
77
+ ],
78
+ '@stylistic/quotes': [
79
+ 'error',
80
+ 'single',
81
+ {
82
+ avoidEscape: true,
337
83
  },
338
- replacements: {
339
- props: {
340
- 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]',
341
112
  },
113
+ format: ['PascalCase'],
114
+ selector: 'interface',
342
115
  },
343
- },
344
- ],
345
- 'unicorn/prefer-export-from': 'off',
346
- 'unicorn/prefer-global-this': 'warn',
347
- 'unicorn/prefer-includes': 'off',
348
- 'unicorn/prefer-math-min-max': 'warn',
349
- 'unicorn/prefer-module': 'warn',
350
- 'unicorn/prefer-optional-catch-binding': 'off',
351
- 'unicorn/prefer-prototype-methods': 'off',
352
- 'unicorn/prefer-query-selector': 'off',
353
- 'unicorn/prefer-regexp-test': 'off',
354
- 'unicorn/prefer-set-has': 'off',
355
- 'unicorn/prefer-set-size': 'off',
356
- 'unicorn/prefer-string-raw': 'off',
357
- 'unicorn/prefer-string-replace-all': 'off',
358
- 'unicorn/prefer-structured-clone': 'warn',
359
- 'unicorn/prefer-node-protocol': 'off',
360
- 'unicorn/relative-url-style': 'off',
361
- 'unicorn/switch-case-braces': 'off',
362
- 'unicorn/template-indent': 'off',
363
- 'use-isnan': 'error',
364
- },
365
- parser: '@typescript-eslint/parser',
366
- parserOptions: {
367
- ecmaFeatures: {
368
- jsx: true,
369
- },
370
- ecmaVersion: 2021,
371
- project: 'tsconfig.json',
372
- sourceType: 'module',
373
- warnOnUnsupportedTypeScriptVersion: false,
374
- },
375
- settings: {
376
- react: {
377
- version: 'detect',
378
- },
379
- 'import/parsers': {
380
- [require.resolve('@typescript-eslint/parser')]: [
381
- '.ts',
382
- '.mts',
383
- '.cts',
384
- '.tsx',
385
- '.d.ts',
386
116
  ],
387
- },
388
- 'import/resolver': {
389
- [require.resolve('eslint-import-resolver-node')]: {
390
- extensions: ['.js', '.jsx', '.ts', '.tsx'],
391
- },
392
- [require.resolve('eslint-import-resolver-typescript')]: {
393
- alwaysTryTypes: true,
394
- },
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,
291
+ },
292
+ },
293
+ ],
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',
395
348
  },
396
349
  },
397
- env: {
398
- browser: true,
399
- node: true,
400
- 'jest/globals': true,
401
- },
402
- globals: {
403
- describe: true,
404
- expect: true,
405
- fetch: false,
406
- it: true,
407
- jest: true,
408
- MutationObserver: true,
409
- },
410
- overrides: [
411
- {
412
- // because of jest
413
- files: ['*.test.ts'],
414
- rules: {
415
- '@typescript-eslint/explicit-function-return-type': 'off',
416
- '@typescript-eslint/no-explicit-any': 'off',
417
- '@typescript-eslint/no-misused-promises': 'off',
418
- },
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',
419
363
  },
420
- ],
421
- root: true,
422
- }
364
+ },
365
+ prettierConfig,
366
+ ]