@robinblomberg/eslint-config-robinblomberg 0.32.0 → 0.34.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.
package/index.js CHANGED
@@ -1,1540 +1,1574 @@
1
- const { defineConfig } = require('eslint-define-config');
1
+ import babelParser from '@babel/eslint-parser';
2
+ import typescriptEslintPlugin from '@typescript-eslint/eslint-plugin';
3
+ import typescriptEslintParser from '@typescript-eslint/parser';
4
+ import importPlugin from 'eslint-plugin-import';
5
+ import jsdocPlugin from 'eslint-plugin-jsdoc';
6
+ import jsxA11yPlugin from 'eslint-plugin-jsx-a11y';
7
+ import reactPlugin from 'eslint-plugin-react';
8
+ import reactHooksPlugin from 'eslint-plugin-react-hooks';
9
+ import reactRefreshPlugin from 'eslint-plugin-react-refresh';
10
+ import sonarjsPlugin from 'eslint-plugin-sonarjs';
11
+ // @ts-expect-error - No published type declarations:
12
+ import sortExportsPlugin from 'eslint-plugin-sort-exports';
13
+ // @ts-expect-error - No published type declarations:
14
+ import sortKeysPlugin from 'eslint-plugin-sort-keys';
15
+ import storybookPlugin from 'eslint-plugin-storybook';
16
+ import unicornPlugin from 'eslint-plugin-unicorn';
17
+ import globals from 'globals';
2
18
 
3
19
  const IS_DEVELOPMENT = !process.env.CI && process.env.NODE_ENV !== 'production';
4
20
  const error = 'error';
5
21
  const off = 'off';
6
22
  const warn = IS_DEVELOPMENT ? 'warn' : 'error';
7
23
 
