@robinblomberg/eslint-config-robinblomberg 0.35.0 → 0.36.0-beta2
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/README.md +52 -52
- package/dist/index.d.ts.map +1 -0
- package/dist/rules/comment-style.d.ts +6 -0
- package/dist/rules/comment-style.d.ts.map +1 -0
- package/dist/rules/index.d.ts +8 -0
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/rules/module-declarations.d.ts +23 -0
- package/dist/rules/module-declarations.d.ts.map +1 -0
- package/dist/rules/prefer-arrow-functions.d.ts +6 -0
- package/dist/rules/prefer-arrow-functions.d.ts.map +1 -0
- package/dist/rules/sort-declarations.d.ts +7 -0
- package/dist/rules/sort-declarations.d.ts.map +1 -0
- package/dist/rules/sort-tests.d.ts +6 -0
- package/dist/rules/sort-tests.d.ts.map +1 -0
- package/package.json +17 -11
- package/{index.js → src/index.js} +285 -176
- package/src/rules/comment-style.js +298 -0
- package/src/rules/index.js +23 -0
- package/src/rules/module-declarations.js +278 -0
- package/src/rules/prefer-arrow-functions.js +296 -0
- package/src/rules/sort-declarations.js +318 -0
- package/src/rules/sort-tests.js +102 -0
- package/index.d.ts.map +0 -1
- /package/{index.d.ts → dist/index.d.ts} +0 -0
|
@@ -6,19 +6,36 @@ import jsdocPlugin from 'eslint-plugin-jsdoc';
|
|
|
6
6
|
import jsxA11yPlugin from 'eslint-plugin-jsx-a11y';
|
|
7
7
|
// @ts-expect-error - No published type declarations:
|
|
8
8
|
import noOnlyTestsPlugin from 'eslint-plugin-no-only-tests';
|
|
9
|
+
import perfectionistPlugin from 'eslint-plugin-perfectionist';
|
|
9
10
|
import reactPlugin from 'eslint-plugin-react';
|
|
10
11
|
import reactHooksPlugin from 'eslint-plugin-react-hooks';
|
|
11
12
|
import reactRefreshPlugin from 'eslint-plugin-react-refresh';
|
|
12
13
|
import sonarjsPlugin from 'eslint-plugin-sonarjs';
|
|
13
|
-
// @ts-expect-error - No published type declarations:
|
|
14
|
-
import sortExportsPlugin from 'eslint-plugin-sort-exports';
|
|
15
|
-
// @ts-expect-error - No published type declarations:
|
|
16
|
-
import sortKeysPlugin from 'eslint-plugin-sort-keys';
|
|
17
14
|
import storybookPlugin from 'eslint-plugin-storybook';
|
|
18
15
|
import unicornPlugin from 'eslint-plugin-unicorn';
|
|
19
16
|
import globals from 'globals';
|
|
17
|
+
import robinblombergPlugin from './rules/index.js';
|
|
20
18
|
|
|
21
19
|
const IS_DEVELOPMENT = !process.env.CI && process.env.NODE_ENV !== 'production';
|
|
20
|
+
|
|
21
|
+
const RESTRICTED_SYNTAX = [
|
|
22
|
+
'WithStatement',
|
|
23
|
+
{
|
|
24
|
+
message: 'Use ++ instead of += 1.',
|
|
25
|
+
selector: "AssignmentExpression[operator='+='][right.value=1]",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
message: 'Use -- instead of -= 1.',
|
|
29
|
+
selector: "AssignmentExpression[operator='-='][right.value=1]",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
message:
|
|
33
|
+
'Write a function component with hooks instead of a class component.',
|
|
34
|
+
selector:
|
|
35
|
+
':matches(ClassDeclaration, ClassExpression)[superClass.name=/^(?:Pure)?Component$/], :matches(ClassDeclaration, ClassExpression)[superClass.property.name=/^(?:Pure)?Component$/]',
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
|
|
22
39
|
const error = 'error';
|
|
23
40
|
const off = 'off';
|
|
24
41
|
const warn = IS_DEVELOPMENT ? 'warn' : 'error';
|
|
@@ -33,7 +50,12 @@ const config = [
|
|
|
33
50
|
{
|
|
34
51
|
languageOptions: {
|
|
35
52
|
ecmaVersion: 'latest',
|
|
36
|
-
|
|
53
|
+
globals: {
|
|
54
|
+
...globals.browser,
|
|
55
|
+
...globals.es2024,
|
|
56
|
+
...globals.node,
|
|
57
|
+
globalThis: 'writable',
|
|
58
|
+
},
|
|
37
59
|
parser: babelParser,
|
|
38
60
|
parserOptions: {
|
|
39
61
|
allowAwaitOutsideFunction: true,
|
|
@@ -42,19 +64,14 @@ const config = [
|
|
|
42
64
|
},
|
|
43
65
|
requireConfigFile: false,
|
|
44
66
|
},
|
|
45
|
-
|
|
46
|
-
...globals.browser,
|
|
47
|
-
...globals.es2024,
|
|
48
|
-
...globals.node,
|
|
49
|
-
globalThis: 'writable',
|
|
50
|
-
},
|
|
67
|
+
sourceType: 'module',
|
|
51
68
|
},
|
|
52
69
|
plugins: {
|
|
53
70
|
import: importPlugin,
|
|
54
71
|
jsdoc: jsdocPlugin,
|
|
55
72
|
'no-only-tests': /** @type {any} */ (noOnlyTestsPlugin),
|
|
56
|
-
|
|
57
|
-
|
|
73
|
+
perfectionist: perfectionistPlugin,
|
|
74
|
+
robinblomberg: robinblombergPlugin,
|
|
58
75
|
sonarjs: sonarjsPlugin,
|
|
59
76
|
storybook: /** @type {any} */ (storybookPlugin),
|
|
60
77
|
unicorn: unicornPlugin,
|
|
@@ -65,7 +82,7 @@ const config = [
|
|
|
65
82
|
'array-bracket-spacing': [warn, 'never'],
|
|
66
83
|
'array-callback-return': warn,
|
|
67
84
|
'array-element-newline': [warn, 'consistent'],
|
|
68
|
-
'arrow-body-style':
|
|
85
|
+
'arrow-body-style': [warn, 'always'],
|
|
69
86
|
'arrow-parens': [warn, 'always'],
|
|
70
87
|
'arrow-spacing': [warn, { after: true, before: true }],
|
|
71
88
|
'block-scoped-var': warn,
|
|
@@ -103,7 +120,10 @@ const config = [
|
|
|
103
120
|
'guard-for-in': off,
|
|
104
121
|
'handle-callback-err': [warn, '^(err|error)$'],
|
|
105
122
|
'id-blacklist': warn,
|
|
106
|
-
'id-length':
|
|
123
|
+
'id-length': [
|
|
124
|
+
warn,
|
|
125
|
+
{ exceptions: ['_', 'x', 'y', 'z'], min: 2, properties: 'never' },
|
|
126
|
+
],
|
|
107
127
|
'id-match': [warn, '^[$_]$|^[$_]?[_A-Za-z][A-Za-z0-9_]*$'],
|
|
108
128
|
'implicit-arrow-linebreak': [off, 'beside'],
|
|
109
129
|
'import/consistent-type-specifier-style': [warn, 'prefer-top-level'],
|
|
@@ -111,7 +131,7 @@ const config = [
|
|
|
111
131
|
'import/dynamic-import-chunkname': off,
|
|
112
132
|
'import/export': warn,
|
|
113
133
|
'import/exports-last': off,
|
|
114
|
-
//
|
|
134
|
+
// Opt-in, since e.g. Vite doesn't need it:
|
|
115
135
|
'import/extensions': [off, { js: 'always', json: 'always' }],
|
|
116
136
|
'import/first': warn,
|
|
117
137
|
'import/group-exports': off,
|
|
@@ -130,7 +150,8 @@ const config = [
|
|
|
130
150
|
'import/no-default-export': off,
|
|
131
151
|
// Disabled due to slow performance:
|
|
132
152
|
'import/no-deprecated': off,
|
|
133
|
-
// Disabled due to slow performance, and because it's duplicated by
|
|
153
|
+
// Disabled due to slow performance, and because it's duplicated by
|
|
154
|
+
// `no-duplicate-imports`:
|
|
134
155
|
'import/no-duplicates': off,
|
|
135
156
|
'import/no-dynamic-require': off,
|
|
136
157
|
'import/no-extraneous-dependencies': warn,
|
|
@@ -157,23 +178,8 @@ const config = [
|
|
|
157
178
|
// Disabled due to slow performance:
|
|
158
179
|
'import/no-useless-path-segments': off,
|
|
159
180
|
'import/no-webpack-loader-syntax': warn,
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
caseInsensitive: false,
|
|
163
|
-
order: 'asc'
|
|
164
|
-
},
|
|
165
|
-
groups: [
|
|
166
|
-
'builtin',
|
|
167
|
-
'external',
|
|
168
|
-
'internal',
|
|
169
|
-
'unknown',
|
|
170
|
-
'parent',
|
|
171
|
-
'sibling',
|
|
172
|
-
'index',
|
|
173
|
-
'object'
|
|
174
|
-
],
|
|
175
|
-
'newlines-between': 'never'
|
|
176
|
-
}], */
|
|
181
|
+
// Replaced by `perfectionist/sort-imports`:
|
|
182
|
+
'import/order': off,
|
|
177
183
|
'import/prefer-default-export': off,
|
|
178
184
|
'import/unambiguous': off,
|
|
179
185
|
indent: [warn, 2, { SwitchCase: 1 }],
|
|
@@ -374,23 +380,31 @@ const config = [
|
|
|
374
380
|
'top',
|
|
375
381
|
],
|
|
376
382
|
'no-restricted-imports': [
|
|
377
|
-
|
|
378
|
-
{ paths: ['console', 'node:console', 'test', 'node:test'] },
|
|
379
|
-
],
|
|
380
|
-
'no-restricted-modules': warn,
|
|
381
|
-
'no-restricted-properties': warn,
|
|
382
|
-
'no-restricted-syntax': [
|
|
383
|
-
warn,
|
|
384
|
-
'WithStatement',
|
|
385
|
-
{
|
|
386
|
-
message: 'Use ++ instead of += 1.',
|
|
387
|
-
selector: "AssignmentExpression[operator='+='][right.value=1]",
|
|
388
|
-
},
|
|
383
|
+
error,
|
|
389
384
|
{
|
|
390
|
-
|
|
391
|
-
|
|
385
|
+
paths: [
|
|
386
|
+
'console',
|
|
387
|
+
'node:console',
|
|
388
|
+
{
|
|
389
|
+
message: 'Type props with TypeScript instead of PropTypes.',
|
|
390
|
+
name: 'prop-types',
|
|
391
|
+
},
|
|
392
|
+
'test',
|
|
393
|
+
'node:test',
|
|
394
|
+
],
|
|
395
|
+
patterns: [
|
|
396
|
+
{
|
|
397
|
+
allowImportNamePattern: '^(?:\\w+Icon|Lucide\\w*)$',
|
|
398
|
+
group: ['lucide-react'],
|
|
399
|
+
message:
|
|
400
|
+
'Import Lucide icons by their `*Icon` names, e.g. `CheckIcon`.',
|
|
401
|
+
},
|
|
402
|
+
],
|
|
392
403
|
},
|
|
393
404
|
],
|
|
405
|
+
'no-restricted-modules': warn,
|
|
406
|
+
'no-restricted-properties': warn,
|
|
407
|
+
'no-restricted-syntax': [warn, ...RESTRICTED_SYNTAX],
|
|
394
408
|
'no-return-assign': [warn, 'except-parens'],
|
|
395
409
|
'no-return-await': off,
|
|
396
410
|
'no-script-url': warn,
|
|
@@ -472,9 +486,137 @@ const config = [
|
|
|
472
486
|
warn,
|
|
473
487
|
{ blocks: 'never', classes: 'never', switches: 'never' },
|
|
474
488
|
],
|
|
475
|
-
'padding-line-between-statements':
|
|
476
|
-
|
|
477
|
-
|
|
489
|
+
'padding-line-between-statements': [
|
|
490
|
+
warn,
|
|
491
|
+
{
|
|
492
|
+
blankLine: 'always',
|
|
493
|
+
next: ['do', 'for', 'if', 'switch', 'try', 'while'],
|
|
494
|
+
prev: '*',
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
blankLine: 'always',
|
|
498
|
+
next: '*',
|
|
499
|
+
prev: ['do', 'for', 'if', 'switch', 'try', 'while'],
|
|
500
|
+
},
|
|
501
|
+
],
|
|
502
|
+
'perfectionist/sort-array-includes': warn,
|
|
503
|
+
// Would change what the array means:
|
|
504
|
+
'perfectionist/sort-arrays': off,
|
|
505
|
+
'perfectionist/sort-classes': [
|
|
506
|
+
warn,
|
|
507
|
+
{
|
|
508
|
+
customGroups: [
|
|
509
|
+
{
|
|
510
|
+
anyOf: [
|
|
511
|
+
{ modifiers: ['static'], selector: 'accessor-property' },
|
|
512
|
+
{ modifiers: ['static'], selector: 'property' },
|
|
513
|
+
],
|
|
514
|
+
groupName: 'static-properties',
|
|
515
|
+
},
|
|
516
|
+
{
|
|
517
|
+
anyOf: [
|
|
518
|
+
{ modifiers: ['static'], selector: 'function-property' },
|
|
519
|
+
{ modifiers: ['static'], selector: 'method' },
|
|
520
|
+
],
|
|
521
|
+
groupName: 'static-methods',
|
|
522
|
+
},
|
|
523
|
+
{
|
|
524
|
+
anyOf: [
|
|
525
|
+
{ modifiers: ['private'], selector: 'accessor-property' },
|
|
526
|
+
{ modifiers: ['private'], selector: 'property' },
|
|
527
|
+
{ modifiers: ['protected'], selector: 'accessor-property' },
|
|
528
|
+
{ modifiers: ['protected'], selector: 'property' },
|
|
529
|
+
],
|
|
530
|
+
groupName: 'private-properties',
|
|
531
|
+
},
|
|
532
|
+
{
|
|
533
|
+
anyOf: [
|
|
534
|
+
{ selector: 'accessor-property' },
|
|
535
|
+
{ selector: 'property' },
|
|
536
|
+
],
|
|
537
|
+
groupName: 'public-properties',
|
|
538
|
+
},
|
|
539
|
+
// A constructor would otherwise match the `method` selector below:
|
|
540
|
+
{
|
|
541
|
+
groupName: 'constructors',
|
|
542
|
+
selector: 'constructor',
|
|
543
|
+
},
|
|
544
|
+
{
|
|
545
|
+
anyOf: [{ selector: 'get-method' }, { selector: 'set-method' }],
|
|
546
|
+
groupName: 'accessors',
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
anyOf: [
|
|
550
|
+
{ modifiers: ['private'], selector: 'function-property' },
|
|
551
|
+
{ modifiers: ['private'], selector: 'method' },
|
|
552
|
+
{ modifiers: ['protected'], selector: 'function-property' },
|
|
553
|
+
{ modifiers: ['protected'], selector: 'method' },
|
|
554
|
+
],
|
|
555
|
+
groupName: 'private-methods',
|
|
556
|
+
},
|
|
557
|
+
{
|
|
558
|
+
anyOf: [
|
|
559
|
+
{ selector: 'function-property' },
|
|
560
|
+
{ selector: 'method' },
|
|
561
|
+
],
|
|
562
|
+
groupName: 'public-methods',
|
|
563
|
+
},
|
|
564
|
+
],
|
|
565
|
+
groups: [
|
|
566
|
+
'index-signature',
|
|
567
|
+
'static-properties',
|
|
568
|
+
'static-methods',
|
|
569
|
+
'static-block',
|
|
570
|
+
'private-properties',
|
|
571
|
+
'public-properties',
|
|
572
|
+
'constructors',
|
|
573
|
+
'private-methods',
|
|
574
|
+
'accessors',
|
|
575
|
+
'public-methods',
|
|
576
|
+
'unknown',
|
|
577
|
+
],
|
|
578
|
+
},
|
|
579
|
+
],
|
|
580
|
+
// Would change the order of the arguments:
|
|
581
|
+
'perfectionist/sort-constructor-parameters': off,
|
|
582
|
+
'perfectionist/sort-decorators': warn,
|
|
583
|
+
'perfectionist/sort-enums': warn,
|
|
584
|
+
'perfectionist/sort-export-attributes': warn,
|
|
585
|
+
'perfectionist/sort-exports': warn,
|
|
586
|
+
'perfectionist/sort-heritage-clauses': warn,
|
|
587
|
+
'perfectionist/sort-import-attributes': warn,
|
|
588
|
+
'perfectionist/sort-imports': [
|
|
589
|
+
warn,
|
|
590
|
+
{
|
|
591
|
+
groups: [
|
|
592
|
+
['builtin', 'external', 'internal', 'subpath', 'tsconfig-path'],
|
|
593
|
+
'parent',
|
|
594
|
+
'sibling',
|
|
595
|
+
'index',
|
|
596
|
+
['side-effect', 'side-effect-style'],
|
|
597
|
+
'unknown',
|
|
598
|
+
],
|
|
599
|
+
newlinesBetween: 0,
|
|
600
|
+
},
|
|
601
|
+
],
|
|
602
|
+
'perfectionist/sort-interfaces': warn,
|
|
603
|
+
'perfectionist/sort-intersection-types': warn,
|
|
604
|
+
'perfectionist/sort-jsx-props': warn,
|
|
605
|
+
'perfectionist/sort-maps': warn,
|
|
606
|
+
// Replaced by `robinblomberg/sort-declarations`, which also sorts variables:
|
|
607
|
+
'perfectionist/sort-modules': off,
|
|
608
|
+
'perfectionist/sort-named-exports': warn,
|
|
609
|
+
'perfectionist/sort-named-imports': warn,
|
|
610
|
+
'perfectionist/sort-object-types': warn,
|
|
611
|
+
'perfectionist/sort-objects': warn,
|
|
612
|
+
'perfectionist/sort-sets': warn,
|
|
613
|
+
'perfectionist/sort-switch-case': warn,
|
|
614
|
+
'perfectionist/sort-union-types': warn,
|
|
615
|
+
'perfectionist/sort-variable-declarations': warn,
|
|
616
|
+
'prefer-arrow-callback': [
|
|
617
|
+
warn,
|
|
618
|
+
{ allowNamedFunctions: false, allowUnboundThis: true },
|
|
619
|
+
],
|
|
478
620
|
'prefer-const': [warn, { destructuring: 'all' }],
|
|
479
621
|
'prefer-destructuring': [off, { array: false, object: true }],
|
|
480
622
|
'prefer-named-capture-group': off,
|
|
@@ -498,6 +640,10 @@ const config = [
|
|
|
498
640
|
'require-unicode-regexp': off,
|
|
499
641
|
'require-yield': warn,
|
|
500
642
|
'rest-spread-spacing': [warn, 'never'],
|
|
643
|
+
'robinblomberg/comment-style': warn,
|
|
644
|
+
'robinblomberg/prefer-arrow-functions': warn,
|
|
645
|
+
'robinblomberg/sort-declarations': warn,
|
|
646
|
+
'robinblomberg/sort-tests': warn,
|
|
501
647
|
semi: [warn, 'always'],
|
|
502
648
|
'semi-spacing': [warn, { after: true, before: false }],
|
|
503
649
|
'semi-style': [warn, 'last'],
|
|
@@ -533,18 +679,11 @@ const config = [
|
|
|
533
679
|
'sonarjs/prefer-object-literal': warn,
|
|
534
680
|
'sonarjs/prefer-single-boolean-return': warn,
|
|
535
681
|
'sonarjs/prefer-while': warn,
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
{
|
|
539
|
-
ignoreCase: false,
|
|
540
|
-
ignoreDeclarationSort: false,
|
|
541
|
-
ignoreMemberSort: false,
|
|
542
|
-
memberSyntaxSortOrder: ['none', 'all', 'single', 'multiple'],
|
|
543
|
-
},
|
|
544
|
-
],
|
|
682
|
+
// Replaced by `perfectionist/sort-named-imports`:
|
|
683
|
+
'sort-imports': off,
|
|
545
684
|
'sort-keys': off,
|
|
546
|
-
|
|
547
|
-
'sort-vars':
|
|
685
|
+
// Replaced by `perfectionist/sort-variable-declarations`:
|
|
686
|
+
'sort-vars': off,
|
|
548
687
|
'space-before-blocks': [warn, 'always'],
|
|
549
688
|
'space-before-function-paren': [warn, 'always'],
|
|
550
689
|
'space-in-parens': [warn, 'never'],
|
|
@@ -595,8 +734,9 @@ const config = [
|
|
|
595
734
|
'unicorn/no-instanceof-array': warn,
|
|
596
735
|
'unicorn/no-invalid-remove-event-listener': warn,
|
|
597
736
|
'unicorn/no-keyword-prefix': off,
|
|
598
|
-
// Duplicated by `sonarjs/no-collapsible-if`, but with more annoying
|
|
599
|
-
// It has auto-fix however, which is sometimes wanted and
|
|
737
|
+
// Duplicated by `sonarjs/no-collapsible-if`, but with more annoying
|
|
738
|
+
// highlighting. It has auto-fix however, which is sometimes wanted and
|
|
739
|
+
// sometimes not:
|
|
600
740
|
'unicorn/no-lonely-if': off,
|
|
601
741
|
'unicorn/no-negated-condition': warn,
|
|
602
742
|
'unicorn/no-nested-ternary': off,
|
|
@@ -625,9 +765,9 @@ const config = [
|
|
|
625
765
|
'unicorn/numeric-separators-style': warn,
|
|
626
766
|
'unicorn/prefer-add-event-listener': warn,
|
|
627
767
|
'unicorn/prefer-array-find': warn,
|
|
628
|
-
'unicorn/prefer-array-flat-map': warn,
|
|
629
768
|
// Disabled due to slow performance:
|
|
630
769
|
'unicorn/prefer-array-flat': off,
|
|
770
|
+
'unicorn/prefer-array-flat-map': warn,
|
|
631
771
|
'unicorn/prefer-array-index-of': warn,
|
|
632
772
|
'unicorn/prefer-array-some': warn,
|
|
633
773
|
'unicorn/prefer-at': warn,
|
|
@@ -675,7 +815,14 @@ const config = [
|
|
|
675
815
|
// Not available in all Node.js versions or without specific settings:
|
|
676
816
|
'unicorn/prefer-top-level-await': off,
|
|
677
817
|
'unicorn/prefer-type-error': warn,
|
|
678
|
-
'unicorn/prevent-abbreviations':
|
|
818
|
+
'unicorn/prevent-abbreviations': [
|
|
819
|
+
warn,
|
|
820
|
+
{
|
|
821
|
+
checkFilenames: false,
|
|
822
|
+
// Established names, e.g. React's `props` and Storybook's `args`:
|
|
823
|
+
replacements: { args: false, props: false, ref: false, refs: false },
|
|
824
|
+
},
|
|
825
|
+
],
|
|
679
826
|
'unicorn/relative-url-style': off,
|
|
680
827
|
'unicorn/require-array-join-separator': warn,
|
|
681
828
|
'unicorn/require-number-to-fixed-digits-argument': warn,
|
|
@@ -699,6 +846,17 @@ const config = [
|
|
|
699
846
|
jsdoc: {
|
|
700
847
|
mode: 'closure',
|
|
701
848
|
},
|
|
849
|
+
// Shared by every `perfectionist` rule, and matched by `robinblomberg` rules:
|
|
850
|
+
perfectionist: {
|
|
851
|
+
ignoreCase: true,
|
|
852
|
+
locales: 'en-US',
|
|
853
|
+
order: 'asc',
|
|
854
|
+
// A comment between members starts a group that's sorted on its own, e.g.
|
|
855
|
+
// a heading like `// French:` in a list of words grouped by language:
|
|
856
|
+
partitionByComment: true,
|
|
857
|
+
specialCharacters: 'keep',
|
|
858
|
+
type: 'alphabetical',
|
|
859
|
+
},
|
|
702
860
|
react: {
|
|
703
861
|
version: 'detect',
|
|
704
862
|
},
|
|
@@ -730,11 +888,11 @@ const config = [
|
|
|
730
888
|
{
|
|
731
889
|
extendDefaults: true,
|
|
732
890
|
types: {
|
|
891
|
+
'{}': false,
|
|
733
892
|
Boolean: false,
|
|
734
893
|
Function: false,
|
|
735
894
|
Number: false,
|
|
736
895
|
Object: false,
|
|
737
|
-
'{}': false,
|
|
738
896
|
},
|
|
739
897
|
},
|
|
740
898
|
],
|
|
@@ -746,12 +904,11 @@ const config = [
|
|
|
746
904
|
// '@typescript-eslint/comma-dangle': [warn, 'always-multiline'],
|
|
747
905
|
// Definition not found (2026-09-03):
|
|
748
906
|
// '@typescript-eslint/comma-spacing': [warn, { after: true, before: false }],
|
|
907
|
+
// Allows `as const`. Disable it on a line only where TypeScript provably needs
|
|
908
|
+
// `as`:
|
|
749
909
|
'@typescript-eslint/consistent-type-assertions': [
|
|
750
|
-
|
|
751
|
-
{
|
|
752
|
-
assertionStyle: 'as',
|
|
753
|
-
objectLiteralTypeAssertions: 'never',
|
|
754
|
-
},
|
|
910
|
+
warn,
|
|
911
|
+
{ assertionStyle: 'never' },
|
|
755
912
|
],
|
|
756
913
|
'@typescript-eslint/consistent-type-definitions': [warn, 'type'],
|
|
757
914
|
'@typescript-eslint/consistent-type-imports': [
|
|
@@ -807,100 +964,21 @@ const config = [
|
|
|
807
964
|
// singleline: { delimiter: 'semi', requireLast: true },
|
|
808
965
|
// },
|
|
809
966
|
// ],
|
|
810
|
-
//
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
{
|
|
814
|
-
default: [
|
|
815
|
-
'signature',
|
|
816
|
-
'private-static-field',
|
|
817
|
-
'protected-static-field',
|
|
818
|
-
'public-static-field',
|
|
819
|
-
'private-static-method',
|
|
820
|
-
'protected-static-method',
|
|
821
|
-
'public-static-method',
|
|
822
|
-
'private-decorated-field',
|
|
823
|
-
'protected-decorated-field',
|
|
824
|
-
'public-decorated-field',
|
|
825
|
-
'private-instance-field',
|
|
826
|
-
'protected-instance-field',
|
|
827
|
-
'public-instance-field',
|
|
828
|
-
'protected-abstract-field',
|
|
829
|
-
'public-abstract-field',
|
|
830
|
-
'static-field',
|
|
831
|
-
'private-field',
|
|
832
|
-
'protected-field',
|
|
833
|
-
'public-field',
|
|
834
|
-
'instance-field',
|
|
835
|
-
'abstract-field',
|
|
836
|
-
'decorated-field',
|
|
837
|
-
'field',
|
|
838
|
-
'private-constructor',
|
|
839
|
-
'protected-constructor',
|
|
840
|
-
'public-constructor',
|
|
841
|
-
'constructor',
|
|
842
|
-
'private-decorated-method',
|
|
843
|
-
'protected-decorated-method',
|
|
844
|
-
'public-decorated-method',
|
|
845
|
-
'private-instance-method',
|
|
846
|
-
'protected-instance-method',
|
|
847
|
-
'public-instance-method',
|
|
848
|
-
'protected-abstract-method',
|
|
849
|
-
'public-abstract-method',
|
|
850
|
-
'static-method',
|
|
851
|
-
'private-method',
|
|
852
|
-
'protected-method',
|
|
853
|
-
'public-method',
|
|
854
|
-
'instance-method',
|
|
855
|
-
'abstract-method',
|
|
856
|
-
'decorated-method',
|
|
857
|
-
'method',
|
|
858
|
-
],
|
|
859
|
-
},
|
|
860
|
-
],
|
|
967
|
+
// Replaced by `perfectionist/sort-classes`, `sort-interfaces` and
|
|
968
|
+
// `sort-object-types`:
|
|
969
|
+
'@typescript-eslint/member-ordering': off,
|
|
861
970
|
'@typescript-eslint/method-signature-style': [warn, 'property'],
|
|
971
|
+
// Initialisms are written in capitals, like `JSON.parse()` and `innerHTML`:
|
|
862
972
|
'@typescript-eslint/naming-convention': [
|
|
863
|
-
|
|
864
|
-
{
|
|
865
|
-
format: ['camelCase'],
|
|
866
|
-
leadingUnderscore: 'allow',
|
|
867
|
-
selector: 'default',
|
|
868
|
-
},
|
|
869
|
-
{
|
|
870
|
-
format: ['camelCase', 'snake_case', 'PascalCase', 'UPPER_CASE'],
|
|
871
|
-
leadingUnderscore: 'allow',
|
|
872
|
-
selector: ['objectLiteralProperty'],
|
|
873
|
-
},
|
|
874
|
-
{
|
|
875
|
-
format: ['camelCase', 'PascalCase'],
|
|
876
|
-
leadingUnderscore: 'allow',
|
|
877
|
-
selector: ['function'],
|
|
878
|
-
},
|
|
879
|
-
{
|
|
880
|
-
format: ['camelCase', 'UPPER_CASE'],
|
|
881
|
-
leadingUnderscore: 'allow',
|
|
882
|
-
selector: ['objectLiteralMethod', 'typeMethod', 'variable'],
|
|
883
|
-
},
|
|
884
|
-
{
|
|
885
|
-
format: ['PascalCase'],
|
|
886
|
-
leadingUnderscore: 'allow',
|
|
887
|
-
selector: [
|
|
888
|
-
'class',
|
|
889
|
-
'enum',
|
|
890
|
-
'interface',
|
|
891
|
-
'typeAlias',
|
|
892
|
-
'typeParameter',
|
|
893
|
-
],
|
|
894
|
-
},
|
|
895
|
-
{
|
|
896
|
-
format: ['UPPER_CASE'],
|
|
897
|
-
leadingUnderscore: 'allow',
|
|
898
|
-
selector: ['enumMember'],
|
|
899
|
-
},
|
|
973
|
+
warn,
|
|
900
974
|
{
|
|
975
|
+
custom: {
|
|
976
|
+
match: false,
|
|
977
|
+
regex:
|
|
978
|
+
'(?:Api|Ascii|Css|Csv|Dom|Html|Http|Iso|Json|Pdf|Sql|Svg|Uri|Url|Utf|Uuid|Xml)(?![a-z])',
|
|
979
|
+
},
|
|
901
980
|
format: null,
|
|
902
|
-
|
|
903
|
-
selector: ['parameter', 'property'],
|
|
981
|
+
selector: 'default',
|
|
904
982
|
},
|
|
905
983
|
],
|
|
906
984
|
'@typescript-eslint/no-array-constructor': warn,
|
|
@@ -1000,8 +1078,8 @@ const config = [
|
|
|
1000
1078
|
'@typescript-eslint/prefer-nullish-coalescing': off,
|
|
1001
1079
|
'@typescript-eslint/prefer-optional-chain': warn,
|
|
1002
1080
|
'@typescript-eslint/prefer-readonly': warn,
|
|
1003
|
-
// Disabled due to error:
|
|
1004
|
-
//
|
|
1081
|
+
// Disabled due to the error "Non-null Assertion Failed: Expected to find a
|
|
1082
|
+
// property "XXX" for the type.":
|
|
1005
1083
|
'@typescript-eslint/prefer-readonly-parameter-types': off,
|
|
1006
1084
|
'@typescript-eslint/prefer-reduce-type-parameter': warn,
|
|
1007
1085
|
'@typescript-eslint/prefer-regexp-exec': off,
|
|
@@ -1106,8 +1184,19 @@ const config = [
|
|
|
1106
1184
|
],
|
|
1107
1185
|
rules: {
|
|
1108
1186
|
'import/no-anonymous-default-export': off,
|
|
1109
|
-
'
|
|
1187
|
+
'no-restricted-syntax': [
|
|
1188
|
+
warn,
|
|
1189
|
+
...RESTRICTED_SYNTAX,
|
|
1190
|
+
{
|
|
1191
|
+
message:
|
|
1192
|
+
'Only add a `play` function to a story when it was explicitly asked for.',
|
|
1193
|
+
selector: "Property[key.name='play']",
|
|
1194
|
+
},
|
|
1195
|
+
],
|
|
1110
1196
|
'react-hooks/rules-of-hooks': off,
|
|
1197
|
+
'react/no-multi-comp': off,
|
|
1198
|
+
// Storybook lists stories in the order they're exported:
|
|
1199
|
+
'robinblomberg/sort-declarations': off,
|
|
1111
1200
|
'storybook/await-interactions': error,
|
|
1112
1201
|
'storybook/context-in-play-function': error,
|
|
1113
1202
|
'storybook/default-exports': error,
|
|
@@ -1146,6 +1235,22 @@ const config = [
|
|
|
1146
1235
|
'no-empty-character-class': off,
|
|
1147
1236
|
'no-magic-numbers': off,
|
|
1148
1237
|
'no-only-tests/no-only-tests': warn,
|
|
1238
|
+
'no-restricted-syntax': [
|
|
1239
|
+
warn,
|
|
1240
|
+
...RESTRICTED_SYNTAX,
|
|
1241
|
+
{
|
|
1242
|
+
message:
|
|
1243
|
+
'Assert the exact, full result instead of with a partial or loose matcher.',
|
|
1244
|
+
selector:
|
|
1245
|
+
'CallExpression > MemberExpression.callee[property.name=/^(?:toBeDefined|toBeFalsy|toBeTruthy|toContain|toContainEqual|toHaveProperty|toMatch|toMatchObject)$/]',
|
|
1246
|
+
},
|
|
1247
|
+
{
|
|
1248
|
+
message:
|
|
1249
|
+
'Assert the exact, full result instead of with a partial or loose matcher.',
|
|
1250
|
+
selector:
|
|
1251
|
+
"MemberExpression[object.name='expect'][property.name=/^(?:any|anything|arrayContaining|objectContaining|stringContaining|stringMatching)$/]",
|
|
1252
|
+
},
|
|
1253
|
+
],
|
|
1149
1254
|
'no-sparse-arrays': off,
|
|
1150
1255
|
'sonarjs/no-duplicate-string': off,
|
|
1151
1256
|
'sort-keys': off,
|
|
@@ -1159,10 +1264,10 @@ const config = [
|
|
|
1159
1264
|
{
|
|
1160
1265
|
files: ['**/*.jsx', '**/*.tsx'],
|
|
1161
1266
|
plugins: {
|
|
1267
|
+
'jsx-a11y': jsxA11yPlugin,
|
|
1162
1268
|
react: reactPlugin,
|
|
1163
1269
|
'react-hooks': /** @type {any} */ (reactHooksPlugin),
|
|
1164
1270
|
'react-refresh': reactRefreshPlugin,
|
|
1165
|
-
'jsx-a11y': jsxA11yPlugin,
|
|
1166
1271
|
},
|
|
1167
1272
|
rules: {
|
|
1168
1273
|
'jsx-a11y/accessible-emoji': warn,
|
|
@@ -1247,6 +1352,12 @@ const config = [
|
|
|
1247
1352
|
'jsx-a11y/role-supports-aria-props': warn,
|
|
1248
1353
|
'jsx-a11y/scope': warn,
|
|
1249
1354
|
'jsx-a11y/tabindex-no-positive': warn,
|
|
1355
|
+
'react-hooks/exhaustive-deps': warn,
|
|
1356
|
+
'react-hooks/rules-of-hooks': error,
|
|
1357
|
+
'react-refresh/only-export-components': [
|
|
1358
|
+
warn,
|
|
1359
|
+
{ allowConstantExport: true },
|
|
1360
|
+
],
|
|
1250
1361
|
'react/boolean-prop-naming': warn,
|
|
1251
1362
|
'react/button-has-type': warn,
|
|
1252
1363
|
'react/default-props-match-prop-types': warn,
|
|
@@ -1307,8 +1418,11 @@ const config = [
|
|
|
1307
1418
|
'react/jsx-pascal-case': warn,
|
|
1308
1419
|
'react/jsx-props-no-multi-spaces': warn,
|
|
1309
1420
|
'react/jsx-props-no-spreading': off,
|
|
1310
|
-
|
|
1311
|
-
|
|
1421
|
+
// Replaced by `perfectionist/sort-jsx-props`:
|
|
1422
|
+
'react/jsx-sort-props': off,
|
|
1423
|
+
/**
|
|
1424
|
+
* @deprecated
|
|
1425
|
+
*/
|
|
1312
1426
|
'react/jsx-space-before-closing': off,
|
|
1313
1427
|
'react/jsx-tag-spacing': [
|
|
1314
1428
|
warn,
|
|
@@ -1345,7 +1459,7 @@ const config = [
|
|
|
1345
1459
|
'react/no-direct-mutation-state': warn,
|
|
1346
1460
|
'react/no-find-dom-node': warn,
|
|
1347
1461
|
'react/no-is-mounted': warn,
|
|
1348
|
-
'react/no-multi-comp':
|
|
1462
|
+
'react/no-multi-comp': [warn, { ignoreStateless: false }],
|
|
1349
1463
|
'react/no-redundant-should-component-update': warn,
|
|
1350
1464
|
'react/no-render-return-value': warn,
|
|
1351
1465
|
'react/no-set-state': off,
|
|
@@ -1417,12 +1531,6 @@ const config = [
|
|
|
1417
1531
|
'react/static-property-placement': warn,
|
|
1418
1532
|
'react/style-prop-object': warn,
|
|
1419
1533
|
'react/void-dom-elements-no-children': warn,
|
|
1420
|
-
'react-hooks/exhaustive-deps': warn,
|
|
1421
|
-
'react-hooks/rules-of-hooks': error,
|
|
1422
|
-
'react-refresh/only-export-components': [
|
|
1423
|
-
warn,
|
|
1424
|
-
{ allowConstantExport: true },
|
|
1425
|
-
],
|
|
1426
1534
|
},
|
|
1427
1535
|
},
|
|
1428
1536
|
{
|
|
@@ -1463,7 +1571,8 @@ const config = [
|
|
|
1463
1571
|
'jsdoc/no-bad-blocks': warn,
|
|
1464
1572
|
'jsdoc/no-defaults': warn,
|
|
1465
1573
|
'jsdoc/no-types': off,
|
|
1466
|
-
// Disabled due to false positives when referring to a generic type from inside
|
|
1574
|
+
// Disabled due to false positives when referring to a generic type from inside
|
|
1575
|
+
// its function:
|
|
1467
1576
|
'jsdoc/no-undefined-types': [
|
|
1468
1577
|
off,
|
|
1469
1578
|
{
|