@tb-dev/eslint-config 5.1.0 → 5.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.cjs +233 -145
  2. package/dist/index.js +233 -145
  3. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -342,10 +342,13 @@ function javascript(options) {
342
342
  },
343
343
  rules: {
344
344
  "accessor-pairs": ["error", { enforceForClassMembers: true, setWithoutGet: true }],
345
- "array-callback-return": ["error", {
346
- checkForEach: false,
347
- allowVoid: true
348
- }],
345
+ "array-callback-return": [
346
+ "error",
347
+ {
348
+ checkForEach: false,
349
+ allowVoid: true
350
+ }
351
+ ],
349
352
  "block-scoped-var": "error",
350
353
  "consistent-this": ["error", "self"],
351
354
  "default-case-last": "error",
@@ -439,10 +442,13 @@ function javascript(options) {
439
442
  "object-shorthand": ["error", "always"],
440
443
  "operator-assignment": ["error", "always"],
441
444
  "prefer-arrow-callback": "error",
442
- "prefer-const": ["error", {
443
- destructuring: "all",
444
- ignoreReadBeforeAssign: true
445
- }],
445
+ "prefer-const": [
446
+ "error",
447
+ {
448
+ destructuring: "all",
449
+ ignoreReadBeforeAssign: true
450
+ }
451
+ ],
446
452
  "prefer-destructuring": "off",
447
453
  "prefer-exponentiation-operator": "error",
448
454
  "prefer-object-has-own": "error",
@@ -452,13 +458,16 @@ function javascript(options) {
452
458
  "prefer-spread": "error",
453
459
  "prefer-template": "error",
454
460
  "require-atomic-updates": ["error", { allowProperties: true }],
455
- "sort-imports": ["error", {
456
- allowSeparatedGroups: false,
457
- ignoreCase: false,
458
- ignoreDeclarationSort: true,
459
- ignoreMemberSort: false,
460
- memberSyntaxSortOrder: ["none", "all", "multiple", "single"]
461
- }],
461
+ "sort-imports": [
462
+ "error",
463
+ {
464
+ allowSeparatedGroups: false,
465
+ ignoreCase: false,
466
+ ignoreDeclarationSort: true,
467
+ ignoreMemberSort: false,
468
+ memberSyntaxSortOrder: ["none", "all", "multiple", "single"]
469
+ }
470
+ ],
462
471
  "symbol-description": "off",
463
472
  "use-isnan": "error",
464
473
  "valid-typeof": "error",
@@ -480,41 +489,53 @@ async function typescript(options) {
480
489
  "no-array-constructor": "off",
481
490
  "@typescript-eslint/no-array-constructor": "error",
482
491
  "@typescript-eslint/array-type": ["error", { default: "array" }],
483
- "@typescript-eslint/ban-ts-comment": ["error", {
484
- "ts-expect-error": "allow-with-description",
485
- "ts-ignore": true,
486
- "ts-nocheck": true,
487
- "ts-check": false,
488
- minimumDescriptionLength: 3
489
- }],
492
+ "@typescript-eslint/ban-ts-comment": [
493
+ "error",
494
+ {
495
+ "ts-expect-error": "allow-with-description",
496
+ "ts-ignore": true,
497
+ "ts-nocheck": true,
498
+ "ts-check": false,
499
+ minimumDescriptionLength: 3
500
+ }
501
+ ],
490
502
  "@typescript-eslint/class-literal-property-style": ["error", "fields"],
491
503
  "class-methods-use-this": "off",
492
- "@typescript-eslint/class-methods-use-this": ["error", {
493
- ignoreOverrideMethods: true,
494
- ignoreClassesThatImplementAnInterface: "public-fields"
495
- }],
504
+ "@typescript-eslint/class-methods-use-this": [
505
+ "error",
506
+ {
507
+ ignoreOverrideMethods: true,
508
+ ignoreClassesThatImplementAnInterface: "public-fields"
509
+ }
510
+ ],
496
511
  "@typescript-eslint/consistent-generic-constructors": ["error", "constructor"],
497
512
  "@typescript-eslint/consistent-indexed-object-style": ["error", "record"],
498
513
  "consistent-return": "off",
499
514
  "@typescript-eslint/consistent-return": "error",
500
- "@typescript-eslint/consistent-type-assertions": ["error", {
501
- assertionStyle: "as",
502
- objectLiteralTypeAssertions: "allow-as-parameter"
503
- }],
515
+ "@typescript-eslint/consistent-type-assertions": [
516
+ "error",
517
+ {
518
+ assertionStyle: "as",
519
+ objectLiteralTypeAssertions: "allow-as-parameter"
520
+ }
521
+ ],
504
522
  "@typescript-eslint/consistent-type-definitions": ["error", "interface"],
505
523
  "dot-notation": "off",
506
524
  "@typescript-eslint/dot-notation": ["error", { allowKeywords: true }],
507
525
  "@typescript-eslint/explicit-function-return-type": "off",
508
- "@typescript-eslint/explicit-member-accessibility": ["error", {
509
- accessibility: "explicit",
510
- overrides: {
511
- accessors: "no-public",
512
- constructors: "no-public",
513
- methods: "explicit",
514
- properties: "explicit",
515
- parameterProperties: "explicit"
526
+ "@typescript-eslint/explicit-member-accessibility": [
527
+ "error",
528
+ {
529
+ accessibility: "explicit",
530
+ overrides: {
531
+ accessors: "no-public",
532
+ constructors: "no-public",
533
+ methods: "explicit",
534
+ properties: "explicit",
535
+ parameterProperties: "explicit"
536
+ }
516
537
  }
517
- }],
538
+ ],
518
539
  "@typescript-eslint/explicit-module-boundary-types": "off",
519
540
  "@typescript-eslint/method-signature-style": ["error", "property"],
520
541
  camelcase: "off",
@@ -526,10 +547,14 @@ async function typescript(options) {
526
547
  leadingUnderscore: "allow"
527
548
  },
528
549
  {
529
- selector: ["classicAccessor", "classMethod", "function", "parameter", "parameterProperty"],
550
+ selector: ["classicAccessor", "classMethod", "parameter", "parameterProperty"],
530
551
  format: ["strictCamelCase"],
531
552
  leadingUnderscore: "allow"
532
553
  },
554
+ {
555
+ selector: ["function"],
556
+ format: ["strictCamelCase", "StrictPascalCase"]
557
+ },
533
558
  {
534
559
  selector: ["class", "enum", "enumMember", "interface", "typeAlias", "typeParameter"],
535
560
  format: ["StrictPascalCase"]
@@ -538,52 +563,67 @@ async function typescript(options) {
538
563
  "@typescript-eslint/no-array-delete": "error",
539
564
  "@typescript-eslint/no-base-to-string": "error",
540
565
  "@typescript-eslint/no-confusing-non-null-assertion": "error",
541
- "@typescript-eslint/no-confusing-void-expression": ["error", {
542
- ignoreArrowShorthand: true,
543
- ignoreVoidOperator: true
544
- }],
566
+ "@typescript-eslint/no-confusing-void-expression": [
567
+ "error",
568
+ {
569
+ ignoreArrowShorthand: true,
570
+ ignoreVoidOperator: true
571
+ }
572
+ ],
545
573
  "@typescript-eslint/no-duplicate-enum-values": "error",
546
574
  "@typescript-eslint/no-duplicate-type-constituents": "error",
547
575
  "@typescript-eslint/no-dynamic-delete": "error",
548
576
  "no-empty-function": "off",
549
577
  "@typescript-eslint/no-empty-function": "error",
550
- "@typescript-eslint/no-empty-object-type": ["error", {
551
- allowInterfaces: "never",
552
- allowObjectTypes: "never"
553
- }],
578
+ "@typescript-eslint/no-empty-object-type": [
579
+ "error",
580
+ {
581
+ allowInterfaces: "never",
582
+ allowObjectTypes: "never"
583
+ }
584
+ ],
554
585
  "@typescript-eslint/no-explicit-any": ["error", { fixToUnknown: true }],
555
586
  "@typescript-eslint/no-extra-non-null-assertion": "error",
556
587
  "@typescript-eslint/no-extraneous-class": "error",
557
- "@typescript-eslint/no-floating-promises": ["error", {
558
- allowForKnownSafePromises: options.knownSafePromises ?? [],
559
- checkThenables: false,
560
- ignoreIIFE: true,
561
- ignoreVoid: true
562
- }],
588
+ "@typescript-eslint/no-floating-promises": [
589
+ "error",
590
+ {
591
+ allowForKnownSafePromises: options.knownSafePromises ?? [],
592
+ checkThenables: false,
593
+ ignoreIIFE: true,
594
+ ignoreVoid: true
595
+ }
596
+ ],
563
597
  "@typescript-eslint/no-for-in-array": "error",
564
598
  "no-implied-eval": "off",
565
599
  "@typescript-eslint/no-implied-eval": "error",
566
600
  "@typescript-eslint/no-import-type-side-effects": "error",
567
601
  "@typescript-eslint/no-inferrable-types": "error",
568
- "@typescript-eslint/no-invalid-void-type": ["error", {
569
- allowInGenericTypeArguments: true,
570
- allowAsThisParameter: true
571
- }],
602
+ "@typescript-eslint/no-invalid-void-type": [
603
+ "error",
604
+ {
605
+ allowInGenericTypeArguments: true,
606
+ allowAsThisParameter: true
607
+ }
608
+ ],
572
609
  "no-loop-func": "off",
573
610
  "@typescript-eslint/no-loop-func": "error",
574
611
  "@typescript-eslint/no-meaningless-void-operator": "error",
575
612
  "@typescript-eslint/no-misused-new": "error",
576
- "@typescript-eslint/no-misused-promises": ["error", {
577
- checksConditionals: true,
578
- checksSpreads: true,
579
- checksVoidReturn: {
580
- arguments: true,
581
- attributes: true,
582
- properties: true,
583
- returns: true,
584
- variables: true
613
+ "@typescript-eslint/no-misused-promises": [
614
+ "error",
615
+ {
616
+ checksConditionals: true,
617
+ checksSpreads: true,
618
+ checksVoidReturn: {
619
+ arguments: true,
620
+ attributes: true,
621
+ properties: true,
622
+ returns: true,
623
+ variables: true
624
+ }
585
625
  }
586
- }],
626
+ ],
587
627
  "@typescript-eslint/no-mixed-enums": "error",
588
628
  "@typescript-eslint/no-namespace": "error",
589
629
  "@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error",
@@ -594,10 +634,13 @@ async function typescript(options) {
594
634
  "no-shadow": "off",
595
635
  "@typescript-eslint/no-shadow": "error",
596
636
  "@typescript-eslint/no-this-alias": "error",
597
- "@typescript-eslint/no-unnecessary-boolean-literal-compare": ["error", {
598
- allowComparingNullableBooleansToTrue: false,
599
- allowComparingNullableBooleansToFalse: true
600
- }],
637
+ "@typescript-eslint/no-unnecessary-boolean-literal-compare": [
638
+ "error",
639
+ {
640
+ allowComparingNullableBooleansToTrue: false,
641
+ allowComparingNullableBooleansToFalse: true
642
+ }
643
+ ],
601
644
  "@typescript-eslint/no-unnecessary-condition": "error",
602
645
  "@typescript-eslint/no-unnecessary-parameter-property-assignment": "error",
603
646
  "@typescript-eslint/no-unnecessary-qualifier": "error",
@@ -617,21 +660,27 @@ async function typescript(options) {
617
660
  "no-unused-expressions": "off",
618
661
  "@typescript-eslint/no-unused-expressions": ["error", { allowTaggedTemplates: true }],
619
662
  "no-use-before-define": "off",
620
- "@typescript-eslint/no-use-before-define": ["error", {
621
- functions: false,
622
- enums: true,
623
- typedefs: false
624
- }],
663
+ "@typescript-eslint/no-use-before-define": [
664
+ "error",
665
+ {
666
+ functions: false,
667
+ enums: true,
668
+ typedefs: false
669
+ }
670
+ ],
625
671
  "no-useless-constructor": "off",
626
672
  "@typescript-eslint/no-useless-constructor": "error",
627
673
  "@typescript-eslint/no-useless-empty-export": "error",
628
674
  "@typescript-eslint/no-wrapper-object-types": "error",
629
675
  "@typescript-eslint/non-nullable-type-assertion-style": "error",
630
676
  "no-throw-literal": "off",
631
- "@typescript-eslint/only-throw-error": ["error", {
632
- allowThrowingAny: false,
633
- allowThrowingUnknown: false
634
- }],
677
+ "@typescript-eslint/only-throw-error": [
678
+ "error",
679
+ {
680
+ allowThrowingAny: false,
681
+ allowThrowingUnknown: false
682
+ }
683
+ ],
635
684
  "@typescript-eslint/prefer-as-const": "error",
636
685
  "@typescript-eslint/prefer-enum-initializers": "error",
637
686
  "@typescript-eslint/prefer-find": "error",
@@ -639,17 +688,20 @@ async function typescript(options) {
639
688
  "@typescript-eslint/prefer-function-type": "error",
640
689
  "@typescript-eslint/prefer-includes": "error",
641
690
  "@typescript-eslint/prefer-literal-enum-member": "error",
642
- "@typescript-eslint/prefer-nullish-coalescing": ["error", {
643
- ignoreTernaryTests: false,
644
- ignoreConditionalTests: false,
645
- ignoreMixedLogicalExpressions: false,
646
- ignorePrimitives: {
647
- bigint: false,
648
- boolean: false,
649
- number: false,
650
- string: false
691
+ "@typescript-eslint/prefer-nullish-coalescing": [
692
+ "error",
693
+ {
694
+ ignoreTernaryTests: false,
695
+ ignoreConditionalTests: false,
696
+ ignoreMixedLogicalExpressions: false,
697
+ ignorePrimitives: {
698
+ bigint: false,
699
+ boolean: false,
700
+ number: false,
701
+ string: false
702
+ }
651
703
  }
652
- }],
704
+ ],
653
705
  "@typescript-eslint/prefer-optional-chain": "error",
654
706
  "prefer-promise-reject-errors": "off",
655
707
  "@typescript-eslint/prefer-promise-reject-errors": "error",
@@ -668,7 +720,10 @@ async function typescript(options) {
668
720
  "no-return-await": "off",
669
721
  "@typescript-eslint/return-await": ["error", "in-try-catch"],
670
722
  "@typescript-eslint/strict-boolean-expressions": "off",
671
- "@typescript-eslint/switch-exhaustiveness-check": ["error", { requireDefaultForNonUnion: true }],
723
+ "@typescript-eslint/switch-exhaustiveness-check": [
724
+ "error",
725
+ { requireDefaultForNonUnion: true }
726
+ ],
672
727
  "@typescript-eslint/unbound-method": "error",
673
728
  "@typescript-eslint/unified-signatures": ["error", { ignoreDifferentlyNamedParameters: true }],
674
729
  "@typescript-eslint/use-unknown-in-catch-callback-variable": "error",
@@ -698,61 +753,94 @@ async function perfectionist(options) {
698
753
  return {
699
754
  plugins: { perfectionist: plugin },
700
755
  rules: {
701
- "perfectionist/sort-array-includes": ["error", {
702
- type: "natural",
703
- order: "asc",
704
- ignoreCase: true,
705
- groupKind: "literals-first"
706
- }],
707
- "perfectionist/sort-enums": ["error", {
708
- type: "natural",
709
- order: "asc"
710
- }],
711
- "perfectionist/sort-exports": ["error", {
712
- type: "line-length",
713
- order: "asc",
714
- ignoreCase: true
715
- }],
716
- "perfectionist/sort-imports": ["error", {
717
- type: "line-length",
718
- order: "asc",
719
- ignoreCase: true,
720
- newlinesBetween: "never",
721
- groups: [["side-effect-style", "side-effect"], "unknown"]
722
- }],
723
- "perfectionist/sort-interfaces": ["error", {
724
- type: "natural",
725
- order: "asc",
726
- partitionByNewLine: true
727
- }],
728
- "perfectionist/sort-intersection-types": ["error", {
729
- type: "natural",
730
- order: "asc"
731
- }],
732
- "perfectionist/sort-maps": ["error", {
733
- type: "natural",
734
- order: "asc"
735
- }],
736
- "perfectionist/sort-named-exports": ["error", {
737
- type: "natural",
738
- order: "asc"
739
- }],
756
+ "perfectionist/sort-array-includes": [
757
+ "error",
758
+ {
759
+ type: "natural",
760
+ order: "asc",
761
+ ignoreCase: true,
762
+ groupKind: "literals-first"
763
+ }
764
+ ],
765
+ "perfectionist/sort-enums": [
766
+ "error",
767
+ {
768
+ type: "natural",
769
+ order: "asc"
770
+ }
771
+ ],
772
+ "perfectionist/sort-exports": [
773
+ "error",
774
+ {
775
+ type: "line-length",
776
+ order: "asc",
777
+ ignoreCase: true
778
+ }
779
+ ],
780
+ "perfectionist/sort-imports": [
781
+ "error",
782
+ {
783
+ type: "line-length",
784
+ order: "asc",
785
+ ignoreCase: true,
786
+ newlinesBetween: "never",
787
+ groups: [["side-effect-style", "side-effect"], "unknown"]
788
+ }
789
+ ],
790
+ "perfectionist/sort-interfaces": [
791
+ "error",
792
+ {
793
+ type: "natural",
794
+ order: "asc",
795
+ partitionByNewLine: true
796
+ }
797
+ ],
798
+ "perfectionist/sort-intersection-types": [
799
+ "error",
800
+ {
801
+ type: "natural",
802
+ order: "asc"
803
+ }
804
+ ],
805
+ "perfectionist/sort-maps": [
806
+ "error",
807
+ {
808
+ type: "natural",
809
+ order: "asc"
810
+ }
811
+ ],
812
+ "perfectionist/sort-named-exports": [
813
+ "error",
814
+ {
815
+ type: "natural",
816
+ order: "asc"
817
+ }
818
+ ],
740
819
  "sort-imports": "off",
741
- "perfectionist/sort-named-imports": ["error", {
742
- type: "natural",
743
- order: "asc"
744
- }],
820
+ "perfectionist/sort-named-imports": [
821
+ "error",
822
+ {
823
+ type: "natural",
824
+ order: "asc"
825
+ }
826
+ ],
745
827
  "@typescript-eslint/adjacent-overload-signatures": "off",
746
- "perfectionist/sort-object-types": ["error", {
747
- type: "natural",
748
- order: "asc",
749
- partitionByNewLine: true
750
- }],
751
- "perfectionist/sort-switch-case": ["error", {
752
- type: "natural",
753
- order: "asc",
754
- ignoreCase: true
755
- }],
828
+ "perfectionist/sort-object-types": [
829
+ "error",
830
+ {
831
+ type: "natural",
832
+ order: "asc",
833
+ partitionByNewLine: true
834
+ }
835
+ ],
836
+ "perfectionist/sort-switch-case": [
837
+ "error",
838
+ {
839
+ type: "natural",
840
+ order: "asc",
841
+ ignoreCase: true
842
+ }
843
+ ],
756
844
  ...options.overrides?.perfectionist
757
845
  }
758
846
  };
package/dist/index.js CHANGED
@@ -338,10 +338,13 @@ function javascript(options) {
338
338
  },
339
339
  rules: {
340
340
  "accessor-pairs": ["error", { enforceForClassMembers: true, setWithoutGet: true }],
341
- "array-callback-return": ["error", {
342
- checkForEach: false,
343
- allowVoid: true
344
- }],
341
+ "array-callback-return": [
342
+ "error",
343
+ {
344
+ checkForEach: false,
345
+ allowVoid: true
346
+ }
347
+ ],
345
348
  "block-scoped-var": "error",
346
349
  "consistent-this": ["error", "self"],
347
350
  "default-case-last": "error",
@@ -435,10 +438,13 @@ function javascript(options) {
435
438
  "object-shorthand": ["error", "always"],
436
439
  "operator-assignment": ["error", "always"],
437
440
  "prefer-arrow-callback": "error",
438
- "prefer-const": ["error", {
439
- destructuring: "all",
440
- ignoreReadBeforeAssign: true
441
- }],
441
+ "prefer-const": [
442
+ "error",
443
+ {
444
+ destructuring: "all",
445
+ ignoreReadBeforeAssign: true
446
+ }
447
+ ],
442
448
  "prefer-destructuring": "off",
443
449
  "prefer-exponentiation-operator": "error",
444
450
  "prefer-object-has-own": "error",
@@ -448,13 +454,16 @@ function javascript(options) {
448
454
  "prefer-spread": "error",
449
455
  "prefer-template": "error",
450
456
  "require-atomic-updates": ["error", { allowProperties: true }],
451
- "sort-imports": ["error", {
452
- allowSeparatedGroups: false,
453
- ignoreCase: false,
454
- ignoreDeclarationSort: true,
455
- ignoreMemberSort: false,
456
- memberSyntaxSortOrder: ["none", "all", "multiple", "single"]
457
- }],
457
+ "sort-imports": [
458
+ "error",
459
+ {
460
+ allowSeparatedGroups: false,
461
+ ignoreCase: false,
462
+ ignoreDeclarationSort: true,
463
+ ignoreMemberSort: false,
464
+ memberSyntaxSortOrder: ["none", "all", "multiple", "single"]
465
+ }
466
+ ],
458
467
  "symbol-description": "off",
459
468
  "use-isnan": "error",
460
469
  "valid-typeof": "error",
@@ -476,41 +485,53 @@ async function typescript(options) {
476
485
  "no-array-constructor": "off",
477
486
  "@typescript-eslint/no-array-constructor": "error",
478
487
  "@typescript-eslint/array-type": ["error", { default: "array" }],
479
- "@typescript-eslint/ban-ts-comment": ["error", {
480
- "ts-expect-error": "allow-with-description",
481
- "ts-ignore": true,
482
- "ts-nocheck": true,
483
- "ts-check": false,
484
- minimumDescriptionLength: 3
485
- }],
488
+ "@typescript-eslint/ban-ts-comment": [
489
+ "error",
490
+ {
491
+ "ts-expect-error": "allow-with-description",
492
+ "ts-ignore": true,
493
+ "ts-nocheck": true,
494
+ "ts-check": false,
495
+ minimumDescriptionLength: 3
496
+ }
497
+ ],
486
498
  "@typescript-eslint/class-literal-property-style": ["error", "fields"],
487
499
  "class-methods-use-this": "off",
488
- "@typescript-eslint/class-methods-use-this": ["error", {
489
- ignoreOverrideMethods: true,
490
- ignoreClassesThatImplementAnInterface: "public-fields"
491
- }],
500
+ "@typescript-eslint/class-methods-use-this": [
501
+ "error",
502
+ {
503
+ ignoreOverrideMethods: true,
504
+ ignoreClassesThatImplementAnInterface: "public-fields"
505
+ }
506
+ ],
492
507
  "@typescript-eslint/consistent-generic-constructors": ["error", "constructor"],
493
508
  "@typescript-eslint/consistent-indexed-object-style": ["error", "record"],
494
509
  "consistent-return": "off",
495
510
  "@typescript-eslint/consistent-return": "error",
496
- "@typescript-eslint/consistent-type-assertions": ["error", {
497
- assertionStyle: "as",
498
- objectLiteralTypeAssertions: "allow-as-parameter"
499
- }],
511
+ "@typescript-eslint/consistent-type-assertions": [
512
+ "error",
513
+ {
514
+ assertionStyle: "as",
515
+ objectLiteralTypeAssertions: "allow-as-parameter"
516
+ }
517
+ ],
500
518
  "@typescript-eslint/consistent-type-definitions": ["error", "interface"],
501
519
  "dot-notation": "off",
502
520
  "@typescript-eslint/dot-notation": ["error", { allowKeywords: true }],
503
521
  "@typescript-eslint/explicit-function-return-type": "off",
504
- "@typescript-eslint/explicit-member-accessibility": ["error", {
505
- accessibility: "explicit",
506
- overrides: {
507
- accessors: "no-public",
508
- constructors: "no-public",
509
- methods: "explicit",
510
- properties: "explicit",
511
- parameterProperties: "explicit"
522
+ "@typescript-eslint/explicit-member-accessibility": [
523
+ "error",
524
+ {
525
+ accessibility: "explicit",
526
+ overrides: {
527
+ accessors: "no-public",
528
+ constructors: "no-public",
529
+ methods: "explicit",
530
+ properties: "explicit",
531
+ parameterProperties: "explicit"
532
+ }
512
533
  }
513
- }],
534
+ ],
514
535
  "@typescript-eslint/explicit-module-boundary-types": "off",
515
536
  "@typescript-eslint/method-signature-style": ["error", "property"],
516
537
  camelcase: "off",
@@ -522,10 +543,14 @@ async function typescript(options) {
522
543
  leadingUnderscore: "allow"
523
544
  },
524
545
  {
525
- selector: ["classicAccessor", "classMethod", "function", "parameter", "parameterProperty"],
546
+ selector: ["classicAccessor", "classMethod", "parameter", "parameterProperty"],
526
547
  format: ["strictCamelCase"],
527
548
  leadingUnderscore: "allow"
528
549
  },
550
+ {
551
+ selector: ["function"],
552
+ format: ["strictCamelCase", "StrictPascalCase"]
553
+ },
529
554
  {
530
555
  selector: ["class", "enum", "enumMember", "interface", "typeAlias", "typeParameter"],
531
556
  format: ["StrictPascalCase"]
@@ -534,52 +559,67 @@ async function typescript(options) {
534
559
  "@typescript-eslint/no-array-delete": "error",
535
560
  "@typescript-eslint/no-base-to-string": "error",
536
561
  "@typescript-eslint/no-confusing-non-null-assertion": "error",
537
- "@typescript-eslint/no-confusing-void-expression": ["error", {
538
- ignoreArrowShorthand: true,
539
- ignoreVoidOperator: true
540
- }],
562
+ "@typescript-eslint/no-confusing-void-expression": [
563
+ "error",
564
+ {
565
+ ignoreArrowShorthand: true,
566
+ ignoreVoidOperator: true
567
+ }
568
+ ],
541
569
  "@typescript-eslint/no-duplicate-enum-values": "error",
542
570
  "@typescript-eslint/no-duplicate-type-constituents": "error",
543
571
  "@typescript-eslint/no-dynamic-delete": "error",
544
572
  "no-empty-function": "off",
545
573
  "@typescript-eslint/no-empty-function": "error",
546
- "@typescript-eslint/no-empty-object-type": ["error", {
547
- allowInterfaces: "never",
548
- allowObjectTypes: "never"
549
- }],
574
+ "@typescript-eslint/no-empty-object-type": [
575
+ "error",
576
+ {
577
+ allowInterfaces: "never",
578
+ allowObjectTypes: "never"
579
+ }
580
+ ],
550
581
  "@typescript-eslint/no-explicit-any": ["error", { fixToUnknown: true }],
551
582
  "@typescript-eslint/no-extra-non-null-assertion": "error",
552
583
  "@typescript-eslint/no-extraneous-class": "error",
553
- "@typescript-eslint/no-floating-promises": ["error", {
554
- allowForKnownSafePromises: options.knownSafePromises ?? [],
555
- checkThenables: false,
556
- ignoreIIFE: true,
557
- ignoreVoid: true
558
- }],
584
+ "@typescript-eslint/no-floating-promises": [
585
+ "error",
586
+ {
587
+ allowForKnownSafePromises: options.knownSafePromises ?? [],
588
+ checkThenables: false,
589
+ ignoreIIFE: true,
590
+ ignoreVoid: true
591
+ }
592
+ ],
559
593
  "@typescript-eslint/no-for-in-array": "error",
560
594
  "no-implied-eval": "off",
561
595
  "@typescript-eslint/no-implied-eval": "error",
562
596
  "@typescript-eslint/no-import-type-side-effects": "error",
563
597
  "@typescript-eslint/no-inferrable-types": "error",
564
- "@typescript-eslint/no-invalid-void-type": ["error", {
565
- allowInGenericTypeArguments: true,
566
- allowAsThisParameter: true
567
- }],
598
+ "@typescript-eslint/no-invalid-void-type": [
599
+ "error",
600
+ {
601
+ allowInGenericTypeArguments: true,
602
+ allowAsThisParameter: true
603
+ }
604
+ ],
568
605
  "no-loop-func": "off",
569
606
  "@typescript-eslint/no-loop-func": "error",
570
607
  "@typescript-eslint/no-meaningless-void-operator": "error",
571
608
  "@typescript-eslint/no-misused-new": "error",
572
- "@typescript-eslint/no-misused-promises": ["error", {
573
- checksConditionals: true,
574
- checksSpreads: true,
575
- checksVoidReturn: {
576
- arguments: true,
577
- attributes: true,
578
- properties: true,
579
- returns: true,
580
- variables: true
609
+ "@typescript-eslint/no-misused-promises": [
610
+ "error",
611
+ {
612
+ checksConditionals: true,
613
+ checksSpreads: true,
614
+ checksVoidReturn: {
615
+ arguments: true,
616
+ attributes: true,
617
+ properties: true,
618
+ returns: true,
619
+ variables: true
620
+ }
581
621
  }
582
- }],
622
+ ],
583
623
  "@typescript-eslint/no-mixed-enums": "error",
584
624
  "@typescript-eslint/no-namespace": "error",
585
625
  "@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error",
@@ -590,10 +630,13 @@ async function typescript(options) {
590
630
  "no-shadow": "off",
591
631
  "@typescript-eslint/no-shadow": "error",
592
632
  "@typescript-eslint/no-this-alias": "error",
593
- "@typescript-eslint/no-unnecessary-boolean-literal-compare": ["error", {
594
- allowComparingNullableBooleansToTrue: false,
595
- allowComparingNullableBooleansToFalse: true
596
- }],
633
+ "@typescript-eslint/no-unnecessary-boolean-literal-compare": [
634
+ "error",
635
+ {
636
+ allowComparingNullableBooleansToTrue: false,
637
+ allowComparingNullableBooleansToFalse: true
638
+ }
639
+ ],
597
640
  "@typescript-eslint/no-unnecessary-condition": "error",
598
641
  "@typescript-eslint/no-unnecessary-parameter-property-assignment": "error",
599
642
  "@typescript-eslint/no-unnecessary-qualifier": "error",
@@ -613,21 +656,27 @@ async function typescript(options) {
613
656
  "no-unused-expressions": "off",
614
657
  "@typescript-eslint/no-unused-expressions": ["error", { allowTaggedTemplates: true }],
615
658
  "no-use-before-define": "off",
616
- "@typescript-eslint/no-use-before-define": ["error", {
617
- functions: false,
618
- enums: true,
619
- typedefs: false
620
- }],
659
+ "@typescript-eslint/no-use-before-define": [
660
+ "error",
661
+ {
662
+ functions: false,
663
+ enums: true,
664
+ typedefs: false
665
+ }
666
+ ],
621
667
  "no-useless-constructor": "off",
622
668
  "@typescript-eslint/no-useless-constructor": "error",
623
669
  "@typescript-eslint/no-useless-empty-export": "error",
624
670
  "@typescript-eslint/no-wrapper-object-types": "error",
625
671
  "@typescript-eslint/non-nullable-type-assertion-style": "error",
626
672
  "no-throw-literal": "off",
627
- "@typescript-eslint/only-throw-error": ["error", {
628
- allowThrowingAny: false,
629
- allowThrowingUnknown: false
630
- }],
673
+ "@typescript-eslint/only-throw-error": [
674
+ "error",
675
+ {
676
+ allowThrowingAny: false,
677
+ allowThrowingUnknown: false
678
+ }
679
+ ],
631
680
  "@typescript-eslint/prefer-as-const": "error",
632
681
  "@typescript-eslint/prefer-enum-initializers": "error",
633
682
  "@typescript-eslint/prefer-find": "error",
@@ -635,17 +684,20 @@ async function typescript(options) {
635
684
  "@typescript-eslint/prefer-function-type": "error",
636
685
  "@typescript-eslint/prefer-includes": "error",
637
686
  "@typescript-eslint/prefer-literal-enum-member": "error",
638
- "@typescript-eslint/prefer-nullish-coalescing": ["error", {
639
- ignoreTernaryTests: false,
640
- ignoreConditionalTests: false,
641
- ignoreMixedLogicalExpressions: false,
642
- ignorePrimitives: {
643
- bigint: false,
644
- boolean: false,
645
- number: false,
646
- string: false
687
+ "@typescript-eslint/prefer-nullish-coalescing": [
688
+ "error",
689
+ {
690
+ ignoreTernaryTests: false,
691
+ ignoreConditionalTests: false,
692
+ ignoreMixedLogicalExpressions: false,
693
+ ignorePrimitives: {
694
+ bigint: false,
695
+ boolean: false,
696
+ number: false,
697
+ string: false
698
+ }
647
699
  }
648
- }],
700
+ ],
649
701
  "@typescript-eslint/prefer-optional-chain": "error",
650
702
  "prefer-promise-reject-errors": "off",
651
703
  "@typescript-eslint/prefer-promise-reject-errors": "error",
@@ -664,7 +716,10 @@ async function typescript(options) {
664
716
  "no-return-await": "off",
665
717
  "@typescript-eslint/return-await": ["error", "in-try-catch"],
666
718
  "@typescript-eslint/strict-boolean-expressions": "off",
667
- "@typescript-eslint/switch-exhaustiveness-check": ["error", { requireDefaultForNonUnion: true }],
719
+ "@typescript-eslint/switch-exhaustiveness-check": [
720
+ "error",
721
+ { requireDefaultForNonUnion: true }
722
+ ],
668
723
  "@typescript-eslint/unbound-method": "error",
669
724
  "@typescript-eslint/unified-signatures": ["error", { ignoreDifferentlyNamedParameters: true }],
670
725
  "@typescript-eslint/use-unknown-in-catch-callback-variable": "error",
@@ -694,61 +749,94 @@ async function perfectionist(options) {
694
749
  return {
695
750
  plugins: { perfectionist: plugin },
696
751
  rules: {
697
- "perfectionist/sort-array-includes": ["error", {
698
- type: "natural",
699
- order: "asc",
700
- ignoreCase: true,
701
- groupKind: "literals-first"
702
- }],
703
- "perfectionist/sort-enums": ["error", {
704
- type: "natural",
705
- order: "asc"
706
- }],
707
- "perfectionist/sort-exports": ["error", {
708
- type: "line-length",
709
- order: "asc",
710
- ignoreCase: true
711
- }],
712
- "perfectionist/sort-imports": ["error", {
713
- type: "line-length",
714
- order: "asc",
715
- ignoreCase: true,
716
- newlinesBetween: "never",
717
- groups: [["side-effect-style", "side-effect"], "unknown"]
718
- }],
719
- "perfectionist/sort-interfaces": ["error", {
720
- type: "natural",
721
- order: "asc",
722
- partitionByNewLine: true
723
- }],
724
- "perfectionist/sort-intersection-types": ["error", {
725
- type: "natural",
726
- order: "asc"
727
- }],
728
- "perfectionist/sort-maps": ["error", {
729
- type: "natural",
730
- order: "asc"
731
- }],
732
- "perfectionist/sort-named-exports": ["error", {
733
- type: "natural",
734
- order: "asc"
735
- }],
752
+ "perfectionist/sort-array-includes": [
753
+ "error",
754
+ {
755
+ type: "natural",
756
+ order: "asc",
757
+ ignoreCase: true,
758
+ groupKind: "literals-first"
759
+ }
760
+ ],
761
+ "perfectionist/sort-enums": [
762
+ "error",
763
+ {
764
+ type: "natural",
765
+ order: "asc"
766
+ }
767
+ ],
768
+ "perfectionist/sort-exports": [
769
+ "error",
770
+ {
771
+ type: "line-length",
772
+ order: "asc",
773
+ ignoreCase: true
774
+ }
775
+ ],
776
+ "perfectionist/sort-imports": [
777
+ "error",
778
+ {
779
+ type: "line-length",
780
+ order: "asc",
781
+ ignoreCase: true,
782
+ newlinesBetween: "never",
783
+ groups: [["side-effect-style", "side-effect"], "unknown"]
784
+ }
785
+ ],
786
+ "perfectionist/sort-interfaces": [
787
+ "error",
788
+ {
789
+ type: "natural",
790
+ order: "asc",
791
+ partitionByNewLine: true
792
+ }
793
+ ],
794
+ "perfectionist/sort-intersection-types": [
795
+ "error",
796
+ {
797
+ type: "natural",
798
+ order: "asc"
799
+ }
800
+ ],
801
+ "perfectionist/sort-maps": [
802
+ "error",
803
+ {
804
+ type: "natural",
805
+ order: "asc"
806
+ }
807
+ ],
808
+ "perfectionist/sort-named-exports": [
809
+ "error",
810
+ {
811
+ type: "natural",
812
+ order: "asc"
813
+ }
814
+ ],
736
815
  "sort-imports": "off",
737
- "perfectionist/sort-named-imports": ["error", {
738
- type: "natural",
739
- order: "asc"
740
- }],
816
+ "perfectionist/sort-named-imports": [
817
+ "error",
818
+ {
819
+ type: "natural",
820
+ order: "asc"
821
+ }
822
+ ],
741
823
  "@typescript-eslint/adjacent-overload-signatures": "off",
742
- "perfectionist/sort-object-types": ["error", {
743
- type: "natural",
744
- order: "asc",
745
- partitionByNewLine: true
746
- }],
747
- "perfectionist/sort-switch-case": ["error", {
748
- type: "natural",
749
- order: "asc",
750
- ignoreCase: true
751
- }],
824
+ "perfectionist/sort-object-types": [
825
+ "error",
826
+ {
827
+ type: "natural",
828
+ order: "asc",
829
+ partitionByNewLine: true
830
+ }
831
+ ],
832
+ "perfectionist/sort-switch-case": [
833
+ "error",
834
+ {
835
+ type: "natural",
836
+ order: "asc",
837
+ ignoreCase: true
838
+ }
839
+ ],
752
840
  ...options.overrides?.perfectionist
753
841
  }
754
842
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tb-dev/eslint-config",
3
- "version": "5.1.0",
3
+ "version": "5.2.0",
4
4
  "description": "ESLint config",
5
5
  "license": "MIT",
6
6
  "type": "module",