8
- module.exports = defineConfig({
9
- env: {
10
- browser: true,
11
- es2024: true,
12
- node: true,
24
+ /** @type {import('eslint').Linter.Config[]} */
25
+ const config = [
26
+ {
27
+ ignores: ['**/.*/**', '**/node_modules/**'],
13
28
  },
14
- globals: {
15
- globalThis: true,
16
- },
17
- ignorePatterns: ['**/.*/**', '**/node_modules/**'],
18
- overrides: [
19
- {
20
- files: ['**/*.ts', '**/*.tsx', '**/*.d.ts'],
21
- globals: {
22
- NodeJS: true,
23
- },
24
- parser: '@typescript-eslint/parser',
29
+ {
30
+ languageOptions: {
31
+ ecmaVersion: 'latest',
32
+ sourceType: 'module',
33
+ parser: babelParser,
25
34
  parserOptions: {
26
- project: './tsconfig.json',
27
- },
28
- plugins: ['@typescript-eslint'],
29
- rules: {
30
- '@typescript-eslint/adjacent-overload-signatures': warn,
31
- '@typescript-eslint/array-type': [warn, { default: 'array' }],
32
- // Disabled due to slow performance:
33
- '@typescript-eslint/await-thenable': off,
34
- '@typescript-eslint/ban-ts-comment': warn,
35
- '@typescript-eslint/ban-tslint-comment': warn,
36
- '@typescript-eslint/ban-types': [
37
- off,
38
- {
39
- extendDefaults: true,
40
- types: {
41
- Boolean: false,
42
- Function: false,
43
- Number: false,
44
- Object: false,
45
- '{}': false,
46
- },
47
- },
48
- ],
49
- '@typescript-eslint/brace-style': warn,
50
- '@typescript-eslint/camelcase': off,
51
- '@typescript-eslint/class-literal-property-style': [warn, 'fields'],
52
- '@typescript-eslint/comma-dangle': [warn, 'always-multiline'],
53
- '@typescript-eslint/comma-spacing': [
54
- warn,
55
- { after: true, before: false },
56
- ],
57
- '@typescript-eslint/consistent-type-assertions': [
58
- off,
59
- {
60
- assertionStyle: 'as',
61
- objectLiteralTypeAssertions: 'never',
62
- },
63
- ],
64
- '@typescript-eslint/consistent-type-definitions': [warn, 'type'],
65
- '@typescript-eslint/consistent-type-imports': [
66
- warn,
67
- {
68
- disallowTypeAnnotations: true,
69
- fixStyle: 'separate-type-imports',
70
- prefer: 'type-imports',
71
- },
72
- ],
73
- '@typescript-eslint/default-param-last': warn,
74
- '@typescript-eslint/dot-notation': warn,
75
- '@typescript-eslint/explicit-function-return-type': [
76
- off,
77
- { allowTypedFunctionExpressions: true },
78
- ],
79
- '@typescript-eslint/explicit-member-accessibility': [
80
- warn,
81
- { accessibility: 'no-public' },
82
- ],
83
- '@typescript-eslint/explicit-module-boundary-types': off,
84
- '@typescript-eslint/func-call-spacing': warn,
85
- '@typescript-eslint/indent': [
86
- warn,
87
- 2,
88
- {
89
- SwitchCase: 1,
90
- // Ignored nodes due to false positives:
91
- ignoredNodes: [
92
- 'TSIntersectionType',
93
- 'TSTypeParameterInstantiation',
94
- 'TSUnionType',
95
- ],
96
- },
97
- ],
98
- // Definition not found (2020-10-26):
99
- // '@typescript-eslint/index': warn,
100
- '@typescript-eslint/init-declarations': off,
101
- '@typescript-eslint/keyword-spacing': warn,
102
- '@typescript-eslint/lines-between-class-members': [
103
- off,
104
- 'always',
105
- { exceptAfterOverload: true, exceptAfterSingleLine: true },
106
- ],
107
- '@typescript-eslint/member-delimiter-style': [
108
- warn,
109
- {
110
- multiline: { delimiter: 'semi', requireLast: true },
111
- singleline: { delimiter: 'semi', requireLast: true },
112
- },
113
- ],
114
- // Disabled to due buggy ordering:
115
- '@typescript-eslint/member-ordering': [
116
- off,
117
- {
118
- default: [
119
- 'signature',
120
- 'private-static-field',
121
- 'protected-static-field',
122
- 'public-static-field',
123
- 'private-static-method',
124
- 'protected-static-method',
125
- 'public-static-method',
126
- 'private-decorated-field',
127
- 'protected-decorated-field',
128
- 'public-decorated-field',
129
- 'private-instance-field',
130
- 'protected-instance-field',
131
- 'public-instance-field',
132
- 'protected-abstract-field',
133
- 'public-abstract-field',
134
- 'static-field',
135
- 'private-field',
136
- 'protected-field',
137
- 'public-field',
138
- 'instance-field',
139
- 'abstract-field',
140
- 'decorated-field',
141
- 'field',
142
- 'private-constructor',
143
- 'protected-constructor',
144
- 'public-constructor',
145
- 'constructor',
146
- 'private-decorated-method',
147
- 'protected-decorated-method',
148
- 'public-decorated-method',
149
- 'private-instance-method',
150
- 'protected-instance-method',
151
- 'public-instance-method',
152
- 'protected-abstract-method',
153
- 'public-abstract-method',
154
- 'static-method',
155
- 'private-method',
156
- 'protected-method',
157
- 'public-method',
158
- 'instance-method',
159
- 'abstract-method',
160
- 'decorated-method',
161
- 'method',
162
- ],
163
- },
164
- ],
165
- '@typescript-eslint/method-signature-style': [warn, 'property'],
166
- '@typescript-eslint/naming-convention': [
167
- off,
168
- {
169
- format: ['camelCase'],
170
- leadingUnderscore: 'allow',
171
- selector: 'default',
172
- },
173
- {
174
- format: ['camelCase', 'snake_case', 'PascalCase', 'UPPER_CASE'],
175
- leadingUnderscore: 'allow',
176
- selector: ['objectLiteralProperty'],
177
- },
178
- {
179
- format: ['camelCase', 'PascalCase'],
180
- leadingUnderscore: 'allow',
181
- selector: ['function'],
182
- },
183
- {
184
- format: ['camelCase', 'UPPER_CASE'],
185
- leadingUnderscore: 'allow',
186
- selector: ['objectLiteralMethod', 'typeMethod', 'variable'],
187
- },
188
- {
189
- format: ['PascalCase'],
190
- leadingUnderscore: 'allow',
191
- selector: [
192
- 'class',
193
- 'enum',
194
- 'interface',
195
- 'typeAlias',
196
- 'typeParameter',
197
- ],
198
- },
199
- {
200
- format: ['UPPER_CASE'],
201
- leadingUnderscore: 'allow',
202
- selector: ['enumMember'],
203
- },
204
- {
205
- format: null,
206
- leadingUnderscore: 'allow',
207
- selector: ['parameter', 'property'],
208
- },
209
- ],
210
- '@typescript-eslint/no-array-constructor': warn,
211
- '@typescript-eslint/no-base-to-string': warn,
212
- '@typescript-eslint/no-confusing-non-null-assertion': off,
213
- '@typescript-eslint/no-dupe-class-members': warn,
214
- '@typescript-eslint/no-dynamic-delete': off,
215
- '@typescript-eslint/no-empty-function': off,
216
- '@typescript-eslint/no-empty-interface': warn,
217
- // Often warns about necessary uses:
218
- '@typescript-eslint/no-explicit-any': off,
219
- '@typescript-eslint/no-extra-non-null-assertion': warn,
220
- '@typescript-eslint/no-extra-parens': [
221
- warn,
222
- 'all',
223
- { ignoreJSX: 'all', nestedBinaryExpressions: false },
224
- ],
225
- '@typescript-eslint/no-extra-semi': warn,
226
- '@typescript-eslint/no-extraneous-class': off,
227
- // Disabled due to slow performance:
228
- '@typescript-eslint/no-floating-promises': [
229
- off,
230
- { ignoreIIFE: true, ignoreVoid: true },
231
- ],
232
- '@typescript-eslint/no-for-in-array': warn,
233
- '@typescript-eslint/no-implicit-any-catch': off,
234
- '@typescript-eslint/no-implied-eval': warn,
235
- '@typescript-eslint/no-inferrable-types': warn,
236
- '@typescript-eslint/no-invalid-this': off,
237
- '@typescript-eslint/no-invalid-void-type': off,
238
- '@typescript-eslint/no-loop-func': warn,
239
- '@typescript-eslint/no-loss-of-precision': warn,
240
- '@typescript-eslint/no-magic-numbers': [
241
- off,
242
- {
243
- ignore: [-1, 0, 1, 2, 3, '-1n', '0n', '1n', '2n', '3n'],
244
- ignoreEnums: true,
245
- ignoreNumericLiteralTypes: true,
246
- ignoreReadonlyClassProperties: true,
247
- },
248
- ],
249
- '@typescript-eslint/no-misused-new': warn,
250
- '@typescript-eslint/no-misused-promises': off,
251
- '@typescript-eslint/no-namespace': [off, { allowDeclarations: true }],
252
- '@typescript-eslint/no-non-null-asserted-optional-chain': warn,
253
- '@typescript-eslint/no-non-null-assertion': off,
254
- '@typescript-eslint/no-parameter-properties': off,
255
- '@typescript-eslint/no-redeclare': off,
256
- '@typescript-eslint/no-require-imports': off,
257
- '@typescript-eslint/no-shadow': warn,
258
- '@typescript-eslint/no-this-alias': warn,
259
- '@typescript-eslint/no-type-alias': off,
260
- '@typescript-eslint/no-unnecessary-boolean-literal-compare': warn,
261
- '@typescript-eslint/no-unnecessary-condition': off,
262
- // Disabled due to slow performance:
263
- '@typescript-eslint/no-unnecessary-qualifier': off,
264
- '@typescript-eslint/no-unnecessary-type-arguments': off,
265
- '@typescript-eslint/no-unnecessary-type-assertion': warn,
266
- '@typescript-eslint/no-unsafe-assignment': off,
267
- '@typescript-eslint/no-unsafe-call': off,
268
- '@typescript-eslint/no-unsafe-member-access': off,
269
- '@typescript-eslint/no-unsafe-return': off,
270
- '@typescript-eslint/no-unused-expressions': [
271
- warn,
272
- {
273
- allowShortCircuit: true,
274
- allowTaggedTemplates: true,
275
- allowTernary: true,
276
- },
277
- ],
278
- '@typescript-eslint/no-unused-vars': [
279
- warn,
280
- {
281
- args: 'none',
282
- argsIgnorePattern: '^_.*$',
283
- vars: 'all',
284
- varsIgnorePattern: '^_.*$|^T$',
285
- },
286
- ],
287
- '@typescript-eslint/no-use-before-define': [
288
- error,
289
- { classes: false, functions: false, variables: false },
290
- ],
291
- '@typescript-eslint/no-useless-constructor': warn,
292
- '@typescript-eslint/no-var-requires': off,
293
- '@typescript-eslint/only-throw-error': warn,
294
- '@typescript-eslint/prefer-as-const': warn,
295
- '@typescript-eslint/prefer-enum-initializers': off,
296
- '@typescript-eslint/prefer-for-of': warn,
297
- '@typescript-eslint/prefer-function-type': warn,
298
- '@typescript-eslint/prefer-includes': warn,
299
- '@typescript-eslint/prefer-literal-enum-member': warn,
300
- '@typescript-eslint/prefer-namespace-keyword': warn,
301
- // Warns about correct uses of `||`:
302
- '@typescript-eslint/prefer-nullish-coalescing': off,
303
- '@typescript-eslint/prefer-optional-chain': warn,
304
- '@typescript-eslint/prefer-readonly': warn,
305
- // Disabled due to error:
306
- // "Error: Non-null Assertion Failed: Expected to find a property "XXX" for the type."
307
- '@typescript-eslint/prefer-readonly-parameter-types': off,
308
- '@typescript-eslint/prefer-reduce-type-parameter': warn,
309
- '@typescript-eslint/prefer-regexp-exec': off,
310
- '@typescript-eslint/prefer-string-starts-ends-with': off,
311
- '@typescript-eslint/prefer-ts-expect-error': warn,
312
- '@typescript-eslint/promise-function-async': off,
313
- '@typescript-eslint/quotes': [warn, 'single'],
314
- '@typescript-eslint/require-array-sort-compare': [
315
- warn,
316
- { ignoreStringArrays: true },
317
- ],
318
- '@typescript-eslint/require-await': warn,
319
- '@typescript-eslint/restrict-plus-operands': [
320
- error,
321
- { allowAny: false },
322
- ],
323
- // Disabled due to false positives:
324
- '@typescript-eslint/restrict-template-expressions': off,
325
- '@typescript-eslint/return-await': [warn, 'always'],
326
- '@typescript-eslint/semi': [warn, 'always'],
327
- '@typescript-eslint/space-before-function-paren': [warn, 'always'],
328
- '@typescript-eslint/strict-boolean-expressions': off,
329
- '@typescript-eslint/switch-exhaustiveness-check': [
330
- warn,
331
- {
332
- allowDefaultCaseForExhaustiveSwitch: true,
333
- considerDefaultExhaustiveForUnions: true,
334
- requireDefaultForNonUnion: true,
335
- },
336
- ],
337
- '@typescript-eslint/triple-slash-reference': warn,
338
- '@typescript-eslint/type-annotation-spacing': warn,
339
- '@typescript-eslint/typedef': off,
340
- '@typescript-eslint/unbound-method': off,
341
- '@typescript-eslint/unified-signatures': warn,
342
- 'default-case': off,
343
- 'default-param-last': off,
344
- // Incompatible with the `noPropertyAccessFromIndexSignature` config setting:
345
- 'dot-notation': off,
346
- 'func-call-spacing': off,
347
- 'import/exports-last': off,
348
- 'import/no-unassigned-import': off,
349
- // Disabled due to false positives:
350
- 'import/no-unresolved': [off, { ignore: ['\\.types$'] }],
351
- indent: off,
352
- 'init-declarations': off,
353
- 'jsdoc/check-examples': off,
354
- 'jsdoc/require-description': off,
355
- 'jsdoc/require-description-complete-sentence': off,
356
- 'jsdoc/require-example': off,
357
- 'jsdoc/require-file-overview': off,
358
- 'jsdoc/require-hyphen-before-param-description': off,
359
- 'jsdoc/require-jsdoc': off,
360
- 'jsdoc/require-param': off,
361
- 'jsdoc/require-param-description': off,
362
- 'jsdoc/require-param-name': off,
363
- 'jsdoc/require-param-type': off,
364
- 'jsdoc/require-property': off,
365
- 'jsdoc/require-property-description': off,
366
- 'jsdoc/require-property-name': off,
367
- 'jsdoc/require-property-type': off,
368
- 'jsdoc/require-returns': off,
369
- 'jsdoc/require-returns-check': off,
370
- 'jsdoc/require-returns-description': off,
371
- 'jsdoc/require-returns-type': off,
372
- 'keyword-spacing': off,
373
- 'lines-between-class-members': off,
374
- 'no-dupe-class-members': off,
375
- 'no-duplicate-imports': off,
376
- 'no-empty-function': off,
377
- 'no-extra-parens': off,
378
- 'no-extra-semi': off,
379
- 'no-invalid-this': off,
380
- 'no-loop-func': off,
381
- 'no-loss-of-precision': off,
382
- // Handled by `@typescript-eslint/no-implied-eval`:
383
- 'no-new-func': off,
384
- 'no-redeclare': off,
385
- 'no-return-await': off,
386
- 'no-shadow': off,
387
- /**
388
- * @see https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/FAQ.md#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
389
- */
390
- 'no-undef': off,
391
- 'no-unused-expressions': off,
392
- 'no-unused-vars': off,
393
- 'no-use-before-define': off,
394
- 'no-useless-constructor': off,
395
- 'no-void': off,
396
- quotes: off,
397
- 'require-await': off,
398
- semi: off,
399
- 'space-before-function-paren': off,
35
+ allowAwaitOutsideFunction: true,
36
+ ecmaFeatures: {
37
+ jsx: true,
38
+ },
39
+ requireConfigFile: false,
400
40
  },
401
- },
402
- // Based on `storybook/recommended`:
403
- {
404
- files: [
405
- '**/*.stories.@(ts|tsx|js|jsx|mjs|cjs)',
406
- '**/*.stories.fixtures.@(ts|tsx|js|jsx|mjs|cjs)',
407
- '**/*.story.@(ts|tsx|js|jsx|mjs|cjs)',
408
- ],
409
- rules: {
410
- 'import/no-anonymous-default-export': off,
411
- 'react/no-multi-comp': off,
412
- 'react-hooks/rules-of-hooks': off,
413
- 'storybook/await-interactions': error,
414
- 'storybook/context-in-play-function': error,
415
- 'storybook/default-exports': error,
416
- 'storybook/hierarchy-separator': warn,
417
- 'storybook/no-redundant-story-name': warn,
418
- 'storybook/prefer-pascal-case': warn,
419
- 'storybook/story-exports': error,
420
- 'storybook/use-storybook-expect': error,
421
- 'storybook/use-storybook-testing-library': error,
41
+ globals: {
42
+ ...globals.browser,
43
+ ...globals.es2024,
44
+ ...globals.node,
45
+ globalThis: 'writable',
422
46
  },
423
47
  },
424
- // Based on `storybook/recommended`:
425
- {
426
- files: ['**/.storybook/main.@(js|cjs|mjs|ts)'],
427
- rules: {
428
- 'storybook/no-uninstalled-addons': error,
429
- },
48
+ plugins: {
49
+ import: importPlugin,
50
+ jsdoc: jsdocPlugin,
51
+ 'sort-exports': /** @type {any} */ (sortExportsPlugin),
52
+ 'sort-keys': /** @type {any} */ (sortKeysPlugin),
53
+ sonarjs: sonarjsPlugin,
54
+ storybook: /** @type {any} */ (storybookPlugin),
55
+ unicorn: unicornPlugin,
430
56
  },
431
- {
432
- files: [
433
- '**/spec/**',
434
- '**/test/**',
435
- '**/tests/**',
436
- '**/*.spec.*',
437
- '**/*.test.*',
57
+ rules: {
58
+ 'accessor-pairs': warn,
59
+ 'array-bracket-newline': off,
60
+ 'array-bracket-spacing': [warn, 'never'],
61
+ 'array-callback-return': warn,
62
+ 'array-element-newline': [warn, 'consistent'],
63
+ 'arrow-body-style': off,
64
+ 'arrow-parens': [warn, 'always'],
65
+ 'arrow-spacing': [warn, { after: true, before: true }],
66
+ 'block-scoped-var': warn,
67
+ 'block-spacing': [warn, 'always'],
68
+ 'brace-style': [warn, '1tbs'],
69
+ 'callback-return': [off, ['callback', 'cb', 'next']],
70
+ camelcase: [off, { properties: 'never' }],
71
+ 'capitalized-comments': off,
72
+ 'class-methods-use-this': off,
73
+ 'comma-dangle': [warn, 'always-multiline'],
74
+ 'comma-spacing': [warn, { after: true, before: false }],
75
+ 'comma-style': [warn, 'last'],
76
+ complexity: off,
77
+ 'computed-property-spacing': [warn, 'never'],
78
+ 'consistent-return': off,
79
+ 'consistent-this': warn,
80
+ 'constructor-super': warn,
81
+ curly: [warn, 'all'],
82
+ 'default-case': warn,
83
+ 'default-param-last': warn,
84
+ 'dot-location': [warn, 'property'],
85
+ 'dot-notation': [warn, { allowKeywords: true }],
86
+ 'eol-last': warn,
87
+ eqeqeq: [warn, 'always', { null: 'ignore' }],
88
+ 'for-direction': warn,
89
+ 'func-call-spacing': [warn, 'never'],
90
+ 'func-name-matching': warn,
91
+ 'func-names': [off, 'as-needed'],
92
+ 'func-style': [off, 'expression'],
93
+ 'function-call-argument-newline': off,
94
+ 'function-paren-newline': off,
95
+ 'generator-star-spacing': [warn, { after: true, before: true }],
96
+ 'getter-return': warn,
97
+ 'global-require': off,
98
+ 'guard-for-in': off,
99
+ 'handle-callback-err': [warn, '^(err|error)$'],
100
+ 'id-blacklist': warn,
101
+ 'id-length': off,
102
+ 'id-match': [warn, '^[$_]$|^[$_]?[_A-Za-z][A-Za-z0-9_]*$'],
103
+ 'implicit-arrow-linebreak': [off, 'beside'],
104
+ 'import/default': warn,
105
+ 'import/dynamic-import-chunkname': off,
106
+ 'import/export': warn,
107
+ 'import/exports-last': off,
108
+ // This should be opt-in. It's not necessary for Vite, for example.
109
+ 'import/extensions': [off, { js: 'always', json: 'always' }],
110
+ 'import/first': warn,
111
+ 'import/group-exports': off,
112
+ 'import/imports-first': warn,
113
+ 'import/max-dependencies': off,
114
+ // Disabled due to false positives:
115
+ 'import/named': off,
116
+ // Disabled due to false positives:
117
+ 'import/namespace': off,
118
+ 'import/newline-after-import': warn,
119
+ 'import/no-absolute-path': warn,
120
+ 'import/no-amd': warn,
121
+ 'import/no-anonymous-default-export': warn,
122
+ 'import/no-commonjs': off,
123
+ 'import/no-cycle': off,
124
+ 'import/no-default-export': off,
125
+ // Disabled due to slow performance:
126
+ 'import/no-deprecated': off,
127
+ // Disabled due to slow performance, and because it's duplicated by `no-duplicate-imports`:
128
+ 'import/no-duplicates': off,
129
+ 'import/no-dynamic-require': off,
130
+ 'import/no-extraneous-dependencies': warn,
131
+ 'import/no-internal-modules': [
132
+ off,
133
+ { allow: ['[@a-z][@a-z]***', '**/*.svg'] },
134
+ ],
135
+ 'import/no-mutable-exports': warn,
136
+ 'import/no-named-as-default': warn,
137
+ 'import/no-named-as-default-member': warn,
138
+ 'import/no-named-default': warn,
139
+ 'import/no-named-export': off,
140
+ 'import/no-namespace': off,
141
+ 'import/no-nodejs-modules': off,
142
+ // Disabled due to false positives (e.g. "@robinblomberg/schema"):
143
+ 'import/no-relative-parent-imports': off,
144
+ 'import/no-restricted-paths': off,
145
+ // Disabled due to slow performance:
146
+ 'import/no-self-import': off,
147
+ 'import/no-unassigned-import': warn,
148
+ // Disabled due to false positives on packages without a `main` field:
149
+ 'import/no-unresolved': off,
150
+ 'import/no-unused-modules': warn,
151
+ // Disabled due to slow performance:
152
+ 'import/no-useless-path-segments': off,
153
+ 'import/no-webpack-loader-syntax': warn,
154
+ /* 'import/order': [warn, {
155
+ alphabetize: {
156
+ caseInsensitive: false,
157
+ order: 'asc'
158
+ },
159
+ groups: [
160
+ 'builtin',
161
+ 'external',
162
+ 'internal',
163
+ 'unknown',
164
+ 'parent',
165
+ 'sibling',
166
+ 'index',
167
+ 'object'
168
+ ],
169
+ 'newlines-between': 'never'
170
+ }], */
171
+ 'import/prefer-default-export': off,
172
+ 'import/unambiguous': off,
173
+ indent: [warn, 2, { SwitchCase: 1 }],
174
+ 'init-declarations': off,
175
+ 'jsx-quotes': warn,
176
+ 'key-spacing': [warn, { afterColon: true, beforeColon: false }],
177
+ 'keyword-spacing': [off, { after: true, before: true }],
178
+ 'line-comment-position': off,
179
+ 'linebreak-style': [warn, 'unix'],
180
+ 'lines-around-comment': off,
181
+ 'lines-between-class-members': [
182
+ warn,
183
+ 'always',
184
+ { exceptAfterSingleLine: true },
185
+ ],
186
+ 'max-classes-per-file': [off, 1],
187
+ 'max-depth': off,
188
+ 'max-len': [
189
+ warn,
190
+ { code: 100, ignoreComments: true, ignoreRegExpLiterals: true },
191
+ ],
192
+ 'max-lines': off,
193
+ 'max-lines-per-function': off,
194
+ 'max-nested-callbacks': warn,
195
+ 'max-params': off,
196
+ 'max-statements': off,
197
+ 'max-statements-per-line': [warn, { max: 1 }],
198
+ 'multiline-comment-style': off,
199
+ 'multiline-ternary': off,
200
+ 'new-cap': [warn, { capIsNew: false, newIsCap: true, properties: true }],
201
+ 'new-parens': warn,
202
+ 'newline-per-chained-call': off,
203
+ 'no-alert': off,
204
+ 'no-array-constructor': warn,
205
+ 'no-async-promise-executor': warn,
206
+ 'no-await-in-loop': off,
207
+ 'no-bitwise': off,
208
+ 'no-buffer-constructor': warn,
209
+ 'no-caller': warn,
210
+ 'no-case-declarations': warn,
211
+ 'no-class-assign': warn,
212
+ 'no-compare-neg-zero': warn,
213
+ 'no-cond-assign': warn,
214
+ 'no-confusing-arrow': off,
215
+ 'no-console': [off, { allow: ['debug', 'error', 'info', 'warn'] }],
216
+ 'no-const-assign': warn,
217
+ 'no-constant-condition': [warn, { checkLoops: false }],
218
+ 'no-continue': off,
219
+ 'no-control-regex': off,
220
+ 'no-debugger': warn,
221
+ 'no-delete-var': warn,
222
+ 'no-div-regex': off,
223
+ 'no-dupe-args': warn,
224
+ 'no-dupe-class-members': warn,
225
+ 'no-dupe-keys': warn,
226
+ 'no-duplicate-case': warn,
227
+ 'no-duplicate-imports': warn,
228
+ 'no-else-return': warn,
229
+ 'no-empty': [off, { allowEmptyCatch: true }],
230
+ 'no-empty-character-class': warn,
231
+ 'no-empty-function': off,
232
+ 'no-empty-pattern': off,
233
+ 'no-eq-null': off,
234
+ 'no-eval': warn,
235
+ 'no-ex-assign': warn,
236
+ 'no-extend-native': warn,
237
+ 'no-extra-bind': warn,
238
+ 'no-extra-boolean-cast': warn,
239
+ 'no-extra-label': warn,
240
+ 'no-extra-parens': [off, 'all', { nestedBinaryExpressions: false }],
241
+ 'no-extra-semi': warn,
242
+ 'no-fallthrough': warn,
243
+ 'no-floating-decimal': warn,
244
+ 'no-func-assign': warn,
245
+ 'no-global-assign': warn,
246
+ 'no-implicit-coercion': [warn, { boolean: false, number: false }],
247
+ 'no-implicit-globals': warn,
248
+ 'no-implied-eval': warn,
249
+ 'no-inline-comments': off,
250
+ 'no-inner-declarations': [warn, 'functions'],
251
+ 'no-invalid-regexp': warn,
252
+ 'no-invalid-this': off,
253
+ 'no-irregular-whitespace': warn,
254
+ 'no-iterator': warn,
255
+ 'no-label-var': warn,
256
+ 'no-labels': [off, { allowLoop: false, allowSwitch: false }],
257
+ 'no-lone-blocks': off,
258
+ 'no-lonely-if': warn,
259
+ 'no-loop-func': warn,
260
+ 'no-loss-of-precision': warn,
261
+ 'no-magic-numbers': [
262
+ off,
263
+ { ignore: [-1, 0, 1, 2, 3, '-1n', '0n', '1n', '2n', '3n'] },
264
+ ],
265
+ 'no-misleading-character-class': warn,
266
+ 'no-mixed-operators': [
267
+ warn,
268
+ {
269
+ allowSamePrecedence: true,
270
+ groups: [
271
+ ['==', '!=', '===', '!==', '>', '>=', '<', '<='],
272
+ ['&&', '||'],
273
+ ['in', 'instanceof'],
274
+ ],
275
+ },
276
+ ],
277
+ 'no-mixed-requires': warn,
278
+ 'no-mixed-spaces-and-tabs': warn,
279
+ 'no-multi-assign': off,
280
+ 'no-multi-spaces': warn,
281
+ 'no-multi-str': warn,
282
+ 'no-multiple-empty-lines': [warn, { max: 1, maxEOF: 0 }],
283
+ // Replaced by `unicorn/no-negated-condition`:
284
+ 'no-negated-condition': off,
285
+ 'no-negated-in-lhs': warn,
286
+ 'no-nested-ternary': off,
287
+ 'no-new': warn,
288
+ 'no-new-func': warn,
289
+ 'no-new-object': warn,
290
+ 'no-new-require': warn,
291
+ 'no-new-symbol': warn,
292
+ 'no-new-wrappers': off,
293
+ 'no-obj-calls': warn,
294
+ 'no-octal': warn,
295
+ 'no-octal-escape': warn,
296
+ 'no-param-reassign': off,
297
+ 'no-path-concat': warn,
298
+ 'no-plusplus': off,
299
+ 'no-process-env': off,
300
+ 'no-process-exit': off,
301
+ 'no-proto': warn,
302
+ 'no-prototype-builtins': warn,
303
+ 'no-redeclare': [warn, { builtinGlobals: false }],
304
+ 'no-regex-spaces': warn,
305
+ 'no-restricted-globals': [
306
+ error,
307
+ 'isNaN',
308
+ /*
309
+ * https://github.com/sidoshi/eslint-restricted-globals/blob/master/index.js
310
+ */
311
+ 'addEventListener',
312
+ 'blur',
313
+ 'close',
314
+ 'closed',
315
+ 'confirm',
316
+ 'defaultStatus',
317
+ 'event',
318
+ 'external',
319
+ 'defaultstatus',
320
+ 'find',
321
+ 'focus',
322
+ 'frameElement',
323
+ 'frames',
324
+ 'history',
325
+ 'innerHeight',
326
+ 'innerWidth',
327
+ 'length',
328
+ 'location',
329
+ 'locationbar',
330
+ 'menubar',
331
+ 'moveBy',
332
+ 'moveTo',
333
+ 'name',
334
+ 'onblur',
335
+ 'onerror',
336
+ 'onfocus',
337
+ 'onload',
338
+ 'onresize',
339
+ 'onunload',
340
+ 'open',
341
+ 'opener',
342
+ 'opera',
343
+ 'outerHeight',
344
+ 'outerWidth',
345
+ 'pageXOffset',
346
+ 'pageYOffset',
347
+ 'parent',
348
+ 'print',
349
+ 'removeEventListener',
350
+ 'resizeBy',
351
+ 'resizeTo',
352
+ 'screen',
353
+ 'screenLeft',
354
+ 'screenTop',
355
+ 'screenX',
356
+ 'screenY',
357
+ 'scroll',
358
+ 'scrollbars',
359
+ 'scrollBy',
360
+ 'scrollTo',
361
+ 'scrollX',
362
+ 'scrollY',
363
+ 'self',
364
+ 'status',
365
+ 'statusbar',
366
+ 'stop',
367
+ 'toolbar',
368
+ 'top',
369
+ ],
370
+ 'no-restricted-imports': [
371
+ 'error',
372
+ { paths: ['console', 'node:console', 'test', 'node:test'] },
373
+ ],
374
+ 'no-restricted-modules': warn,
375
+ 'no-restricted-properties': warn,
376
+ 'no-restricted-syntax': [warn, 'WithStatement'],
377
+ 'no-return-assign': [warn, 'except-parens'],
378
+ 'no-return-await': off,
379
+ 'no-script-url': warn,
380
+ 'no-self-assign': [warn, { props: true }],
381
+ 'no-self-compare': warn,
382
+ 'no-sequences': warn,
383
+ 'no-shadow': warn,
384
+ 'no-shadow-restricted-names': warn,
385
+ 'no-sparse-arrays': warn,
386
+ 'no-sync': off,
387
+ 'no-tabs': warn,
388
+ 'no-template-curly-in-string': off,
389
+ 'no-ternary': off,
390
+ 'no-this-before-super': warn,
391
+ 'no-throw-literal': warn,
392
+ 'no-trailing-spaces': warn,
393
+ 'no-undef': error,
394
+ 'no-undef-init': warn,
395
+ 'no-undefined': off,
396
+ 'no-underscore-dangle': off,
397
+ 'no-unexpected-multiline': warn,
398
+ 'no-unmodified-loop-condition': warn,
399
+ 'no-unneeded-ternary': [warn, { defaultAssignment: false }],
400
+ 'no-unreachable': warn,
401
+ 'no-unsafe-finally': warn,
402
+ 'no-unsafe-negation': warn,
403
+ 'no-unused-expressions': [
404
+ warn,
405
+ {
406
+ allowShortCircuit: true,
407
+ allowTaggedTemplates: true,
408
+ allowTernary: true,
409
+ },
410
+ ],
411
+ 'no-unused-labels': warn,
412
+ 'no-unused-vars': [
413
+ warn,
414
+ {
415
+ args: 'none',
416
+ argsIgnorePattern: '^_.*$',
417
+ vars: 'all',
418
+ varsIgnorePattern: '^_.*$|^T$',
419
+ },
420
+ ],
421
+ 'no-use-before-define': [
422
+ error,
423
+ { classes: false, functions: false, variables: false },
424
+ ],
425
+ 'no-useless-call': warn,
426
+ 'no-useless-catch': warn,
427
+ 'no-useless-computed-key': warn,
428
+ 'no-useless-concat': warn,
429
+ 'no-useless-constructor': warn,
430
+ 'no-useless-escape': warn,
431
+ 'no-useless-rename': warn,
432
+ 'no-useless-return': warn,
433
+ 'no-var': warn,
434
+ 'no-void': warn,
435
+ 'no-warning-comments': off,
436
+ 'no-whitespace-before-property': warn,
437
+ 'no-with': warn,
438
+ 'nonblock-statement-body-position': warn,
439
+ 'object-curly-newline': [warn, { consistent: true, multiline: true }],
440
+ 'object-curly-spacing': [warn, 'always'],
441
+ 'object-property-newline': [
442
+ warn,
443
+ { allowMultiplePropertiesPerLine: true },
444
+ ],
445
+ 'object-shorthand': [warn, 'always'],
446
+ 'one-var': [warn, 'never'],
447
+ 'one-var-declaration-per-line': warn,
448
+ 'operator-assignment': [warn, 'always'],
449
+ 'operator-linebreak': [
450
+ warn,
451
+ 'after',
452
+ { overrides: { ':': 'before', '?': 'before', '??': 'before' } },
453
+ ],
454
+ 'padded-blocks': [
455
+ warn,
456
+ { blocks: 'never', classes: 'never', switches: 'never' },
457
+ ],
458
+ 'padding-line-between-statements': warn,
459
+ // You may want to use `fn(function () {})` for some advanced cases:
460
+ 'prefer-arrow-callback': off,
461
+ 'prefer-const': [warn, { destructuring: 'all' }],
462
+ 'prefer-destructuring': [off, { array: false, object: true }],
463
+ 'prefer-named-capture-group': off,
464
+ 'prefer-numeric-literals': warn,
465
+ 'prefer-object-spread': warn,
466
+ 'prefer-promise-reject-errors': warn,
467
+ 'prefer-regex-literals': warn,
468
+ 'prefer-rest-params': warn,
469
+ 'prefer-spread': warn,
470
+ 'prefer-template': off,
471
+ 'quote-props': [warn, 'as-needed'],
472
+ quotes: [
473
+ warn,
474
+ 'single',
475
+ { allowTemplateLiterals: false, avoidEscape: true },
476
+ ],
477
+ radix: warn,
478
+ // Disabled due to false (?) positives:
479
+ 'require-atomic-updates': off,
480
+ 'require-await': warn,
481
+ 'require-unicode-regexp': off,
482
+ 'require-yield': warn,
483
+ 'rest-spread-spacing': [warn, 'never'],
484
+ semi: [warn, 'always'],
485
+ 'semi-spacing': [warn, { after: true, before: false }],
486
+ 'semi-style': [warn, 'last'],
487
+ 'sonarjs/cognitive-complexity': off,
488
+ 'sonarjs/elseif-without-else': off,
489
+ 'sonarjs/max-switch-cases': off,
490
+ 'sonarjs/no-all-duplicated-branches': warn,
491
+ 'sonarjs/no-collapsible-if': warn,
492
+ 'sonarjs/no-collection-size-mischeck': warn,
493
+ 'sonarjs/no-duplicate-string': off,
494
+ 'sonarjs/no-duplicated-branches': off,
495
+ 'sonarjs/no-element-overwrite': warn,
496
+ 'sonarjs/no-empty-collection': warn,
497
+ 'sonarjs/no-extra-arguments': warn,
498
+ // Disabled due to slow performance:
499
+ 'sonarjs/no-gratuitous-expressions': off,
500
+ 'sonarjs/no-identical-conditions': warn,
501
+ 'sonarjs/no-identical-expressions': warn,
502
+ 'sonarjs/no-identical-functions': off,
503
+ 'sonarjs/no-ignored-return': warn,
504
+ 'sonarjs/no-inverted-boolean-check': off,
505
+ 'sonarjs/no-nested-switch': off,
506
+ 'sonarjs/no-nested-template-literals': off,
507
+ 'sonarjs/no-redundant-boolean': warn,
508
+ 'sonarjs/no-redundant-jump': warn,
509
+ 'sonarjs/no-same-line-conditional': warn,
510
+ 'sonarjs/no-small-switch': off,
511
+ 'sonarjs/no-unused-collection': warn,
512
+ 'sonarjs/no-use-of-empty-return-value': warn,
513
+ 'sonarjs/no-useless-catch': warn,
514
+ 'sonarjs/non-existent-operator': warn,
515
+ 'sonarjs/prefer-immediate-return': warn,
516
+ 'sonarjs/prefer-object-literal': warn,
517
+ 'sonarjs/prefer-single-boolean-return': warn,
518
+ 'sonarjs/prefer-while': warn,
519
+ 'sort-imports': [
520
+ off,
521
+ {
522
+ ignoreCase: false,
523
+ ignoreDeclarationSort: false,
524
+ ignoreMemberSort: false,
525
+ memberSyntaxSortOrder: ['none', 'all', 'single', 'multiple'],
526
+ },
438
527
  ],
439
- env: {
440
- jest: true,
441
- mocha: true,
528
+ 'sort-keys': off,
529
+ 'sort-keys/sort-keys-fix': [off, 'asc', { natural: false }],
530
+ 'sort-vars': warn,
531
+ 'space-before-blocks': [warn, 'always'],
532
+ 'space-before-function-paren': [warn, 'always'],
533
+ 'space-in-parens': [warn, 'never'],
534
+ 'space-infix-ops': warn,
535
+ 'space-unary-ops': [warn, { nonwords: false, words: true }],
536
+ 'spaced-comment': [
537
+ warn,
538
+ 'always',
539
+ {
540
+ block: { balanced: true, exceptions: ['*'] },
541
+ line: { markers: ['!', '?', '*', '/', '//'] },
542
+ },
543
+ ],
544
+ strict: [warn, 'never'],
545
+ 'switch-colon-spacing': [warn, { after: true, before: false }],
546
+ 'symbol-description': warn,
547
+ 'template-curly-spacing': [warn, 'never'],
548
+ 'template-tag-spacing': [warn, 'never'],
549
+ 'unicode-bom': [warn, 'never'],
550
+ 'unicorn/better-regex': warn,
551
+ 'unicorn/catch-error-name': warn,
552
+ 'unicorn/consistent-destructuring': warn,
553
+ 'unicorn/consistent-function-scoping': warn,
554
+ 'unicorn/custom-error-definition': off,
555
+ 'unicorn/empty-brace-spaces': off,
556
+ 'unicorn/error-message': warn,
557
+ 'unicorn/escape-case': warn,
558
+ 'unicorn/expiring-todo-comments': warn,
559
+ 'unicorn/explicit-length-check': warn,
560
+ 'unicorn/filename-case': [
561
+ warn,
562
+ { cases: { kebabCase: true, pascalCase: true } },
563
+ ],
564
+ 'unicorn/import-style': off,
565
+ 'unicorn/new-for-builtins': warn,
566
+ 'unicorn/no-abusive-eslint-disable': warn,
567
+ 'unicorn/no-array-callback-reference': warn,
568
+ 'unicorn/no-array-for-each': warn,
569
+ 'unicorn/no-array-method-this-argument': warn,
570
+ 'unicorn/no-array-push-push': off,
571
+ 'unicorn/no-array-reduce': warn,
572
+ 'unicorn/no-await-expression-member': warn,
573
+ 'unicorn/no-console-spaces': warn,
574
+ 'unicorn/no-document-cookie': off,
575
+ 'unicorn/no-empty-file': off,
576
+ 'unicorn/no-for-loop': warn,
577
+ 'unicorn/no-hex-escape': off,
578
+ 'unicorn/no-instanceof-array': warn,
579
+ 'unicorn/no-invalid-remove-event-listener': warn,
580
+ 'unicorn/no-keyword-prefix': off,
581
+ // Duplicated by `sonarjs/no-collapsible-if`, but with more annoying highlighting.
582
+ // It has auto-fix however, which is sometimes wanted and sometimes not:
583
+ 'unicorn/no-lonely-if': off,
584
+ 'unicorn/no-negated-condition': warn,
585
+ 'unicorn/no-nested-ternary': off,
586
+ 'unicorn/no-new-array': off,
587
+ 'unicorn/no-new-buffer': warn,
588
+ 'unicorn/no-null': off,
589
+ 'unicorn/no-object-as-default-parameter': off,
590
+ 'unicorn/no-process-exit': off,
591
+ 'unicorn/no-static-only-class': warn,
592
+ // Disabled due to slow performance:
593
+ 'unicorn/no-thenable': off,
594
+ 'unicorn/no-this-assignment': warn,
595
+ 'unicorn/no-typeof-undefined': [warn, { checkGlobalVariables: true }],
596
+ 'unicorn/no-unnecessary-await': warn,
597
+ 'unicorn/no-unreadable-array-destructuring': warn,
598
+ 'unicorn/no-unreadable-iife': warn,
599
+ 'unicorn/no-unused-properties': off,
600
+ 'unicorn/no-useless-fallback-in-spread': warn,
601
+ 'unicorn/no-useless-length-check': warn,
602
+ 'unicorn/no-useless-promise-resolve-reject': warn,
603
+ 'unicorn/no-useless-spread': warn,
604
+ 'unicorn/no-useless-switch-case': warn,
605
+ 'unicorn/no-useless-undefined': off,
606
+ 'unicorn/no-zero-fractions': warn,
607
+ 'unicorn/number-literal-case': off,
608
+ 'unicorn/numeric-separators-style': warn,
609
+ 'unicorn/prefer-add-event-listener': warn,
610
+ 'unicorn/prefer-array-find': warn,
611
+ 'unicorn/prefer-array-flat-map': warn,
612
+ // Disabled due to slow performance:
613
+ 'unicorn/prefer-array-flat': off,
614
+ 'unicorn/prefer-array-index-of': warn,
615
+ 'unicorn/prefer-array-some': warn,
616
+ 'unicorn/prefer-at': warn,
617
+ 'unicorn/prefer-blob-reading-methods': warn,
618
+ 'unicorn/prefer-code-point': off,
619
+ 'unicorn/prefer-date-now': warn,
620
+ 'unicorn/prefer-default-parameters': warn,
621
+ 'unicorn/prefer-dom-node-append': warn,
622
+ 'unicorn/prefer-dom-node-dataset': warn,
623
+ 'unicorn/prefer-dom-node-remove': warn,
624
+ 'unicorn/prefer-dom-node-text-content': warn,
625
+ 'unicorn/prefer-event-target': warn,
626
+ 'unicorn/prefer-export-from': warn,
627
+ 'unicorn/prefer-includes': warn,
628
+ 'unicorn/prefer-json-parse-buffer': off,
629
+ 'unicorn/prefer-keyboard-event-key': warn,
630
+ 'unicorn/prefer-logical-operator-over-ternary': warn,
631
+ 'unicorn/prefer-math-trunc': warn,
632
+ 'unicorn/prefer-modern-dom-apis': warn,
633
+ 'unicorn/prefer-modern-math-apis': warn,
634
+ 'unicorn/prefer-module': off,
635
+ 'unicorn/prefer-native-coercion-functions': warn,
636
+ 'unicorn/prefer-negative-index': warn,
637
+ 'unicorn/prefer-node-protocol': warn,
638
+ 'unicorn/prefer-number-properties': [
639
+ warn,
640
+ { checkInfinity: false, checkNaN: false },
641
+ ],
642
+ 'unicorn/prefer-object-from-entries': warn,
643
+ 'unicorn/prefer-optional-catch-binding': warn,
644
+ 'unicorn/prefer-prototype-methods': warn,
645
+ 'unicorn/prefer-query-selector': warn,
646
+ 'unicorn/prefer-reflect-apply': warn,
647
+ 'unicorn/prefer-regexp-test': warn,
648
+ 'unicorn/prefer-set-has': warn,
649
+ 'unicorn/prefer-set-size': warn,
650
+ // Disabled due to slow performance:
651
+ 'unicorn/prefer-spread': off,
652
+ 'unicorn/prefer-string-replace-all': warn,
653
+ 'unicorn/prefer-string-slice': warn,
654
+ 'unicorn/prefer-string-starts-ends-with': warn,
655
+ 'unicorn/prefer-string-trim-start-end': warn,
656
+ 'unicorn/prefer-switch': off,
657
+ 'unicorn/prefer-ternary': off,
658
+ // Not available in all Node.js versions or without specific settings:
659
+ 'unicorn/prefer-top-level-await': off,
660
+ 'unicorn/prefer-type-error': warn,
661
+ 'unicorn/prevent-abbreviations': off,
662
+ 'unicorn/relative-url-style': off,
663
+ 'unicorn/require-array-join-separator': warn,
664
+ 'unicorn/require-number-to-fixed-digits-argument': warn,
665
+ 'unicorn/require-post-message-target-origin': warn,
666
+ 'unicorn/string-content': off,
667
+ 'unicorn/switch-case-braces': off,
668
+ 'unicorn/template-indent': warn,
669
+ 'unicorn/text-encoding-identifier-case': warn,
670
+ 'unicorn/throw-new-error': warn,
671
+ 'use-isnan': warn,
672
+ 'valid-typeof': [off, { requireStringLiterals: true }],
673
+ 'vars-on-top': warn,
674
+ 'wrap-iife': [warn, 'any', { functionPrototypeMethods: true }],
675
+ 'wrap-regex': off,
676
+ 'yield-star-spacing': [warn, 'both'],
677
+ yoda: [warn, 'never'],
678
+ },
679
+ settings: {
680
+ 'import/extensions': ['.js', '.ts'],
681
+ 'import/internal-regex': '^@',
682
+ jsdoc: {
683
+ mode: 'closure',
442
684
  },
443
- rules: {
444
- '@typescript-eslint/no-magic-numbers': off,
445
- 'jsdoc/require-jsdoc': off,
446
- 'no-empty-character-class': off,
447
- 'no-magic-numbers': off,
448
- 'no-sparse-arrays': off,
449
- 'sonarjs/no-duplicate-string': off,
450
- 'sort-keys': off,
451
- 'symbol-description': off,
452
- 'unicorn/better-regex': off,
453
- 'unicorn/consistent-function-scoping': off,
454
- 'unicorn/new-for-builtins': off,
455
- 'unicorn/no-new-array': off,
685
+ react: {
686
+ version: 'detect',
456
687
  },
457
688
  },
458
- {
459
- files: ['**/*.jsx', '**/*.tsx'],
460
- plugins: ['react', 'react-hooks', 'react-refresh', 'jsx-a11y'],
461
- rules: {
462
- 'jsx-a11y/accessible-emoji': warn,
463
- 'jsx-a11y/alt-text': warn,
464
- 'jsx-a11y/anchor-has-content': warn,
465
- 'jsx-a11y/anchor-is-valid': warn,
466
- 'jsx-a11y/aria-activedescendant-has-tabindex': warn,
467
- 'jsx-a11y/aria-props': warn,
468
- 'jsx-a11y/aria-proptypes': warn,
469
- 'jsx-a11y/aria-role': warn,
470
- 'jsx-a11y/aria-unsupported-elements': warn,
471
- 'jsx-a11y/autocomplete-valid': warn,
472
- 'jsx-a11y/click-events-have-key-events': warn,
473
- 'jsx-a11y/control-has-associated-label': [
474
- warn,
475
- {
476
- ignoreElements: [
477
- 'audio',
478
- 'canvas',
479
- 'embed',
480
- 'input',
481
- 'textarea',
482
- 'tr',
483
- 'video',
484
- ],
485
- ignoreRoles: [
486
- 'grid',
487
- 'listbox',
488
- 'menu',
489
- 'menubar',
490
- 'radiogroup',
491
- 'row',
492
- 'tablist',
493
- 'toolbar',
494
- 'tree',
495
- 'treegrid',
496
- ],
497
- includeRoles: ['alert', 'dialog'],
498
- },
499
- ],
500
- 'jsx-a11y/heading-has-content': warn,
501
- 'jsx-a11y/html-has-lang': warn,
502
- 'jsx-a11y/iframe-has-title': warn,
503
- 'jsx-a11y/img-redundant-alt': warn,
504
- 'jsx-a11y/interactive-supports-focus': [
505
- warn,
506
- {
507
- tabbable: [
508
- 'button',
509
- 'checkbox',
510
- 'link',
511
- 'progressbar',
512
- 'searchbox',
513
- 'slider',
514
- 'spinbutton',
515
- 'switch',
516
- 'textbox',
517
- ],
518
- },
519
- ],
520
- 'jsx-a11y/label-has-associated-control': warn,
521
- 'jsx-a11y/label-has-for': off,
522
- 'jsx-a11y/media-has-caption': warn,
523
- 'jsx-a11y/mouse-events-have-key-events': warn,
524
- 'jsx-a11y/no-access-key': warn,
525
- 'jsx-a11y/no-autofocus': warn,
526
- 'jsx-a11y/no-distracting-elements': warn,
527
- 'jsx-a11y/no-interactive-element-to-noninteractive-role': warn,
528
- 'jsx-a11y/no-noninteractive-element-interactions': [
529
- warn,
530
- {
531
- body: ['onError', 'onLoad'],
532
- iframe: ['onError', 'onLoad'],
533
- img: ['onError', 'onLoad'],
534
- },
535
- ],
536
- 'jsx-a11y/no-noninteractive-element-to-interactive-role': warn,
537
- 'jsx-a11y/no-noninteractive-tabindex': warn,
538
- 'jsx-a11y/no-redundant-roles': warn,
539
- 'jsx-a11y/no-static-element-interactions': warn,
540
- 'jsx-a11y/role-has-required-aria-props': warn,
541
- 'jsx-a11y/role-supports-aria-props': warn,
542
- 'jsx-a11y/scope': warn,
543
- 'jsx-a11y/tabindex-no-positive': warn,
544
- 'react/boolean-prop-naming': warn,
545
- 'react/button-has-type': warn,
546
- 'react/default-props-match-prop-types': warn,
547
- 'react/destructuring-assignment': off,
548
- 'react/display-name': warn,
549
- 'react/forbid-component-props': off,
550
- 'react/forbid-dom-props': warn,
551
- 'react/forbid-elements': warn,
552
- 'react/forbid-foreign-prop-types': warn,
553
- 'react/forbid-prop-types': warn,
554
- 'react/function-component-definition': [
555
- warn,
556
- {
557
- namedComponents: 'arrow-function',
558
- unnamedComponents: 'arrow-function',
559
- },
560
- ],
561
- 'react/jsx-boolean-value': warn,
562
- 'react/jsx-child-element-spacing': warn,
563
- 'react/jsx-closing-bracket-location': warn,
564
- 'react/jsx-closing-tag-location': warn,
565
- 'react/jsx-curly-brace-presence': [
566
- warn,
567
- { children: 'always', props: 'never' },
568
- ],
569
- 'react/jsx-curly-newline': off,
570
- 'react/jsx-curly-spacing': warn,
571
- 'react/jsx-equals-spacing': warn,
572
- 'react/jsx-filename-extension': [
573
- warn,
574
- { extensions: ['.jsx', '.tsx'] },
575
- ],
576
- 'react/jsx-first-prop-new-line': warn,
577
- 'react/jsx-fragments': warn,
578
- 'react/jsx-handler-names': warn,
579
- 'react/jsx-indent': [warn, 2, { indentLogicalExpressions: true }],
580
- 'react/jsx-indent-props': [warn, 2],
581
- 'react/jsx-key': warn,
582
- 'react/jsx-max-depth': off,
583
- 'react/jsx-max-props-per-line': [
584
- warn,
585
- { maximum: 1, when: 'multiline' },
586
- ],
587
- 'react/jsx-newline': off,
588
- 'react/jsx-no-bind': [
589
- warn,
590
- {
591
- allowArrowFunctions: true,
592
- allowBind: true,
593
- allowFunctions: false,
594
- ignoreDOMComponents: false,
595
- ignoreRefs: false,
596
- },
597
- ],
598
- 'react/jsx-no-comment-textnodes': warn,
599
- 'react/jsx-no-constructed-context-values': warn,
600
- 'react/jsx-no-duplicate-props': warn,
601
- 'react/jsx-no-literals': warn,
602
- 'react/jsx-no-script-url': warn,
603
- 'react/jsx-no-target-blank': warn,
604
- 'react/jsx-no-undef': warn,
605
- 'react/jsx-no-useless-fragment': off,
606
- 'react/jsx-one-expression-per-line': warn,
607
- 'react/jsx-pascal-case': warn,
608
- 'react/jsx-props-no-multi-spaces': warn,
609
- 'react/jsx-props-no-spreading': off,
610
- 'react/jsx-sort-props': warn,
611
- /** @deprecated */
612
- 'react/jsx-space-before-closing': off,
613
- 'react/jsx-tag-spacing': [
614
- warn,
615
- {
616
- afterOpening: 'never',
617
- beforeClosing: 'allow',
618
- beforeSelfClosing: 'always',
619
- closingSlash: 'never',
620
- },
621
- ],
622
- 'react/jsx-uses-react': warn,
623
- 'react/jsx-uses-vars': warn,
624
- 'react/jsx-wrap-multilines': [
625
- warn,
626
- {
627
- arrow: 'ignore',
628
- assignment: 'ignore',
629
- condition: 'ignore',
630
- declaration: 'ignore',
631
- logical: 'ignore',
632
- prop: 'ignore',
633
- return: 'parens',
634
- },
635
- ],
636
- 'react/no-access-state-in-setstate': warn,
637
- 'react/no-adjacent-inline-elements': off,
638
- 'react/no-array-index-key': warn,
639
- 'react/no-children-prop': warn,
640
- 'react/no-danger': warn,
641
- 'react/no-danger-with-children': warn,
642
- 'react/no-deprecated': warn,
643
- 'react/no-did-mount-set-state': warn,
644
- 'react/no-did-update-set-state': warn,
645
- 'react/no-direct-mutation-state': warn,
646
- 'react/no-find-dom-node': warn,
647
- 'react/no-is-mounted': warn,
648
- 'react/no-multi-comp': off,
649
- 'react/no-redundant-should-component-update': warn,
650
- 'react/no-render-return-value': warn,
651
- 'react/no-set-state': off,
652
- 'react/no-string-refs': warn,
653
- 'react/no-this-in-sfc': warn,
654
- 'react/no-typos': warn,
655
- 'react/no-unescaped-entities': warn,
656
- 'react/no-unknown-property': warn,
657
- 'react/no-unsafe': warn,
658
- 'react/no-unused-prop-types': warn,
659
- 'react/no-unused-state': warn,
660
- 'react/no-will-update-set-state': warn,
661
- 'react/prefer-es6-class': warn,
662
- // Props are seldom mutated anyway:
663
- 'react/prefer-read-only-props': off,
664
- 'react/prefer-stateless-function': warn,
665
- 'react/prop-types': off,
666
- 'react/react-in-jsx-scope': off,
667
- 'react/require-default-props': off,
668
- 'react/require-optimization': off,
669
- 'react/require-render-return': warn,
670
- 'react/self-closing-comp': warn,
671
- 'react/sort-comp': [
672
- warn,
673
- {
674
- groups: {
675
- lifecycle: [
676
- 'displayName',
677
- 'propTypes',
678
- 'contextTypes',
679
- 'childContextTypes',
680
- 'mixins',
681
- 'statics',
682
- 'defaultProps',
683
- 'constructor',
684
- 'getDefaultProps',
685
- 'state',
686
- 'getInitialState',
687
- 'getChildContext',
688
- 'getDerivedStateFromProps',
689
- 'componentWillMount',
690
- 'UNSAFE_componentWillMount',
691
- 'componentDidMount',
692
- 'componentWillReceiveProps',
693
- 'UNSAFE_componentWillReceiveProps',
694
- 'shouldComponentUpdate',
695
- 'componentWillUpdate',
696
- 'UNSAFE_componentWillUpdate',
697
- 'getSnapshotBeforeUpdate',
698
- 'componentDidUpdate',
699
- 'componentDidCatch',
700
- 'componentWillUnmount',
701
- ],
702
- },
703
- order: [
704
- 'static-variables',
705
- 'static-methods',
706
- 'everything-else',
707
- 'instance-variables',
708
- 'instance-methods',
709
- 'lifecycle',
710
- 'render',
711
- ],
712
- },
713
- ],
714
- 'react/sort-default-props': warn,
715
- 'react/sort-prop-types': warn,
716
- 'react/state-in-constructor': off,
717
- 'react/static-property-placement': warn,
718
- 'react/style-prop-object': warn,
719
- 'react/void-dom-elements-no-children': warn,
720
- 'react-hooks/exhaustive-deps': warn,
721
- 'react-hooks/rules-of-hooks': error,
722
- 'react-refresh/only-export-components': [
723
- warn,
724
- { allowConstantExport: true },
725
- ],
689
+ },
690
+ {
691
+ files: ['**/*.ts', '**/*.tsx', '**/*.d.ts'],
692
+ languageOptions: {
693
+ globals: {
694
+ NodeJS: 'writable',
726
695
  },
727
- },
728
- {
729
- files: ['**/*.d.ts'],
730
- rules: {
731
- '@typescript-eslint/consistent-type-definitions': off,
732
- '@typescript-eslint/no-extraneous-class': off,
733
- '@typescript-eslint/no-use-before-define': off,
734
- 'import/no-default-export': off,
735
- 'jsdoc/require-jsdoc': off,
736
- 'max-classes-per-file': off,
696
+ parser: typescriptEslintParser,
697
+ parserOptions: {
698
+ project: './tsconfig.json',
737
699
  },
738
700
  },
739
- {
740
- files: ['**/*.config.js', '**/*.config.ts'],
741
- rules: {
742
- '@typescript-eslint/no-magic-numbers': off,
743
- 'no-magic-numbers': off,
744
- },
701
+ plugins: {
702
+ '@typescript-eslint': /** @type {any} */ (typescriptEslintPlugin),
745
703
  },
746
- {
747
- files: ['**/*.js'],
748
- rules: {
749
- 'jsdoc/check-access': warn,
750
- 'jsdoc/check-alignment': warn,
751
- 'jsdoc/check-examples': off,
752
- 'jsdoc/check-indentation': [off, { excludeTags: ['example'] }],
753
- 'jsdoc/check-line-alignment': warn,
754
- 'jsdoc/check-param-names': warn,
755
- 'jsdoc/check-property-names': warn,
756
- 'jsdoc/check-syntax': warn,
757
- 'jsdoc/check-tag-names': warn,
758
- 'jsdoc/check-types': [warn, { noDefaults: true }],
759
- 'jsdoc/check-values': warn,
760
- 'jsdoc/empty-tags': warn,
761
- 'jsdoc/implements-on-classes': warn,
762
- 'jsdoc/match-description': warn,
763
- 'jsdoc/no-bad-blocks': warn,
764
- 'jsdoc/no-defaults': warn,
765
- 'jsdoc/no-types': off,
766
- // Disabled due to false positives when referring to a generic type from inside its function:
767
- 'jsdoc/no-undefined-types': [
768
- off,
769
- {
770
- definedTypes: [
771
- 'unknown',
772
- /**
773
- * @see typescript\lib\lib.es5.d.ts
774
- * @version 4.1.2
775
- */
776
- 'PropertyKey',
777
- 'PropertyDescriptor',
778
- 'PropertyDescriptorMap',
779
- 'ObjectConstructor',
780
- 'FunctionConstructor',
781
- 'ThisParameterType',
782
- 'OmitThisParameter',
783
- 'CallableFunction',
784
- 'NewableFunction',
785
- 'IArguments',
786
- 'StringConstructor',
787
- 'BooleanConstructor',
788
- 'NumberConstructor',
789
- 'TemplateStringsArray',
790
- 'ImportMeta',
791
- 'DateConstructor',
792
- 'RegExpMatchArray',
793
- 'RegExpExecArray',
794
- 'RegExpConstructor',
795
- 'ErrorConstructor',
796
- 'EvalErrorConstructor',
797
- 'RangeErrorConstructor',
798
- 'ReferenceErrorConstructor',
799
- 'SyntaxErrorConstructor',
800
- 'TypeErrorConstructor',
801
- 'URIErrorConstructor',
802
- 'ReadonlyArray',
803
- 'ConcatArray',
804
- 'ArrayConstructor',
805
- 'TypedPropertyDescriptor',
806
- 'ClassDecorator',
807
- 'PropertyDecorator',
808
- 'MethodDecorator',
809
- 'ParameterDecorator',
810
- 'PromiseConstructorLike',
811
- 'PromiseLike',
812
- 'ArrayLike',
813
- 'Partial',
814
- 'Required',
815
- 'Readonly',
816
- 'Pick',
817
- 'Exclude',
818
- 'Extract',
819
- 'Omit',
820
- 'NonNullable',
821
- 'Parameters',
822
- 'ConstructorParameters',
823
- 'ReturnType',
824
- 'InstanceType',
825
- 'ThisType',
826
- 'ArrayBufferTypes',
827
- 'ArrayBufferLike',
828
- 'ArrayBufferConstructor',
829
- 'ArrayBufferView',
830
- 'DataViewConstructor',
831
- 'Int8ArrayConstructor',
832
- 'Uint8ArrayConstructor',
833
- 'Uint8ClampedArrayConstructor',
834
- 'Int16ArrayConstructor',
835
- 'Uint16ArrayConstructor',
836
- 'Int32ArrayConstructor',
837
- 'Uint32ArrayConstructor',
838
- 'Float32ArrayConstructor',
839
- 'Float64ArrayConstructor',
840
- ],
704
+ rules: {
705
+ '@typescript-eslint/adjacent-overload-signatures': warn,
706
+ '@typescript-eslint/array-type': [warn, { default: 'array' }],
707
+ // Disabled due to slow performance:
708
+ '@typescript-eslint/await-thenable': off,
709
+ '@typescript-eslint/ban-ts-comment': warn,
710
+ '@typescript-eslint/ban-tslint-comment': warn,
711
+ '@typescript-eslint/ban-types': [
712
+ off,
713
+ {
714
+ extendDefaults: true,
715
+ types: {
716
+ Boolean: false,
717
+ Function: false,
718
+ Number: false,
719
+ Object: false,
720
+ '{}': false,
841
721
  },
842
- ],
843
- 'jsdoc/require-description': [
844
- off,
845
- { contexts: ['any'], descriptionStyle: 'body' },
846
- ],
847
- 'jsdoc/require-description-complete-sentence': off,
848
- 'jsdoc/require-example': off,
849
- 'jsdoc/require-file-overview': off,
850
- 'jsdoc/require-hyphen-before-param-description': [warn, 'never'],
851
- 'jsdoc/require-jsdoc': [
852
- off,
853
- {
854
- exemptEmptyFunctions: true,
855
- publicOnly: false,
856
- require: {
857
- ArrowFunctionExpression: true,
858
- ClassDeclaration: false,
859
- ClassExpression: false,
860
- FunctionDeclaration: true,
861
- FunctionExpression: true,
862
- MethodDefinition: true,
863
- },
864
- },
865
- ],
866
- 'jsdoc/require-param': [
867
- warn,
868
- {
869
- checkConstructors: true,
870
- checkDestructured: true,
871
- checkDestructuredRoots: true,
872
- checkGetters: true,
873
- checkSetters: true,
874
- },
875
- ],
876
- 'jsdoc/require-param-description': off,
877
- 'jsdoc/require-param-name': warn,
878
- 'jsdoc/require-param-type': [warn, { contexts: ['any'] }],
879
- 'jsdoc/require-property': warn,
880
- 'jsdoc/require-property-description': off,
881
- 'jsdoc/require-property-name': warn,
882
- 'jsdoc/require-property-type': warn,
883
- 'jsdoc/require-returns': off,
884
- 'jsdoc/require-returns-check': warn,
885
- 'jsdoc/require-returns-description': off,
886
- 'jsdoc/require-returns-type': warn,
887
- 'jsdoc/valid-types': off,
888
- },
722
+ },
723
+ ],
724
+ // Definition not found (2026-09-03):
725
+ // '@typescript-eslint/brace-style': warn,
726
+ '@typescript-eslint/camelcase': off,
727
+ '@typescript-eslint/class-literal-property-style': [warn, 'fields'],
728
+ // Definition not found (2026-09-03):
729
+ // '@typescript-eslint/comma-dangle': [warn, 'always-multiline'],
730
+ // Definition not found (2026-09-03):
731
+ // '@typescript-eslint/comma-spacing': [warn, { after: true, before: false }],
732
+ '@typescript-eslint/consistent-type-assertions': [
733
+ off,
734
+ {
735
+ assertionStyle: 'as',
736
+ objectLiteralTypeAssertions: 'never',
737
+ },
738
+ ],
739
+ '@typescript-eslint/consistent-type-definitions': [warn, 'type'],
740
+ '@typescript-eslint/consistent-type-imports': [
741
+ warn,
742
+ {
743
+ disallowTypeAnnotations: true,
744
+ fixStyle: 'separate-type-imports',
745
+ prefer: 'type-imports',
746
+ },
747
+ ],
748
+ '@typescript-eslint/default-param-last': warn,
749
+ '@typescript-eslint/dot-notation': warn,
750
+ '@typescript-eslint/explicit-function-return-type': [
751
+ off,
752
+ { allowTypedFunctionExpressions: true },
753
+ ],
754
+ '@typescript-eslint/explicit-member-accessibility': [
755
+ warn,
756
+ { accessibility: 'no-public' },
757
+ ],
758
+ '@typescript-eslint/explicit-module-boundary-types': off,
759
+ // Definition not found (2026-09-03):
760
+ // '@typescript-eslint/func-call-spacing': warn,
761
+ // Definition not found (2026-09-03):
762
+ // '@typescript-eslint/indent': [
763
+ // warn,
764
+ // 2,
765
+ // {
766
+ // SwitchCase: 1,
767
+ // // Ignored nodes due to false positives:
768
+ // ignoredNodes: [
769
+ // 'TSIntersectionType',
770
+ // 'TSTypeParameterInstantiation',
771
+ // 'TSUnionType',
772
+ // ],
773
+ // },
774
+ // ],
775
+ // Definition not found (2020-10-26):
776
+ // '@typescript-eslint/index': warn,
777
+ '@typescript-eslint/init-declarations': off,
778
+ // Definition not found (2026-09-03):
779
+ // '@typescript-eslint/keyword-spacing': warn,
780
+ '@typescript-eslint/lines-between-class-members': [
781
+ off,
782
+ 'always',
783
+ { exceptAfterOverload: true, exceptAfterSingleLine: true },
784
+ ],
785
+ // Definition not found (2026-09-03):
786
+ // '@typescript-eslint/member-delimiter-style': [
787
+ // warn,
788
+ // {
789
+ // multiline: { delimiter: 'semi', requireLast: true },
790
+ // singleline: { delimiter: 'semi', requireLast: true },
791
+ // },
792
+ // ],
793
+ // Disabled to due buggy ordering:
794
+ '@typescript-eslint/member-ordering': [
795
+ off,
796
+ {
797
+ default: [
798
+ 'signature',
799
+ 'private-static-field',
800
+ 'protected-static-field',
801
+ 'public-static-field',
802
+ 'private-static-method',
803
+ 'protected-static-method',
804
+ 'public-static-method',
805
+ 'private-decorated-field',
806
+ 'protected-decorated-field',
807
+ 'public-decorated-field',
808
+ 'private-instance-field',
809
+ 'protected-instance-field',
810
+ 'public-instance-field',
811
+ 'protected-abstract-field',
812
+ 'public-abstract-field',
813
+ 'static-field',
814
+ 'private-field',
815
+ 'protected-field',
816
+ 'public-field',
817
+ 'instance-field',
818
+ 'abstract-field',
819
+ 'decorated-field',
820
+ 'field',
821
+ 'private-constructor',
822
+ 'protected-constructor',
823
+ 'public-constructor',
824
+ 'constructor',
825
+ 'private-decorated-method',
826
+ 'protected-decorated-method',
827
+ 'public-decorated-method',
828
+ 'private-instance-method',
829
+ 'protected-instance-method',
830
+ 'public-instance-method',
831
+ 'protected-abstract-method',
832
+ 'public-abstract-method',
833
+ 'static-method',
834
+ 'private-method',
835
+ 'protected-method',
836
+ 'public-method',
837
+ 'instance-method',
838
+ 'abstract-method',
839
+ 'decorated-method',
840
+ 'method',
841
+ ],
842
+ },
843
+ ],
844
+ '@typescript-eslint/method-signature-style': [warn, 'property'],
845
+ '@typescript-eslint/naming-convention': [
846
+ off,
847
+ {
848
+ format: ['camelCase'],
849
+ leadingUnderscore: 'allow',
850
+ selector: 'default',
851
+ },
852
+ {
853
+ format: ['camelCase', 'snake_case', 'PascalCase', 'UPPER_CASE'],
854
+ leadingUnderscore: 'allow',
855
+ selector: ['objectLiteralProperty'],
856
+ },
857
+ {
858
+ format: ['camelCase', 'PascalCase'],
859
+ leadingUnderscore: 'allow',
860
+ selector: ['function'],
861
+ },
862
+ {
863
+ format: ['camelCase', 'UPPER_CASE'],
864
+ leadingUnderscore: 'allow',
865
+ selector: ['objectLiteralMethod', 'typeMethod', 'variable'],
866
+ },
867
+ {
868
+ format: ['PascalCase'],
869
+ leadingUnderscore: 'allow',
870
+ selector: [
871
+ 'class',
872
+ 'enum',
873
+ 'interface',
874
+ 'typeAlias',
875
+ 'typeParameter',
876
+ ],
877
+ },
878
+ {
879
+ format: ['UPPER_CASE'],
880
+ leadingUnderscore: 'allow',
881
+ selector: ['enumMember'],
882
+ },
883
+ {
884
+ format: null,
885
+ leadingUnderscore: 'allow',
886
+ selector: ['parameter', 'property'],
887
+ },
888
+ ],
889
+ '@typescript-eslint/no-array-constructor': warn,
890
+ '@typescript-eslint/no-base-to-string': warn,
891
+ '@typescript-eslint/no-confusing-non-null-assertion': off,
892
+ '@typescript-eslint/no-dupe-class-members': warn,
893
+ '@typescript-eslint/no-dynamic-delete': off,
894
+ '@typescript-eslint/no-empty-function': off,
895
+ '@typescript-eslint/no-empty-interface': warn,
896
+ // Often warns about necessary uses:
897
+ '@typescript-eslint/no-explicit-any': off,
898
+ '@typescript-eslint/no-extra-non-null-assertion': warn,
899
+ // Definition not found (2026-09-03):
900
+ // '@typescript-eslint/no-extra-parens': [
901
+ // warn,
902
+ // 'all',
903
+ // { ignoreJSX: 'all', nestedBinaryExpressions: false },
904
+ // ],
905
+ // Definition not found (2026-09-03):
906
+ // '@typescript-eslint/no-extra-semi': warn,
907
+ '@typescript-eslint/no-extraneous-class': off,
908
+ // Disabled due to slow performance:
909
+ '@typescript-eslint/no-floating-promises': [
910
+ off,
911
+ { ignoreIIFE: true, ignoreVoid: true },
912
+ ],
913
+ '@typescript-eslint/no-for-in-array': warn,
914
+ '@typescript-eslint/no-implicit-any-catch': off,
915
+ '@typescript-eslint/no-implied-eval': warn,
916
+ '@typescript-eslint/no-inferrable-types': warn,
917
+ '@typescript-eslint/no-invalid-this': off,
918
+ '@typescript-eslint/no-invalid-void-type': off,
919
+ '@typescript-eslint/no-loop-func': warn,
920
+ '@typescript-eslint/no-loss-of-precision': warn,
921
+ '@typescript-eslint/no-magic-numbers': [
922
+ off,
923
+ {
924
+ ignore: [-1, 0, 1, 2, 3, '-1n', '0n', '1n', '2n', '3n'],
925
+ ignoreEnums: true,
926
+ ignoreNumericLiteralTypes: true,
927
+ ignoreReadonlyClassProperties: true,
928
+ },
929
+ ],
930
+ '@typescript-eslint/no-misused-new': warn,
931
+ '@typescript-eslint/no-misused-promises': off,
932
+ '@typescript-eslint/no-namespace': [off, { allowDeclarations: true }],
933
+ '@typescript-eslint/no-non-null-asserted-optional-chain': warn,
934
+ '@typescript-eslint/no-non-null-assertion': off,
935
+ '@typescript-eslint/no-parameter-properties': off,
936
+ '@typescript-eslint/no-redeclare': off,
937
+ '@typescript-eslint/no-require-imports': off,
938
+ '@typescript-eslint/no-shadow': warn,
939
+ '@typescript-eslint/no-this-alias': warn,
940
+ '@typescript-eslint/no-type-alias': off,
941
+ '@typescript-eslint/no-unnecessary-boolean-literal-compare': warn,
942
+ '@typescript-eslint/no-unnecessary-condition': off,
943
+ // Disabled due to slow performance:
944
+ '@typescript-eslint/no-unnecessary-qualifier': off,
945
+ '@typescript-eslint/no-unnecessary-type-arguments': off,
946
+ '@typescript-eslint/no-unnecessary-type-assertion': warn,
947
+ '@typescript-eslint/no-unsafe-assignment': off,
948
+ '@typescript-eslint/no-unsafe-call': off,
949
+ '@typescript-eslint/no-unsafe-member-access': off,
950
+ '@typescript-eslint/no-unsafe-return': off,
951
+ '@typescript-eslint/no-unused-expressions': [
952
+ warn,
953
+ {
954
+ allowShortCircuit: true,
955
+ allowTaggedTemplates: true,
956
+ allowTernary: true,
957
+ },
958
+ ],
959
+ '@typescript-eslint/no-unused-vars': [
960
+ warn,
961
+ {
962
+ args: 'none',
963
+ argsIgnorePattern: '^_.*$',
964
+ vars: 'all',
965
+ varsIgnorePattern: '^_.*$|^T$',
966
+ },
967
+ ],
968
+ '@typescript-eslint/no-use-before-define': [
969
+ error,
970
+ { classes: false, functions: false, variables: false },
971
+ ],
972
+ '@typescript-eslint/no-useless-constructor': warn,
973
+ '@typescript-eslint/no-var-requires': off,
974
+ '@typescript-eslint/only-throw-error': warn,
975
+ '@typescript-eslint/prefer-as-const': warn,
976
+ '@typescript-eslint/prefer-enum-initializers': off,
977
+ '@typescript-eslint/prefer-for-of': warn,
978
+ '@typescript-eslint/prefer-function-type': warn,
979
+ '@typescript-eslint/prefer-includes': warn,
980
+ '@typescript-eslint/prefer-literal-enum-member': warn,
981
+ '@typescript-eslint/prefer-namespace-keyword': warn,
982
+ // Warns about correct uses of `||`:
983
+ '@typescript-eslint/prefer-nullish-coalescing': off,
984
+ '@typescript-eslint/prefer-optional-chain': warn,
985
+ '@typescript-eslint/prefer-readonly': warn,
986
+ // Disabled due to error:
987
+ // "Error: Non-null Assertion Failed: Expected to find a property "XXX" for the type."
988
+ '@typescript-eslint/prefer-readonly-parameter-types': off,
989
+ '@typescript-eslint/prefer-reduce-type-parameter': warn,
990
+ '@typescript-eslint/prefer-regexp-exec': off,
991
+ '@typescript-eslint/prefer-string-starts-ends-with': off,
992
+ '@typescript-eslint/prefer-ts-expect-error': warn,
993
+ '@typescript-eslint/promise-function-async': off,
994
+ // Definition not found (2026-09-03):
995
+ // '@typescript-eslint/quotes': [warn, 'single'],
996
+ '@typescript-eslint/require-array-sort-compare': [
997
+ warn,
998
+ { ignoreStringArrays: true },
999
+ ],
1000
+ '@typescript-eslint/require-await': warn,
1001
+ '@typescript-eslint/restrict-plus-operands': [error, { allowAny: false }],
1002
+ // Disabled due to false positives:
1003
+ '@typescript-eslint/restrict-template-expressions': off,
1004
+ '@typescript-eslint/return-await': [warn, 'always'],
1005
+ // Definition not found (2026-09-03):
1006
+ // '@typescript-eslint/semi': [warn, 'always'],
1007
+ // Definition not found (2026-09-03):
1008
+ // '@typescript-eslint/space-before-function-paren': [warn, 'always'],
1009
+ '@typescript-eslint/strict-boolean-expressions': off,
1010
+ '@typescript-eslint/switch-exhaustiveness-check': [
1011
+ warn,
1012
+ {
1013
+ allowDefaultCaseForExhaustiveSwitch: true,
1014
+ considerDefaultExhaustiveForUnions: true,
1015
+ requireDefaultForNonUnion: true,
1016
+ },
1017
+ ],
1018
+ '@typescript-eslint/triple-slash-reference': warn,
1019
+ // Definition not found (2026-09-03):
1020
+ // '@typescript-eslint/type-annotation-spacing': warn,
1021
+ '@typescript-eslint/typedef': off,
1022
+ '@typescript-eslint/unbound-method': off,
1023
+ '@typescript-eslint/unified-signatures': warn,
1024
+ 'default-case': off,
1025
+ 'default-param-last': off,
1026
+ 'dot-notation': off,
1027
+ 'func-call-spacing': off,
1028
+ 'import/exports-last': off,
1029
+ 'import/no-unassigned-import': off,
1030
+ // Disabled due to false positives:
1031
+ 'import/no-unresolved': [off, { ignore: ['\\.types$'] }],
1032
+ indent: off,
1033
+ 'init-declarations': off,
1034
+ 'jsdoc/check-examples': off,
1035
+ 'jsdoc/require-description': off,
1036
+ 'jsdoc/require-description-complete-sentence': off,
1037
+ 'jsdoc/require-example': off,
1038
+ 'jsdoc/require-file-overview': off,
1039
+ 'jsdoc/require-hyphen-before-param-description': off,
1040
+ 'jsdoc/require-jsdoc': off,
1041
+ 'jsdoc/require-param': off,
1042
+ 'jsdoc/require-param-description': off,
1043
+ 'jsdoc/require-param-name': off,
1044
+ 'jsdoc/require-param-type': off,
1045
+ 'jsdoc/require-property': off,
1046
+ 'jsdoc/require-property-description': off,
1047
+ 'jsdoc/require-property-name': off,
1048
+ 'jsdoc/require-property-type': off,
1049
+ 'jsdoc/require-returns': off,
1050
+ 'jsdoc/require-returns-check': off,
1051
+ 'jsdoc/require-returns-description': off,
1052
+ 'jsdoc/require-returns-type': off,
1053
+ 'keyword-spacing': off,
1054
+ 'lines-between-class-members': off,
1055
+ 'no-dupe-class-members': off,
1056
+ 'no-duplicate-imports': off,
1057
+ 'no-empty-function': off,
1058
+ 'no-extra-parens': off,
1059
+ 'no-extra-semi': off,
1060
+ 'no-invalid-this': off,
1061
+ 'no-loop-func': off,
1062
+ 'no-loss-of-precision': off,
1063
+ // Handled by `@typescript-eslint/no-implied-eval`:
1064
+ 'no-new-func': off,
1065
+ 'no-redeclare': off,
1066
+ 'no-return-await': off,
1067
+ 'no-shadow': off,
1068
+ /**
1069
+ * @see https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/FAQ.md#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
1070
+ */
1071
+ 'no-undef': off,
1072
+ 'no-unused-expressions': off,
1073
+ 'no-unused-vars': off,
1074
+ 'no-use-before-define': off,
1075
+ 'no-useless-constructor': off,
1076
+ 'no-void': off,
1077
+ quotes: off,
1078
+ 'require-await': off,
1079
+ semi: off,
1080
+ 'space-before-function-paren': off,
889
1081
  },
890
- ],
891
- parser: '@babel/eslint-parser',
892
- parserOptions: {
893
- allowAwaitOutsideFunction: true,
894
- ecmaFeatures: {
895
- jsx: true,
1082
+ },
1083
+ // Based on `storybook/recommended`:
1084
+ {
1085
+ files: [
1086
+ '**/*.stories.@(ts|tsx|js|jsx|mjs|cjs)',
1087
+ '**/*.stories.fixtures.@(ts|tsx|js|jsx|mjs|cjs)',
1088
+ '**/*.story.@(ts|tsx|js|jsx|mjs|cjs)',
1089
+ ],
1090
+ rules: {
1091
+ 'import/no-anonymous-default-export': off,
1092
+ 'react/no-multi-comp': off,
1093
+ 'react-hooks/rules-of-hooks': off,
1094
+ 'storybook/await-interactions': error,
1095
+ 'storybook/context-in-play-function': error,
1096
+ 'storybook/default-exports': error,
1097
+ 'storybook/hierarchy-separator': warn,
1098
+ 'storybook/no-redundant-story-name': warn,
1099
+ 'storybook/prefer-pascal-case': warn,
1100
+ 'storybook/story-exports': error,
1101
+ 'storybook/use-storybook-expect': error,
1102
+ 'storybook/use-storybook-testing-library': error,
1103
+ },
1104
+ },
1105
+ // Based on `storybook/recommended`:
1106
+ {
1107
+ files: ['**/.storybook/main.@(js|cjs|mjs|ts)'],
1108
+ rules: {
1109
+ 'storybook/no-uninstalled-addons': error,
896
1110
  },
897
- ecmaVersion: 'latest',
898
- requireConfigFile: false,
899
- sourceType: 'module',
900
1111
  },
901
- plugins: [
902
- 'import',
903
- 'jsdoc',
904
- 'sort-exports',
905
- 'sort-keys',
906
- 'sonarjs',
907
- 'storybook',
908
- 'unicorn',
909
- ],
910
- root: true,
911
- rules: {
912
- 'accessor-pairs': warn,
913
- 'array-bracket-newline': off,
914
- 'array-bracket-spacing': [warn, 'never'],
915
- 'array-callback-return': warn,
916
- 'array-element-newline': [warn, 'consistent'],
917
- 'arrow-body-style': off,
918
- 'arrow-parens': [warn, 'always'],
919
- 'arrow-spacing': [warn, { after: true, before: true }],
920
- 'block-scoped-var': warn,
921
- 'block-spacing': [warn, 'always'],
922
- 'brace-style': [warn, '1tbs'],
923
- 'callback-return': [off, ['callback', 'cb', 'next']],
924
- camelcase: [off, { properties: 'never' }],
925
- 'capitalized-comments': off,
926
- 'class-methods-use-this': off,
927
- 'comma-dangle': [warn, 'always-multiline'],
928
- 'comma-spacing': [warn, { after: true, before: false }],
929
- 'comma-style': [warn, 'last'],
930
- complexity: off,
931
- 'computed-property-spacing': [warn, 'never'],
932
- 'consistent-return': off,
933
- 'consistent-this': warn,
934
- 'constructor-super': warn,
935
- curly: [warn, 'all'],
936
- 'default-case': warn,
937
- 'default-param-last': warn,
938
- 'dot-location': [warn, 'property'],
939
- 'dot-notation': [warn, { allowKeywords: true }],
940
- 'eol-last': warn,
941
- eqeqeq: [warn, 'always', { null: 'ignore' }],
942
- 'for-direction': warn,
943
- 'func-call-spacing': [warn, 'never'],
944
- 'func-name-matching': warn,
945
- 'func-names': [off, 'as-needed'],
946
- 'func-style': [off, 'expression'],
947
- 'function-call-argument-newline': off,
948
- 'function-paren-newline': off,
949
- 'generator-star-spacing': [warn, { after: true, before: true }],
950
- 'getter-return': warn,
951
- 'global-require': off,
952
- 'guard-for-in': off,
953
- 'handle-callback-err': [warn, '^(err|error)$'],
954
- 'id-blacklist': warn,
955
- 'id-length': off,
956
- 'id-match': [warn, '^[$_]$|^[$_]?[_A-Za-z][A-Za-z0-9_]*$'],
957
- 'implicit-arrow-linebreak': [off, 'beside'],
958
- 'import/default': warn,
959
- 'import/dynamic-import-chunkname': off,
960
- 'import/export': warn,
961
- 'import/exports-last': off,
962
- // This should be opt-in. It's not necessary for Vite, for example.
963
- 'import/extensions': [off, { js: 'always', json: 'always' }],
964
- 'import/first': warn,
965
- 'import/group-exports': off,
966
- 'import/imports-first': warn,
967
- 'import/max-dependencies': off,
968
- // Disabled due to false positives:
969
- 'import/named': off,
970
- // Disabled due to false positives:
971
- 'import/namespace': off,
972
- 'import/newline-after-import': warn,
973
- 'import/no-absolute-path': warn,
974
- 'import/no-amd': warn,
975
- 'import/no-anonymous-default-export': warn,
976
- 'import/no-commonjs': off,
977
- 'import/no-cycle': off,
978
- 'import/no-default-export': off,
979
- // Disabled due to slow performance:
980
- 'import/no-deprecated': off,
981
- // Disabled due to slow performance, and because it's duplicated by `no-duplicate-imports`:
982
- 'import/no-duplicates': off,
983
- 'import/no-dynamic-require': off,
984
- 'import/no-extraneous-dependencies': warn,
985
- 'import/no-internal-modules': [
986
- off,
987
- { allow: ['[@a-z][@a-z]***', '**/*.svg'] },
1112
+ {
1113
+ files: [
1114
+ '**/spec/**',
1115
+ '**/test/**',
1116
+ '**/tests/**',
1117
+ '**/*.spec.*',
1118
+ '**/*.test.*',
988
1119
  ],
989
- 'import/no-mutable-exports': warn,
990
- 'import/no-named-as-default': warn,
991
- 'import/no-named-as-default-member': warn,
992
- 'import/no-named-default': warn,
993
- 'import/no-named-export': off,
994
- 'import/no-namespace': off,
995
- 'import/no-nodejs-modules': off,
996
- // Disabled due to false positives (e.g. "@robinblomberg/schema"):
997
- 'import/no-relative-parent-imports': off,
998
- 'import/no-restricted-paths': off,
999
- // Disabled due to slow performance:
1000
- 'import/no-self-import': off,
1001
- 'import/no-unassigned-import': warn,
1002
- // Disabled due to false positives:
1003
- 'import/no-unresolved': warn,
1004
- 'import/no-unused-modules': warn,
1005
- // Disabled due to slow performance:
1006
- 'import/no-useless-path-segments': off,
1007
- 'import/no-webpack-loader-syntax': warn,
1008
- /* 'import/order': [warn, {
1009
- alphabetize: {
1010
- caseInsensitive: false,
1011
- order: 'asc'
1120
+ languageOptions: {
1121
+ globals: {
1122
+ ...globals.jest,
1123
+ ...globals.mocha,
1012
1124
  },
1013
- groups: [
1014
- 'builtin',
1015
- 'external',
1016
- 'internal',
1017
- 'unknown',
1018
- 'parent',
1019
- 'sibling',
1020
- 'index',
1021
- 'object'
1125
+ },
1126
+ rules: {
1127
+ '@typescript-eslint/no-magic-numbers': off,
1128
+ 'jsdoc/require-jsdoc': off,
1129
+ 'no-empty-character-class': off,
1130
+ 'no-magic-numbers': off,
1131
+ 'no-sparse-arrays': off,
1132
+ 'sonarjs/no-duplicate-string': off,
1133
+ 'sort-keys': off,
1134
+ 'symbol-description': off,
1135
+ 'unicorn/better-regex': off,
1136
+ 'unicorn/consistent-function-scoping': off,
1137
+ 'unicorn/new-for-builtins': off,
1138
+ 'unicorn/no-new-array': off,
1139
+ },
1140
+ },
1141
+ {
1142
+ files: ['**/*.jsx', '**/*.tsx'],
1143
+ plugins: {
1144
+ react: reactPlugin,
1145
+ 'react-hooks': /** @type {any} */ (reactHooksPlugin),
1146
+ 'react-refresh': reactRefreshPlugin,
1147
+ 'jsx-a11y': jsxA11yPlugin,
1148
+ },
1149
+ rules: {
1150
+ 'jsx-a11y/accessible-emoji': warn,
1151
+ 'jsx-a11y/alt-text': warn,
1152
+ 'jsx-a11y/anchor-has-content': warn,
1153
+ 'jsx-a11y/anchor-is-valid': warn,
1154
+ 'jsx-a11y/aria-activedescendant-has-tabindex': warn,
1155
+ 'jsx-a11y/aria-props': warn,
1156
+ 'jsx-a11y/aria-proptypes': warn,
1157
+ 'jsx-a11y/aria-role': warn,
1158
+ 'jsx-a11y/aria-unsupported-elements': warn,
1159
+ 'jsx-a11y/autocomplete-valid': warn,
1160
+ 'jsx-a11y/click-events-have-key-events': warn,
1161
+ 'jsx-a11y/control-has-associated-label': [
1162
+ warn,
1163
+ {
1164
+ ignoreElements: [
1165
+ 'audio',
1166
+ 'canvas',
1167
+ 'embed',
1168
+ 'input',
1169
+ 'textarea',
1170
+ 'tr',
1171
+ 'video',
1172
+ ],
1173
+ ignoreRoles: [
1174
+ 'grid',
1175
+ 'listbox',
1176
+ 'menu',
1177
+ 'menubar',
1178
+ 'radiogroup',
1179
+ 'row',
1180
+ 'tablist',
1181
+ 'toolbar',
1182
+ 'tree',
1183
+ 'treegrid',
1184
+ ],
1185
+ includeRoles: ['alert', 'dialog'],
1186
+ },
1022
1187
  ],
1023
- 'newlines-between': 'never'
1024
- }], */
1025
- 'import/prefer-default-export': off,
1026
- 'import/unambiguous': off,
1027
- indent: [warn, 2, { SwitchCase: 1 }],
1028
- 'init-declarations': off,
1029
- 'jsx-quotes': warn,
1030
- 'key-spacing': [warn, { afterColon: true, beforeColon: false }],
1031
- 'keyword-spacing': [off, { after: true, before: true }],
1032
- 'line-comment-position': off,
1033
- 'linebreak-style': [warn, 'unix'],
1034
- 'lines-around-comment': off,
1035
- 'lines-between-class-members': [
1036
- warn,
1037
- 'always',
1038
- { exceptAfterSingleLine: true },
1039
- ],
1040
- 'max-classes-per-file': [off, 1],
1041
- 'max-depth': off,
1042
- 'max-len': [
1043
- warn,
1044
- { code: 100, ignoreComments: true, ignoreRegExpLiterals: true },
1045
- ],
1046
- 'max-lines': off,
1047
- 'max-lines-per-function': off,
1048
- 'max-nested-callbacks': warn,
1049
- 'max-params': off,
1050
- 'max-statements': off,
1051
- 'max-statements-per-line': [warn, { max: 1 }],
1052
- 'multiline-comment-style': off,
1053
- 'multiline-ternary': off,
1054
- 'new-cap': [warn, { capIsNew: false, newIsCap: true, properties: true }],
1055
- 'new-parens': warn,
1056
- 'newline-per-chained-call': off,
1057
- 'no-alert': off,
1058
- 'no-array-constructor': warn,
1059
- 'no-async-promise-executor': warn,
1060
- 'no-await-in-loop': off,
1061
- 'no-bitwise': off,
1062
- 'no-buffer-constructor': warn,
1063
- 'no-caller': warn,
1064
- 'no-case-declarations': warn,
1065
- 'no-class-assign': warn,
1066
- 'no-compare-neg-zero': warn,
1067
- 'no-cond-assign': warn,
1068
- 'no-confusing-arrow': off,
1069
- 'no-console': [off, { allow: ['debug', 'error', 'info', 'warn'] }],
1070
- 'no-const-assign': warn,
1071
- 'no-constant-condition': [warn, { checkLoops: false }],
1072
- 'no-continue': off,
1073
- 'no-control-regex': off,
1074
- 'no-debugger': warn,
1075
- 'no-delete-var': warn,
1076
- 'no-div-regex': off,
1077
- 'no-dupe-args': warn,
1078
- 'no-dupe-class-members': warn,
1079
- 'no-dupe-keys': warn,
1080
- 'no-duplicate-case': warn,
1081
- 'no-duplicate-imports': warn,
1082
- 'no-else-return': warn,
1083
- 'no-empty': [off, { allowEmptyCatch: true }],
1084
- 'no-empty-character-class': warn,
1085
- 'no-empty-function': off,
1086
- 'no-empty-pattern': off,
1087
- 'no-eq-null': off,
1088
- 'no-eval': warn,
1089
- 'no-ex-assign': warn,
1090
- 'no-extend-native': warn,
1091
- 'no-extra-bind': warn,
1092
- 'no-extra-boolean-cast': warn,
1093
- 'no-extra-label': warn,
1094
- 'no-extra-parens': [off, 'all', { nestedBinaryExpressions: false }],
1095
- 'no-extra-semi': warn,
1096
- 'no-fallthrough': warn,
1097
- 'no-floating-decimal': warn,
1098
- 'no-func-assign': warn,
1099
- 'no-global-assign': warn,
1100
- 'no-implicit-coercion': [warn, { boolean: false, number: false }],
1101
- 'no-implicit-globals': warn,
1102
- 'no-implied-eval': warn,
1103
- 'no-inline-comments': off,
1104
- 'no-inner-declarations': [warn, 'functions'],
1105
- 'no-invalid-regexp': warn,
1106
- 'no-invalid-this': off,
1107
- 'no-irregular-whitespace': warn,
1108
- 'no-iterator': warn,
1109
- 'no-label-var': warn,
1110
- 'no-labels': [off, { allowLoop: false, allowSwitch: false }],
1111
- 'no-lone-blocks': off,
1112
- 'no-lonely-if': warn,
1113
- 'no-loop-func': warn,
1114
- 'no-loss-of-precision': warn,
1115
- 'no-magic-numbers': [
1116
- off,
1117
- { ignore: [-1, 0, 1, 2, 3, '-1n', '0n', '1n', '2n', '3n'] },
1118
- ],
1119
- 'no-misleading-character-class': warn,
1120
- 'no-mixed-operators': [
1121
- warn,
1122
- {
1123
- allowSamePrecedence: true,
1124
- groups: [
1125
- ['==', '!=', '===', '!==', '>', '>=', '<', '<='],
1126
- ['&&', '||'],
1127
- ['in', 'instanceof'],
1128
- ],
1129
- },
1130
- ],
1131
- 'no-mixed-requires': warn,
1132
- 'no-mixed-spaces-and-tabs': warn,
1133
- 'no-multi-assign': off,
1134
- 'no-multi-spaces': warn,
1135
- 'no-multi-str': warn,
1136
- 'no-multiple-empty-lines': [warn, { max: 1, maxEOF: 0 }],
1137
- // Replaced by `unicorn/no-negated-condition`:
1138
- 'no-negated-condition': off,
1139
- 'no-negated-in-lhs': warn,
1140
- 'no-nested-ternary': off,
1141
- 'no-new': warn,
1142
- 'no-new-func': warn,
1143
- 'no-new-object': warn,
1144
- 'no-new-require': warn,
1145
- 'no-new-symbol': warn,
1146
- 'no-new-wrappers': off,
1147
- 'no-obj-calls': warn,
1148
- 'no-octal': warn,
1149
- 'no-octal-escape': warn,
1150
- 'no-param-reassign': off,
1151
- 'no-path-concat': warn,
1152
- 'no-plusplus': off,
1153
- 'no-process-env': off,
1154
- 'no-process-exit': off,
1155
- 'no-proto': warn,
1156
- 'no-prototype-builtins': warn,
1157
- 'no-redeclare': [warn, { builtinGlobals: false }],
1158
- 'no-regex-spaces': warn,
1159
- 'no-restricted-globals': [
1160
- error,
1161
- 'isNaN',
1162
- /*
1163
- * https://github.com/sidoshi/eslint-restricted-globals/blob/master/index.js
1164
- */
1165
- 'addEventListener',
1166
- 'blur',
1167
- 'close',
1168
- 'closed',
1169
- 'confirm',
1170
- 'defaultStatus',
1171
- 'event',
1172
- 'external',
1173
- 'defaultstatus',
1174
- 'find',
1175
- 'focus',
1176
- 'frameElement',
1177
- 'frames',
1178
- 'history',
1179
- 'innerHeight',
1180
- 'innerWidth',
1181
- 'length',
1182
- 'location',
1183
- 'locationbar',
1184
- 'menubar',
1185
- 'moveBy',
1186
- 'moveTo',
1187
- 'name',
1188
- 'onblur',
1189
- 'onerror',
1190
- 'onfocus',
1191
- 'onload',
1192
- 'onresize',
1193
- 'onunload',
1194
- 'open',
1195
- 'opener',
1196
- 'opera',
1197
- 'outerHeight',
1198
- 'outerWidth',
1199
- 'pageXOffset',
1200
- 'pageYOffset',
1201
- 'parent',
1202
- 'print',
1203
- 'removeEventListener',
1204
- 'resizeBy',
1205
- 'resizeTo',
1206
- 'screen',
1207
- 'screenLeft',
1208
- 'screenTop',
1209
- 'screenX',
1210
- 'screenY',
1211
- 'scroll',
1212
- 'scrollbars',
1213
- 'scrollBy',
1214
- 'scrollTo',
1215
- 'scrollX',
1216
- 'scrollY',
1217
- 'self',
1218
- 'status',
1219
- 'statusbar',
1220
- 'stop',
1221
- 'toolbar',
1222
- 'top',
1223
- ],
1224
- 'no-restricted-imports': [
1225
- 'error',
1226
- { paths: ['console', 'node:console', 'test', 'node:test'] },
1227
- ],
1228
- 'no-restricted-modules': warn,
1229
- 'no-restricted-properties': warn,
1230
- 'no-restricted-syntax': [warn, 'WithStatement'],
1231
- 'no-return-assign': [warn, 'except-parens'],
1232
- 'no-return-await': off,
1233
- 'no-script-url': warn,
1234
- 'no-self-assign': [warn, { props: true }],
1235
- 'no-self-compare': warn,
1236
- 'no-sequences': warn,
1237
- 'no-shadow': warn,
1238
- 'no-shadow-restricted-names': warn,
1239
- 'no-sparse-arrays': warn,
1240
- 'no-sync': off,
1241
- 'no-tabs': warn,
1242
- 'no-template-curly-in-string': off,
1243
- 'no-ternary': off,
1244
- 'no-this-before-super': warn,
1245
- 'no-throw-literal': warn,
1246
- 'no-trailing-spaces': warn,
1247
- 'no-undef': error,
1248
- 'no-undef-init': warn,
1249
- 'no-undefined': off,
1250
- 'no-underscore-dangle': off,
1251
- 'no-unexpected-multiline': warn,
1252
- 'no-unmodified-loop-condition': warn,
1253
- 'no-unneeded-ternary': [warn, { defaultAssignment: false }],
1254
- 'no-unreachable': warn,
1255
- 'no-unsafe-finally': warn,
1256
- 'no-unsafe-negation': warn,
1257
- 'no-unused-expressions': [
1258
- warn,
1259
- {
1260
- allowShortCircuit: true,
1261
- allowTaggedTemplates: true,
1262
- allowTernary: true,
1263
- },
1264
- ],
1265
- 'no-unused-labels': warn,
1266
- 'no-unused-vars': [
1267
- warn,
1268
- {
1269
- args: 'none',
1270
- argsIgnorePattern: '^_.*$',
1271
- vars: 'all',
1272
- varsIgnorePattern: '^_.*$|^T$',
1273
- },
1274
- ],
1275
- 'no-use-before-define': [
1276
- error,
1277
- { classes: false, functions: false, variables: false },
1278
- ],
1279
- 'no-useless-call': warn,
1280
- 'no-useless-catch': warn,
1281
- 'no-useless-computed-key': warn,
1282
- 'no-useless-concat': warn,
1283
- 'no-useless-constructor': warn,
1284
- 'no-useless-escape': warn,
1285
- 'no-useless-rename': warn,
1286
- 'no-useless-return': warn,
1287
- 'no-var': warn,
1288
- 'no-void': warn,
1289
- 'no-warning-comments': off,
1290
- 'no-whitespace-before-property': warn,
1291
- 'no-with': warn,
1292
- 'nonblock-statement-body-position': warn,
1293
- 'object-curly-newline': [warn, { consistent: true, multiline: true }],
1294
- 'object-curly-spacing': [warn, 'always'],
1295
- 'object-property-newline': [warn, { allowMultiplePropertiesPerLine: true }],
1296
- 'object-shorthand': [warn, 'always'],
1297
- 'one-var': [warn, 'never'],
1298
- 'one-var-declaration-per-line': warn,
1299
- 'operator-assignment': [warn, 'always'],
1300
- 'operator-linebreak': [
1301
- warn,
1302
- 'after',
1303
- { overrides: { ':': 'before', '?': 'before', '??': 'before' } },
1304
- ],
1305
- 'padded-blocks': [
1306
- warn,
1307
- { blocks: 'never', classes: 'never', switches: 'never' },
1308
- ],
1309
- 'padding-line-between-statements': warn,
1310
- // You may want to use `fn(function () {})` for some advanced cases:
1311
- 'prefer-arrow-callback': off,
1312
- 'prefer-const': [warn, { destructuring: 'all' }],
1313
- 'prefer-destructuring': [off, { array: false, object: true }],
1314
- 'prefer-named-capture-group': off,
1315
- 'prefer-numeric-literals': warn,
1316
- 'prefer-object-spread': warn,
1317
- 'prefer-promise-reject-errors': warn,
1318
- 'prefer-regex-literals': warn,
1319
- 'prefer-rest-params': warn,
1320
- 'prefer-spread': warn,
1321
- 'prefer-template': off,
1322
- 'quote-props': [warn, 'as-needed'],
1323
- quotes: [
1324
- warn,
1325
- 'single',
1326
- { allowTemplateLiterals: false, avoidEscape: true },
1327
- ],
1328
- radix: warn,
1329
- // Disabled due to false (?) positives:
1330
- 'require-atomic-updates': off,
1331
- 'require-await': warn,
1332
- 'require-unicode-regexp': off,
1333
- 'require-yield': warn,
1334
- 'rest-spread-spacing': [warn, 'never'],
1335
- semi: [warn, 'always'],
1336
- 'semi-spacing': [warn, { after: true, before: false }],
1337
- 'semi-style': [warn, 'last'],
1338
- 'sonarjs/cognitive-complexity': off,
1339
- 'sonarjs/elseif-without-else': off,
1340
- 'sonarjs/max-switch-cases': off,
1341
- 'sonarjs/no-all-duplicated-branches': warn,
1342
- 'sonarjs/no-collapsible-if': warn,
1343
- 'sonarjs/no-collection-size-mischeck': warn,
1344
- 'sonarjs/no-duplicate-string': off,
1345
- 'sonarjs/no-duplicated-branches': off,
1346
- 'sonarjs/no-element-overwrite': warn,
1347
- 'sonarjs/no-empty-collection': warn,
1348
- 'sonarjs/no-extra-arguments': warn,
1349
- // Disabled due to slow performance:
1350
- 'sonarjs/no-gratuitous-expressions': off,
1351
- 'sonarjs/no-identical-conditions': warn,
1352
- 'sonarjs/no-identical-expressions': warn,
1353
- 'sonarjs/no-identical-functions': off,
1354
- 'sonarjs/no-ignored-return': warn,
1355
- 'sonarjs/no-inverted-boolean-check': off,
1356
- 'sonarjs/no-nested-switch': off,
1357
- 'sonarjs/no-nested-template-literals': off,
1358
- 'sonarjs/no-redundant-boolean': warn,
1359
- 'sonarjs/no-redundant-jump': warn,
1360
- 'sonarjs/no-same-line-conditional': warn,
1361
- 'sonarjs/no-small-switch': off,
1362
- 'sonarjs/no-unused-collection': warn,
1363
- 'sonarjs/no-use-of-empty-return-value': warn,
1364
- 'sonarjs/no-useless-catch': warn,
1365
- 'sonarjs/non-existent-operator': warn,
1366
- 'sonarjs/prefer-immediate-return': warn,
1367
- 'sonarjs/prefer-object-literal': warn,
1368
- 'sonarjs/prefer-single-boolean-return': warn,
1369
- 'sonarjs/prefer-while': warn,
1370
- 'sort-imports': [
1371
- off,
1372
- {
1373
- ignoreCase: false,
1374
- ignoreDeclarationSort: false,
1375
- ignoreMemberSort: false,
1376
- memberSyntaxSortOrder: ['none', 'all', 'single', 'multiple'],
1377
- },
1378
- ],
1379
- 'sort-keys': off,
1380
- 'sort-keys/sort-keys-fix': [off, 'asc', { natural: false }],
1381
- 'sort-vars': warn,
1382
- 'space-before-blocks': [warn, 'always'],
1383
- 'space-before-function-paren': [warn, 'always'],
1384
- 'space-in-parens': [warn, 'never'],
1385
- 'space-infix-ops': warn,
1386
- 'space-unary-ops': [warn, { nonwords: false, words: true }],
1387
- 'spaced-comment': [
1388
- warn,
1389
- 'always',
1390
- {
1391
- block: { balanced: true, exceptions: ['*'] },
1392
- line: { markers: ['!', '?', '*', '/', '//'] },
1393
- },
1394
- ],
1395
- strict: [warn, 'never'],
1396
- 'switch-colon-spacing': [warn, { after: true, before: false }],
1397
- 'symbol-description': warn,
1398
- 'template-curly-spacing': [warn, 'never'],
1399
- 'template-tag-spacing': [warn, 'never'],
1400
- 'unicode-bom': [warn, 'never'],
1401
- 'unicorn/better-regex': warn,
1402
- 'unicorn/catch-error-name': warn,
1403
- 'unicorn/consistent-destructuring': warn,
1404
- 'unicorn/consistent-function-scoping': warn,
1405
- 'unicorn/custom-error-definition': off,
1406
- 'unicorn/empty-brace-spaces': off,
1407
- 'unicorn/error-message': warn,
1408
- 'unicorn/escape-case': warn,
1409
- 'unicorn/expiring-todo-comments': warn,
1410
- 'unicorn/explicit-length-check': warn,
1411
- 'unicorn/filename-case': [
1412
- warn,
1413
- { cases: { kebabCase: true, pascalCase: true } },
1414
- ],
1415
- 'unicorn/import-style': off,
1416
- 'unicorn/new-for-builtins': warn,
1417
- 'unicorn/no-abusive-eslint-disable': warn,
1418
- 'unicorn/no-array-callback-reference': warn,
1419
- 'unicorn/no-array-for-each': warn,
1420
- 'unicorn/no-array-method-this-argument': warn,
1421
- 'unicorn/no-array-push-push': off,
1422
- 'unicorn/no-array-reduce': warn,
1423
- 'unicorn/no-await-expression-member': warn,
1424
- 'unicorn/no-console-spaces': warn,
1425
- 'unicorn/no-document-cookie': off,
1426
- 'unicorn/no-empty-file': off,
1427
- 'unicorn/no-for-loop': warn,
1428
- 'unicorn/no-hex-escape': off,
1429
- 'unicorn/no-instanceof-array': warn,
1430
- 'unicorn/no-invalid-remove-event-listener': warn,
1431
- 'unicorn/no-keyword-prefix': off,
1432
- // Duplicated by `sonarjs/no-collapsible-if`, but with more annoying highlighting.
1433
- // It has auto-fix however, which is sometimes wanted and sometimes not:
1434
- 'unicorn/no-lonely-if': off,
1435
- 'unicorn/no-negated-condition': warn,
1436
- 'unicorn/no-nested-ternary': off,
1437
- 'unicorn/no-new-array': off,
1438
- 'unicorn/no-new-buffer': warn,
1439
- 'unicorn/no-null': off,
1440
- 'unicorn/no-object-as-default-parameter': off,
1441
- 'unicorn/no-process-exit': off,
1442
- 'unicorn/no-static-only-class': warn,
1443
- // Disabled due to slow performance:
1444
- 'unicorn/no-thenable': off,
1445
- 'unicorn/no-this-assignment': warn,
1446
- 'unicorn/no-typeof-undefined': [warn, { checkGlobalVariables: true }],
1447
- 'unicorn/no-unnecessary-await': warn,
1448
- 'unicorn/no-unreadable-array-destructuring': warn,
1449
- 'unicorn/no-unreadable-iife': warn,
1450
- 'unicorn/no-unused-properties': off,
1451
- 'unicorn/no-useless-fallback-in-spread': warn,
1452
- 'unicorn/no-useless-length-check': warn,
1453
- 'unicorn/no-useless-promise-resolve-reject': warn,
1454
- 'unicorn/no-useless-spread': warn,
1455
- 'unicorn/no-useless-switch-case': warn,
1456
- 'unicorn/no-useless-undefined': off,
1457
- 'unicorn/no-zero-fractions': warn,
1458
- 'unicorn/number-literal-case': off,
1459
- 'unicorn/numeric-separators-style': warn,
1460
- 'unicorn/prefer-add-event-listener': warn,
1461
- 'unicorn/prefer-array-find': warn,
1462
- 'unicorn/prefer-array-flat-map': warn,
1463
- // Disabled due to slow performance:
1464
- 'unicorn/prefer-array-flat': off,
1465
- 'unicorn/prefer-array-index-of': warn,
1466
- 'unicorn/prefer-array-some': warn,
1467
- 'unicorn/prefer-at': warn,
1468
- 'unicorn/prefer-blob-reading-methods': warn,
1469
- 'unicorn/prefer-code-point': off,
1470
- 'unicorn/prefer-date-now': warn,
1471
- 'unicorn/prefer-default-parameters': warn,
1472
- 'unicorn/prefer-dom-node-append': warn,
1473
- 'unicorn/prefer-dom-node-dataset': warn,
1474
- 'unicorn/prefer-dom-node-remove': warn,
1475
- 'unicorn/prefer-dom-node-text-content': warn,
1476
- 'unicorn/prefer-event-target': warn,
1477
- 'unicorn/prefer-export-from': warn,
1478
- 'unicorn/prefer-includes': warn,
1479
- 'unicorn/prefer-json-parse-buffer': off,
1480
- 'unicorn/prefer-keyboard-event-key': warn,
1481
- 'unicorn/prefer-logical-operator-over-ternary': warn,
1482
- 'unicorn/prefer-math-trunc': warn,
1483
- 'unicorn/prefer-modern-dom-apis': warn,
1484
- 'unicorn/prefer-modern-math-apis': warn,
1485
- 'unicorn/prefer-module': off,
1486
- 'unicorn/prefer-native-coercion-functions': warn,
1487
- 'unicorn/prefer-negative-index': warn,
1488
- 'unicorn/prefer-node-protocol': warn,
1489
- 'unicorn/prefer-number-properties': [
1490
- warn,
1491
- { checkInfinity: false, checkNaN: false },
1492
- ],
1493
- 'unicorn/prefer-object-from-entries': warn,
1494
- 'unicorn/prefer-optional-catch-binding': warn,
1495
- 'unicorn/prefer-prototype-methods': warn,
1496
- 'unicorn/prefer-query-selector': warn,
1497
- 'unicorn/prefer-reflect-apply': warn,
1498
- 'unicorn/prefer-regexp-test': warn,
1499
- 'unicorn/prefer-set-has': warn,
1500
- 'unicorn/prefer-set-size': warn,
1501
- // Disabled due to slow performance:
1502
- 'unicorn/prefer-spread': off,
1503
- 'unicorn/prefer-string-replace-all': warn,
1504
- 'unicorn/prefer-string-slice': warn,
1505
- 'unicorn/prefer-string-starts-ends-with': warn,
1506
- 'unicorn/prefer-string-trim-start-end': warn,
1507
- 'unicorn/prefer-switch': off,
1508
- 'unicorn/prefer-ternary': off,
1509
- // Not available in all Node.js versions or without specific settings:
1510
- 'unicorn/prefer-top-level-await': off,
1511
- 'unicorn/prefer-type-error': warn,
1512
- 'unicorn/prevent-abbreviations': off,
1513
- 'unicorn/relative-url-style': off,
1514
- 'unicorn/require-array-join-separator': warn,
1515
- 'unicorn/require-number-to-fixed-digits-argument': warn,
1516
- 'unicorn/require-post-message-target-origin': warn,
1517
- 'unicorn/string-content': off,
1518
- 'unicorn/switch-case-braces': off,
1519
- 'unicorn/template-indent': warn,
1520
- 'unicorn/text-encoding-identifier-case': warn,
1521
- 'unicorn/throw-new-error': warn,
1522
- 'use-isnan': warn,
1523
- 'valid-typeof': [off, { requireStringLiterals: true }],
1524
- 'vars-on-top': warn,
1525
- 'wrap-iife': [warn, 'any', { functionPrototypeMethods: true }],
1526
- 'wrap-regex': off,
1527
- 'yield-star-spacing': [warn, 'both'],
1528
- yoda: [warn, 'never'],
1188
+ 'jsx-a11y/heading-has-content': warn,
1189
+ 'jsx-a11y/html-has-lang': warn,
1190
+ 'jsx-a11y/iframe-has-title': warn,
1191
+ 'jsx-a11y/img-redundant-alt': warn,
1192
+ 'jsx-a11y/interactive-supports-focus': [
1193
+ warn,
1194
+ {
1195
+ tabbable: [
1196
+ 'button',
1197
+ 'checkbox',
1198
+ 'link',
1199
+ 'progressbar',
1200
+ 'searchbox',
1201
+ 'slider',
1202
+ 'spinbutton',
1203
+ 'switch',
1204
+ 'textbox',
1205
+ ],
1206
+ },
1207
+ ],
1208
+ 'jsx-a11y/label-has-associated-control': warn,
1209
+ 'jsx-a11y/label-has-for': off,
1210
+ 'jsx-a11y/media-has-caption': warn,
1211
+ 'jsx-a11y/mouse-events-have-key-events': warn,
1212
+ 'jsx-a11y/no-access-key': warn,
1213
+ 'jsx-a11y/no-autofocus': warn,
1214
+ 'jsx-a11y/no-distracting-elements': warn,
1215
+ 'jsx-a11y/no-interactive-element-to-noninteractive-role': warn,
1216
+ 'jsx-a11y/no-noninteractive-element-interactions': [
1217
+ warn,
1218
+ {
1219
+ body: ['onError', 'onLoad'],
1220
+ iframe: ['onError', 'onLoad'],
1221
+ img: ['onError', 'onLoad'],
1222
+ },
1223
+ ],
1224
+ 'jsx-a11y/no-noninteractive-element-to-interactive-role': warn,
1225
+ 'jsx-a11y/no-noninteractive-tabindex': warn,
1226
+ 'jsx-a11y/no-redundant-roles': warn,
1227
+ 'jsx-a11y/no-static-element-interactions': warn,
1228
+ 'jsx-a11y/role-has-required-aria-props': warn,
1229
+ 'jsx-a11y/role-supports-aria-props': warn,
1230
+ 'jsx-a11y/scope': warn,
1231
+ 'jsx-a11y/tabindex-no-positive': warn,
1232
+ 'react/boolean-prop-naming': warn,
1233
+ 'react/button-has-type': warn,
1234
+ 'react/default-props-match-prop-types': warn,
1235
+ 'react/destructuring-assignment': off,
1236
+ 'react/display-name': warn,
1237
+ 'react/forbid-component-props': off,
1238
+ 'react/forbid-dom-props': warn,
1239
+ 'react/forbid-elements': warn,
1240
+ 'react/forbid-foreign-prop-types': warn,
1241
+ 'react/forbid-prop-types': warn,
1242
+ 'react/function-component-definition': [
1243
+ warn,
1244
+ {
1245
+ namedComponents: 'arrow-function',
1246
+ unnamedComponents: 'arrow-function',
1247
+ },
1248
+ ],
1249
+ 'react/jsx-boolean-value': warn,
1250
+ 'react/jsx-child-element-spacing': warn,
1251
+ 'react/jsx-closing-bracket-location': warn,
1252
+ 'react/jsx-closing-tag-location': warn,
1253
+ 'react/jsx-curly-brace-presence': [
1254
+ warn,
1255
+ { children: 'always', props: 'never' },
1256
+ ],
1257
+ 'react/jsx-curly-newline': off,
1258
+ 'react/jsx-curly-spacing': warn,
1259
+ 'react/jsx-equals-spacing': warn,
1260
+ 'react/jsx-filename-extension': [warn, { extensions: ['.jsx', '.tsx'] }],
1261
+ 'react/jsx-first-prop-new-line': warn,
1262
+ 'react/jsx-fragments': warn,
1263
+ 'react/jsx-handler-names': warn,
1264
+ 'react/jsx-indent': [warn, 2, { indentLogicalExpressions: true }],
1265
+ 'react/jsx-indent-props': [warn, 2],
1266
+ 'react/jsx-key': warn,
1267
+ 'react/jsx-max-depth': off,
1268
+ 'react/jsx-max-props-per-line': [warn, { maximum: 1, when: 'multiline' }],
1269
+ 'react/jsx-newline': off,
1270
+ 'react/jsx-no-bind': [
1271
+ warn,
1272
+ {
1273
+ allowArrowFunctions: true,
1274
+ allowBind: true,
1275
+ allowFunctions: false,
1276
+ ignoreDOMComponents: false,
1277
+ ignoreRefs: false,
1278
+ },
1279
+ ],
1280
+ 'react/jsx-no-comment-textnodes': warn,
1281
+ 'react/jsx-no-constructed-context-values': warn,
1282
+ 'react/jsx-no-duplicate-props': warn,
1283
+ 'react/jsx-no-literals': warn,
1284
+ 'react/jsx-no-script-url': warn,
1285
+ 'react/jsx-no-target-blank': warn,
1286
+ 'react/jsx-no-undef': warn,
1287
+ 'react/jsx-no-useless-fragment': off,
1288
+ 'react/jsx-one-expression-per-line': warn,
1289
+ 'react/jsx-pascal-case': warn,
1290
+ 'react/jsx-props-no-multi-spaces': warn,
1291
+ 'react/jsx-props-no-spreading': off,
1292
+ 'react/jsx-sort-props': warn,
1293
+ /** @deprecated */
1294
+ 'react/jsx-space-before-closing': off,
1295
+ 'react/jsx-tag-spacing': [
1296
+ warn,
1297
+ {
1298
+ afterOpening: 'never',
1299
+ beforeClosing: 'allow',
1300
+ beforeSelfClosing: 'always',
1301
+ closingSlash: 'never',
1302
+ },
1303
+ ],
1304
+ 'react/jsx-uses-react': warn,
1305
+ 'react/jsx-uses-vars': warn,
1306
+ 'react/jsx-wrap-multilines': [
1307
+ warn,
1308
+ {
1309
+ arrow: 'ignore',
1310
+ assignment: 'ignore',
1311
+ condition: 'ignore',
1312
+ declaration: 'ignore',
1313
+ logical: 'ignore',
1314
+ prop: 'ignore',
1315
+ return: 'parens',
1316
+ },
1317
+ ],
1318
+ 'react/no-access-state-in-setstate': warn,
1319
+ 'react/no-adjacent-inline-elements': off,
1320
+ 'react/no-array-index-key': warn,
1321
+ 'react/no-children-prop': warn,
1322
+ 'react/no-danger': warn,
1323
+ 'react/no-danger-with-children': warn,
1324
+ 'react/no-deprecated': warn,
1325
+ 'react/no-did-mount-set-state': warn,
1326
+ 'react/no-did-update-set-state': warn,
1327
+ 'react/no-direct-mutation-state': warn,
1328
+ 'react/no-find-dom-node': warn,
1329
+ 'react/no-is-mounted': warn,
1330
+ 'react/no-multi-comp': off,
1331
+ 'react/no-redundant-should-component-update': warn,
1332
+ 'react/no-render-return-value': warn,
1333
+ 'react/no-set-state': off,
1334
+ 'react/no-string-refs': warn,
1335
+ 'react/no-this-in-sfc': warn,
1336
+ 'react/no-typos': warn,
1337
+ 'react/no-unescaped-entities': warn,
1338
+ 'react/no-unknown-property': warn,
1339
+ 'react/no-unsafe': warn,
1340
+ 'react/no-unused-prop-types': warn,
1341
+ 'react/no-unused-state': warn,
1342
+ 'react/no-will-update-set-state': warn,
1343
+ 'react/prefer-es6-class': warn,
1344
+ // Props are seldom mutated anyway:
1345
+ 'react/prefer-read-only-props': off,
1346
+ 'react/prefer-stateless-function': warn,
1347
+ 'react/prop-types': off,
1348
+ 'react/react-in-jsx-scope': off,
1349
+ 'react/require-default-props': off,
1350
+ 'react/require-optimization': off,
1351
+ 'react/require-render-return': warn,
1352
+ 'react/self-closing-comp': warn,
1353
+ 'react/sort-comp': [
1354
+ warn,
1355
+ {
1356
+ groups: {
1357
+ lifecycle: [
1358
+ 'displayName',
1359
+ 'propTypes',
1360
+ 'contextTypes',
1361
+ 'childContextTypes',
1362
+ 'mixins',
1363
+ 'statics',
1364
+ 'defaultProps',
1365
+ 'constructor',
1366
+ 'getDefaultProps',
1367
+ 'state',
1368
+ 'getInitialState',
1369
+ 'getChildContext',
1370
+ 'getDerivedStateFromProps',
1371
+ 'componentWillMount',
1372
+ 'UNSAFE_componentWillMount',
1373
+ 'componentDidMount',
1374
+ 'componentWillReceiveProps',
1375
+ 'UNSAFE_componentWillReceiveProps',
1376
+ 'shouldComponentUpdate',
1377
+ 'componentWillUpdate',
1378
+ 'UNSAFE_componentWillUpdate',
1379
+ 'getSnapshotBeforeUpdate',
1380
+ 'componentDidUpdate',
1381
+ 'componentDidCatch',
1382
+ 'componentWillUnmount',
1383
+ ],
1384
+ },
1385
+ order: [
1386
+ 'static-variables',
1387
+ 'static-methods',
1388
+ 'everything-else',
1389
+ 'instance-variables',
1390
+ 'instance-methods',
1391
+ 'lifecycle',
1392
+ 'render',
1393
+ ],
1394
+ },
1395
+ ],
1396
+ 'react/sort-default-props': warn,
1397
+ 'react/sort-prop-types': warn,
1398
+ 'react/state-in-constructor': off,
1399
+ 'react/static-property-placement': warn,
1400
+ 'react/style-prop-object': warn,
1401
+ 'react/void-dom-elements-no-children': warn,
1402
+ 'react-hooks/exhaustive-deps': warn,
1403
+ 'react-hooks/rules-of-hooks': error,
1404
+ 'react-refresh/only-export-components': [
1405
+ warn,
1406
+ { allowConstantExport: true },
1407
+ ],
1408
+ },
1529
1409
  },
1530
- settings: {
1531
- 'import/extensions': ['.js', '.ts'],
1532
- 'import/internal-regex': '^@',
1533
- jsdoc: {
1534
- mode: 'closure',
1410
+ {
1411
+ files: ['**/*.d.ts'],
1412
+ rules: {
1413
+ '@typescript-eslint/consistent-type-definitions': off,
1414
+ '@typescript-eslint/no-extraneous-class': off,
1415
+ '@typescript-eslint/no-use-before-define': off,
1416
+ 'import/no-default-export': off,
1417
+ 'jsdoc/require-jsdoc': off,
1418
+ 'max-classes-per-file': off,
1535
1419
  },
1536
- react: {
1537
- version: 'detect',
1420
+ },
1421
+ {
1422
+ files: ['**/*.config.js', '**/*.config.ts'],
1423
+ rules: {
1424
+ '@typescript-eslint/no-magic-numbers': off,
1425
+ 'no-magic-numbers': off,
1538
1426
  },
1539
1427
  },
1540
- });
1428
+ {
1429
+ files: ['**/*.js'],
1430
+ rules: {
1431
+ 'jsdoc/check-access': warn,
1432
+ 'jsdoc/check-alignment': warn,
1433
+ 'jsdoc/check-examples': off,
1434
+ 'jsdoc/check-indentation': [off, { excludeTags: ['example'] }],
1435
+ 'jsdoc/check-line-alignment': warn,
1436
+ 'jsdoc/check-param-names': warn,
1437
+ 'jsdoc/check-property-names': warn,
1438
+ 'jsdoc/check-syntax': warn,
1439
+ 'jsdoc/check-tag-names': warn,
1440
+ 'jsdoc/check-types': [warn, { noDefaults: true }],
1441
+ 'jsdoc/check-values': warn,
1442
+ 'jsdoc/empty-tags': warn,
1443
+ 'jsdoc/implements-on-classes': warn,
1444
+ 'jsdoc/match-description': warn,
1445
+ 'jsdoc/no-bad-blocks': warn,
1446
+ 'jsdoc/no-defaults': warn,
1447
+ 'jsdoc/no-types': off,
1448
+ // Disabled due to false positives when referring to a generic type from inside its function:
1449
+ 'jsdoc/no-undefined-types': [
1450
+ off,
1451
+ {
1452
+ definedTypes: [
1453
+ 'unknown',
1454
+ /**
1455
+ * @see typescript\lib\lib.es5.d.ts
1456
+ * @version 4.1.2
1457
+ */
1458
+ 'PropertyKey',
1459
+ 'PropertyDescriptor',
1460
+ 'PropertyDescriptorMap',
1461
+ 'ObjectConstructor',
1462
+ 'FunctionConstructor',
1463
+ 'ThisParameterType',
1464
+ 'OmitThisParameter',
1465
+ 'CallableFunction',
1466
+ 'NewableFunction',
1467
+ 'IArguments',
1468
+ 'StringConstructor',
1469
+ 'BooleanConstructor',
1470
+ 'NumberConstructor',
1471
+ 'TemplateStringsArray',
1472
+ 'ImportMeta',
1473
+ 'DateConstructor',
1474
+ 'RegExpMatchArray',
1475
+ 'RegExpExecArray',
1476
+ 'RegExpConstructor',
1477
+ 'ErrorConstructor',
1478
+ 'EvalErrorConstructor',
1479
+ 'RangeErrorConstructor',
1480
+ 'ReferenceErrorConstructor',
1481
+ 'SyntaxErrorConstructor',
1482
+ 'TypeErrorConstructor',
1483
+ 'URIErrorConstructor',
1484
+ 'ReadonlyArray',
1485
+ 'ConcatArray',
1486
+ 'ArrayConstructor',
1487
+ 'TypedPropertyDescriptor',
1488
+ 'ClassDecorator',
1489
+ 'PropertyDecorator',
1490
+ 'MethodDecorator',
1491
+ 'ParameterDecorator',
1492
+ 'PromiseConstructorLike',
1493
+ 'PromiseLike',
1494
+ 'ArrayLike',
1495
+ 'Partial',
1496
+ 'Required',
1497
+ 'Readonly',
1498
+ 'Pick',
1499
+ 'Exclude',
1500
+ 'Extract',
1501
+ 'Omit',
1502
+ 'NonNullable',
1503
+ 'Parameters',
1504
+ 'ConstructorParameters',
1505
+ 'ReturnType',
1506
+ 'InstanceType',
1507
+ 'ThisType',
1508
+ 'ArrayBufferTypes',
1509
+ 'ArrayBufferLike',
1510
+ 'ArrayBufferConstructor',
1511
+ 'ArrayBufferView',
1512
+ 'DataViewConstructor',
1513
+ 'Int8ArrayConstructor',
1514
+ 'Uint8ArrayConstructor',
1515
+ 'Uint8ClampedArrayConstructor',
1516
+ 'Int16ArrayConstructor',
1517
+ 'Uint16ArrayConstructor',
1518
+ 'Int32ArrayConstructor',
1519
+ 'Uint32ArrayConstructor',
1520
+ 'Float32ArrayConstructor',
1521
+ 'Float64ArrayConstructor',
1522
+ ],
1523
+ },
1524
+ ],
1525
+ 'jsdoc/require-description': [
1526
+ off,
1527
+ { contexts: ['any'], descriptionStyle: 'body' },
1528
+ ],
1529
+ 'jsdoc/require-description-complete-sentence': off,
1530
+ 'jsdoc/require-example': off,
1531
+ 'jsdoc/require-file-overview': off,
1532
+ 'jsdoc/require-hyphen-before-param-description': [warn, 'never'],
1533
+ 'jsdoc/require-jsdoc': [
1534
+ off,
1535
+ {
1536
+ exemptEmptyFunctions: true,
1537
+ publicOnly: false,
1538
+ require: {
1539
+ ArrowFunctionExpression: true,
1540
+ ClassDeclaration: false,
1541
+ ClassExpression: false,
1542
+ FunctionDeclaration: true,
1543
+ FunctionExpression: true,
1544
+ MethodDefinition: true,
1545
+ },
1546
+ },
1547
+ ],
1548
+ 'jsdoc/require-param': [
1549
+ warn,
1550
+ {
1551
+ checkConstructors: true,
1552
+ checkDestructured: true,
1553
+ checkDestructuredRoots: true,
1554
+ checkGetters: true,
1555
+ checkSetters: true,
1556
+ },
1557
+ ],
1558
+ 'jsdoc/require-param-description': off,
1559
+ 'jsdoc/require-param-name': warn,
1560
+ 'jsdoc/require-param-type': [warn, { contexts: ['any'] }],
1561
+ 'jsdoc/require-property': warn,
1562
+ 'jsdoc/require-property-description': off,
1563
+ 'jsdoc/require-property-name': warn,
1564
+ 'jsdoc/require-property-type': warn,
1565
+ 'jsdoc/require-returns': off,
1566
+ 'jsdoc/require-returns-check': warn,
1567
+ 'jsdoc/require-returns-description': off,
1568
+ 'jsdoc/require-returns-type': warn,
1569
+ 'jsdoc/valid-types': off,
1570
+ },
1571
+ },
1572
+ ];
1573
+
1574
+ export default config;