@@ -31,6 +31,7 @@ const restrictNamedDeclarations = {
31
31
export default tseslint . config (
32
32
// register all of the plugins up-front
33
33
{
34
+ name : 'register-all-plugins' ,
34
35
// note - intentionally uses computed syntax to make it easy to sort the keys
35
36
/* eslint-disable no-useless-computed-key */
36
37
plugins : {
@@ -85,11 +86,12 @@ export default tseslint.config(
85
86
// see the file header in eslint-base.test.js for more info
86
87
'packages/rule-tester/tests/eslint-base/' ,
87
88
] ,
89
+ name : 'global-ignores' ,
88
90
} ,
89
91
90
92
// extends ...
91
93
eslintCommentsPlugin . recommended ,
92
- eslint . configs . recommended ,
94
+ { name : ` ${ eslint . meta . name } /recommended` , ... eslint . configs . recommended } ,
93
95
tseslint . configs . strictTypeChecked ,
94
96
tseslint . configs . stylisticTypeChecked ,
95
97
jsdocPlugin . configs [ 'flat/recommended-typescript-error' ] ,
@@ -108,6 +110,7 @@ export default tseslint.config(
108
110
} ,
109
111
} ,
110
112
linterOptions : { reportUnusedDisableDirectives : 'error' } ,
113
+ name : 'base-config' ,
111
114
rules : {
112
115
//
113
116
// our plugin :D
@@ -345,6 +348,7 @@ export default tseslint.config(
345
348
{
346
349
extends : [ tseslint . configs . disableTypeChecked ] ,
347
350
files : [ '**/*.js' ] ,
351
+ name : 'js-files-only' ,
348
352
rules : {
349
353
// turn off other type-aware rules
350
354
'@typescript-eslint/internal/no-poorly-typed-ts-props' : 'off' ,
@@ -361,7 +365,7 @@ export default tseslint.config(
361
365
// test file specific configuration
362
366
{
363
367
files : [
364
- 'packages/*/tests/**/*.{ts,tsx,cts,mts} ' ,
368
+ 'packages/*/tests/**/*.?(m|c)ts?(x) ' ,
365
369
'packages/integration-tests/tools/**/*.ts' ,
366
370
] ,
367
371
...vitestPlugin . configs . env ,
@@ -406,11 +410,11 @@ export default tseslint.config(
406
410
// plugin rule tests
407
411
{
408
412
files : [
409
- 'packages/eslint-plugin-internal/tests/rules/**/*.test.{ts,tsx,cts,mts}' ,
410
- 'packages/eslint-plugin-tslint/tests/rules/**/*.test.{ts,tsx,cts,mts}' ,
411
- 'packages/eslint-plugin/tests/rules/**/*.test.{ts,tsx,cts,mts}' ,
412
- 'packages/eslint-plugin/tests/eslint-rules/**/*.test.{ts,tsx,cts,mts}' ,
413
+ 'packages/eslint-plugin-internal/tests/rules/**/*.test.?(m|c)ts?(x)' ,
414
+ 'packages/eslint-plugin/tests/rules/**/*.test.?(m|c)ts?(x)' ,
415
+ 'packages/eslint-plugin/tests/eslint-rules/**/*.test.?(m|c)ts?(x)' ,
413
416
] ,
417
+ name : 'eslint-plugin-and-eslint-plugin-internal/test-files/rules' ,
414
418
rules : {
415
419
'@typescript-eslint/internal/plugin-test-formatting' : 'error' ,
416
420
} ,
@@ -421,23 +425,25 @@ export default tseslint.config(
421
425
//
422
426
{
423
427
files : [
424
- '**/tools/**/*.{ts,tsx,cts,mts} ' ,
425
- '**/tests/**/*.{ts,tsx,cts,mts} ' ,
426
- 'packages/integration-tests/**/*.{ts,tsx,cts,mts} ' ,
428
+ '**/tools/**/*.?(m|c)ts?(x) ' ,
429
+ '**/tests/**/*.?(m|c)ts?(x) ' ,
430
+ 'packages/integration-tests/**/*.?(m|c)ts?(x) ' ,
427
431
] ,
432
+ name : 'tools-and-test-files' ,
428
433
rules : {
429
434
// allow console logs in tools and tests
430
435
'no-console' : 'off' ,
431
436
} ,
432
437
} ,
433
438
{
434
439
files : [
435
- 'eslint.config.{js,cjs, mjs} ' ,
440
+ 'eslint.config.mjs' ,
436
441
'knip.ts' ,
437
442
'packages/*/src/index.ts' ,
438
443
'vitest.config.mts' ,
439
444
'packages/*/vitest.config.mts' ,
440
445
] ,
446
+ name : 'no-default-export' ,
441
447
rules : {
442
448
// requirement
443
449
'import/no-default-export' : 'off' ,
@@ -451,24 +457,23 @@ export default tseslint.config(
451
457
{
452
458
extends : [ eslintPluginPlugin . configs [ 'flat/recommended' ] ] ,
453
459
files : [
454
- 'packages/eslint-plugin-internal/**/*.{ts,tsx,cts,mts}' ,
455
- 'packages/eslint-plugin-tslint/**/*.{ts,tsx,cts,mts}' ,
456
- 'packages/eslint-plugin/**/*.{ts,tsx,cts,mts}' ,
460
+ 'packages/eslint-plugin-internal/**/*.?(m|c)ts?(x)' ,
461
+ 'packages/eslint-plugin/**/*.?(m|c)ts?(x)' ,
457
462
] ,
463
+ name : 'eslint-plugin-and-eslint-plugin-internal' ,
458
464
459
465
rules : {
460
466
'@typescript-eslint/internal/no-typescript-estree-import' : 'error' ,
461
467
} ,
462
468
} ,
463
469
{
464
470
files : [
465
- 'packages/eslint-plugin-internal/src/rules/**/*.{ts,tsx,cts,mts}' ,
466
- 'packages/eslint-plugin-tslint/src/rules/**/*.{ts,tsx,cts,mts}' ,
467
- 'packages/eslint-plugin/src/configs/**/*.{ts,tsx,cts,mts}' ,
468
- 'packages/typescript-eslint/src/configs/**/*.{ts,tsx,cts,mts}' ,
469
- 'packages/core/src/configs/**/*.{ts,tsx,cts,mts}' ,
470
- 'packages/eslint-plugin/src/rules/**/*.{ts,tsx,cts,mts}' ,
471
+ 'packages/eslint-plugin-internal/src/rules/**/*.?(m|c)ts?(x)' ,
472
+ 'packages/eslint-plugin/src/configs/**/*.?(m|c)ts?(x)' ,
473
+ 'packages/typescript-eslint/src/configs/**/*.?(m|c)ts?(x)' ,
474
+ 'packages/eslint-plugin/src/rules/**/*.?(m|c)ts?(x)' ,
471
475
] ,
476
+ name : 'configs-and-rules' ,
472
477
rules : {
473
478
'eslint-plugin/no-property-in-node' : [
474
479
'error' ,
@@ -500,6 +505,7 @@ export default tseslint.config(
500
505
} ,
501
506
{
502
507
files : [ 'packages/eslint-plugin/src/rules/index.ts' ] ,
508
+ name : 'eslint-plugin/source-files/rules-index-file' ,
503
509
rules : {
504
510
// enforce alphabetical ordering
505
511
'import/order' : [ 'error' , { alphabetize : { order : 'asc' } } ] ,
@@ -513,10 +519,10 @@ export default tseslint.config(
513
519
514
520
{
515
521
files : [
516
- 'packages/scope-manager/src/lib/*.{ts,tsx,cts,mts}' ,
517
- 'packages/eslint-plugin/src/configs/*.{ts,tsx,cts,mts}' ,
518
- 'packages/core/src/configs/*.{ts,tsx,cts,mts}' ,
522
+ 'packages/scope-manager/src/lib/*.?(m|c)ts?(x)' ,
523
+ 'packages/eslint-plugin/src/configs/*.?(m|c)ts?(x)' ,
519
524
] ,
525
+ name : 'generated-files' ,
520
526
rules : {
521
527
'@typescript-eslint/internal/no-poorly-typed-ts-props' : 'off' ,
522
528
'@typescript-eslint/internal/no-typescript-default-import' : 'off' ,
@@ -529,15 +535,27 @@ export default tseslint.config(
529
535
//
530
536
531
537
{
532
- files : [ 'packages/ast-spec/src/**/*.{ts,tsx,cts,mts}' ] ,
538
+ files : [ 'packages/ast-spec/src/**/*.?(m|c)ts?(x)' ] ,
539
+ name : 'ast-spec/source-files' ,
533
540
rules : {
534
541
// disallow ALL unused vars
535
542
'@typescript-eslint/no-unused-vars' : [ 'error' , { caughtErrors : 'all' } ] ,
536
543
'@typescript-eslint/sort-type-constituents' : 'error' ,
544
+
545
+ 'perfectionist/sort-interfaces' : [
546
+ 'error' ,
547
+ {
548
+ customGroups : {
549
+ first : [ 'type' ] ,
550
+ } ,
551
+ groups : [ 'first' , 'unknown' ] ,
552
+ } ,
553
+ ] ,
537
554
} ,
538
555
} ,
539
556
{
540
- files : [ 'packages/ast-spec/**/*.{ts,tsx,cts,mts}' ] ,
557
+ files : [ 'packages/ast-spec/**/*.?(m|c)ts?(x)' ] ,
558
+ name : 'ast-spec' ,
541
559
rules : {
542
560
'no-restricted-imports' : [
543
561
'error' ,
@@ -559,12 +577,18 @@ export default tseslint.config(
559
577
jsxA11yPlugin . flatConfigs . recommended ,
560
578
// https://github.com/facebook/react/pull/30774
561
579
// @ts -expect-error -- Temporary types incompatibility pending flat config support
562
- reactPlugin . configs . flat . recommended ,
563
- // https://github.com/facebook/react/pull/30774
564
- // @ts -expect-error -- Temporary types incompatibility pending flat config support
565
- fixupConfigRules ( compat . config ( reactHooksPlugin . configs . recommended ) ) ,
580
+ { name : 'react/recommended' , ...reactPlugin . configs . flat . recommended } ,
581
+ fixupConfigRules ( [
582
+ {
583
+ name : 'react-hooks/recommended' ,
584
+ // https://github.com/facebook/react/pull/30774
585
+ // @ts -expect-error -- Temporary types incompatibility pending flat config support
586
+ ...compat . config ( reactHooksPlugin . configs . recommended ) [ 0 ] ,
587
+ } ,
588
+ ] ) ,
566
589
] ,
567
- files : [ 'packages/website/**/*.{ts,tsx,mts,cts,js,jsx}' ] ,
590
+ files : [ 'packages/website/**/*.?(c|m)[tj]s?(x)' ] ,
591
+ name : 'website' ,
568
592
rules : {
569
593
'@typescript-eslint/internal/prefer-ast-types-enum' : 'off' ,
570
594
'import/no-default-export' : 'off' ,
@@ -580,18 +604,17 @@ export default tseslint.config(
580
604
} ,
581
605
} ,
582
606
{
583
- files : [ 'packages/website/src/**/*.{ts,tsx,cts,mts}' ] ,
607
+ files : [ 'packages/website/src/**/*.?(m|c)ts?(x)' ] ,
608
+ name : 'website/source-files' ,
584
609
rules : {
585
610
'import/no-default-export' : 'off' ,
586
611
// allow console logs in the website to help with debugging things in production
587
612
'no-console' : 'off' ,
588
613
} ,
589
614
} ,
590
615
{
591
- files : [
592
- 'packages/website-eslint/src/mock/**/*.js' ,
593
- '**/*.d.{ts,tsx,cts,mts}' ,
594
- ] ,
616
+ files : [ 'packages/website-eslint/src/mock/**/*.js' , '**/*.d.?(m|c)ts?(x)' ] ,
617
+ name : 'website/source-files/mocks-and-declaration-files' ,
595
618
rules : {
596
619
// mocks and declaration files have to mirror their original package
597
620
'import/no-default-export' : 'off' ,
@@ -604,6 +627,7 @@ export default tseslint.config(
604
627
'packages/eslint-plugin/src/configs/flat/*' ,
605
628
'packages/scope-manager/src/configs/*' ,
606
629
] ,
630
+ name : 'all-files' ,
607
631
rules : {
608
632
'@typescript-eslint/sort-type-constituents' : 'off' ,
609
633
'perfectionist/sort-classes' : 'error' ,
@@ -618,25 +642,12 @@ export default tseslint.config(
618
642
] ,
619
643
} ,
620
644
} ,
621
- {
622
- files : [ 'packages/ast-spec/src/**/*.ts' ] ,
623
- rules : {
624
- 'perfectionist/sort-interfaces' : [
625
- 'error' ,
626
- {
627
- customGroups : {
628
- first : [ 'type' ] ,
629
- } ,
630
- groups : [ 'first' , 'unknown' ] ,
631
- } ,
632
- ] ,
633
- } ,
634
- } ,
635
645
{
636
646
files : [
637
647
'packages/eslint-plugin/src/rules/*.ts' ,
638
648
'packages/eslint-plugin-internal/src/rules/*.ts' ,
639
649
] ,
650
+ name : 'eslint-plugin-and-eslint-plugin-internal/source-files/rules' ,
640
651
rules : {
641
652
'perfectionist/sort-objects' : [
642
653
'error' ,
@@ -654,6 +665,7 @@ export default tseslint.config(
654
665
} ,
655
666
{
656
667
files : [ 'packages/eslint-plugin/tests/rules/*.test.ts' ] ,
668
+ name : 'eslint-plugin-rules-test-files' ,
657
669
rules : {
658
670
'perfectionist/sort-objects' : [
659
671
'error' ,
@@ -666,6 +678,7 @@ export default tseslint.config(
666
678
} ,
667
679
{
668
680
files : [ 'packages/typescript-estree/src/**/*.ts' ] ,
681
+ name : 'typescript-estree/source-files' ,
669
682
rules : {
670
683
'perfectionist/sort-objects' : [
671
684
'error' ,
0 commit comments