@tb-dev/eslint-config 3.8.10 → 4.1.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/dist/index.cjs CHANGED
@@ -627,7 +627,6 @@ async function typescript(options) {
627
627
  minimumDescriptionLength: 3
628
628
  }
629
629
  ],
630
- "@typescript-eslint/ban-types": "error",
631
630
  "@typescript-eslint/class-literal-property-style": ["error", "fields"],
632
631
  "class-methods-use-this": "off",
633
632
  "@typescript-eslint/class-methods-use-this": [
@@ -698,10 +697,17 @@ async function typescript(options) {
698
697
  "no-empty-function": "off",
699
698
  "@typescript-eslint/no-empty-function": "error",
700
699
  "@typescript-eslint/no-empty-interface": "error",
700
+ "@typescript-eslint/no-empty-object-type": [
701
+ "error",
702
+ { allowInterfaces: "never", allowObjectTypes: "never" }
703
+ ],
701
704
  "@typescript-eslint/no-explicit-any": ["error", { fixToUnknown: true }],
702
705
  "@typescript-eslint/no-extra-non-null-assertion": "error",
703
706
  "@typescript-eslint/no-extraneous-class": "error",
704
- "@typescript-eslint/no-floating-promises": ["error", { ignoreIIFE: true, ignoreVoid: true }],
707
+ "@typescript-eslint/no-floating-promises": [
708
+ "error",
709
+ { ignoreIIFE: true, ignoreVoid: true, allowForKnownSafePromises: options.knownSafePromises }
710
+ ],
705
711
  "@typescript-eslint/no-for-in-array": "error",
706
712
  "no-implied-eval": "off",
707
713
  "@typescript-eslint/no-implied-eval": "error",
@@ -752,14 +758,17 @@ async function typescript(options) {
752
758
  }
753
759
  ],
754
760
  "@typescript-eslint/no-unnecessary-condition": "error",
761
+ "@typescript-eslint/no-unnecessary-parameter-property-assignment": "error",
755
762
  "@typescript-eslint/no-unnecessary-qualifier": "error",
756
763
  "@typescript-eslint/no-unnecessary-type-arguments": "error",
757
764
  "@typescript-eslint/no-unnecessary-type-assertion": "error",
758
765
  "@typescript-eslint/no-unnecessary-type-constraint": "error",
766
+ "@typescript-eslint/no-unnecessary-type-parameters": "error",
759
767
  "@typescript-eslint/no-unsafe-argument": "off",
760
768
  "@typescript-eslint/no-unsafe-assignment": "off",
761
769
  "@typescript-eslint/no-unsafe-call": "error",
762
770
  "@typescript-eslint/no-unsafe-declaration-merging": "error",
771
+ "@typescript-eslint/no-unsafe-function-type": "error",
763
772
  "@typescript-eslint/no-unsafe-enum-comparison": "off",
764
773
  "@typescript-eslint/no-unsafe-member-access": "error",
765
774
  "@typescript-eslint/no-unsafe-return": "off",
@@ -784,6 +793,7 @@ async function typescript(options) {
784
793
  "@typescript-eslint/no-useless-constructor": "error",
785
794
  "@typescript-eslint/no-useless-empty-export": "error",
786
795
  "@typescript-eslint/no-useless-template-literals": "error",
796
+ "@typescript-eslint/no-wrapper-object-types": "error",
787
797
  "@typescript-eslint/non-nullable-type-assertion-style": "error",
788
798
  "no-throw-literal": "off",
789
799
  "@typescript-eslint/only-throw-error": [
@@ -829,6 +839,8 @@ async function typescript(options) {
829
839
  "@typescript-eslint/require-await": "error",
830
840
  "@typescript-eslint/restrict-plus-operands": "error",
831
841
  "@typescript-eslint/restrict-template-expressions": "error",
842
+ "no-return-await": "off",
843
+ "@typescript-eslint/return-await": ["error", "in-try-catch"],
832
844
  "@typescript-eslint/strict-boolean-expressions": "off",
833
845
  "@typescript-eslint/switch-exhaustiveness-check": [
834
846
  "error",
@@ -873,6 +885,15 @@ async function perfectionist(options) {
873
885
  perfectionist: plugin
874
886
  },
875
887
  rules: {
888
+ "perfectionist/sort-array-includes": [
889
+ "error",
890
+ {
891
+ type: "natural",
892
+ order: "asc",
893
+ ignoreCase: true,
894
+ groupKind: "literals-first"
895
+ }
896
+ ],
876
897
  "perfectionist/sort-enums": [
877
898
  "error",
878
899
  {
@@ -884,7 +905,8 @@ async function perfectionist(options) {
884
905
  "error",
885
906
  {
886
907
  type: "line-length",
887
- order: "asc"
908
+ order: "asc",
909
+ ignoreCase: true
888
910
  }
889
911
  ],
890
912
  "perfectionist/sort-imports": [
@@ -892,8 +914,8 @@ async function perfectionist(options) {
892
914
  {
893
915
  type: "line-length",
894
916
  order: "asc",
895
- "ignore-case": true,
896
- "newlines-between": "never",
917
+ ignoreCase: true,
918
+ newlinesBetween: "never",
897
919
  groups: [["side-effect-style", "side-effect"], "unknown"]
898
920
  }
899
921
  ],
@@ -902,7 +924,7 @@ async function perfectionist(options) {
902
924
  {
903
925
  type: "natural",
904
926
  order: "asc",
905
- "partition-by-new-line": true
927
+ partitionByNewLine: true
906
928
  }
907
929
  ],
908
930
  "perfectionist/sort-intersection-types": [
@@ -940,7 +962,15 @@ async function perfectionist(options) {
940
962
  {
941
963
  type: "natural",
942
964
  order: "asc",
943
- "partition-by-new-line": true
965
+ partitionByNewLine: true
966
+ }
967
+ ],
968
+ "perfectionist/sort-switch-case": [
969
+ "error",
970
+ {
971
+ type: "natural",
972
+ order: "asc",
973
+ ignoreCase: true
944
974
  }
945
975
  ],
946
976
  ...overrides == null ? void 0 : overrides.perfectionist
package/dist/index.d.ts CHANGED
@@ -28,6 +28,8 @@ declare interface ConfigOptions {
28
28
  vitest?: boolean;
29
29
  /** @default false */
30
30
  vue?: boolean;
31
+ /** `tsconfig.json` files for Typescript. */
32
+ project: string[];
31
33
  ignores?: Ignores['ignores'];
32
34
  overrides?: {
33
35
  javascript?: Rules;
@@ -37,14 +39,20 @@ declare interface ConfigOptions {
37
39
  vitest?: Rules;
38
40
  vue?: Rules;
39
41
  };
40
- /** `tsconfig.json` files for Typescript. */
41
- project: string[];
42
+ /** @see https://typescript-eslint.io/rules/no-floating-promises#allowforknownsafepromises */
43
+ knownSafePromises?: KnownSafePromise[];
42
44
  }
43
45
 
44
46
  declare interface Ignores {
45
47
  ignores: string[];
46
48
  }
47
49
 
50
+ declare interface KnownSafePromise {
51
+ from: string;
52
+ name: string;
53
+ package?: string;
54
+ }
55
+
48
56
  declare type Rules = Record<string, Severity | any[]>;
49
57
 
50
58
  declare type Severity = 'error' | 'warn' | 'off' | 0 | 1;
package/dist/index.js CHANGED
@@ -604,7 +604,6 @@ async function typescript(options) {
604
604
  minimumDescriptionLength: 3
605
605
  }
606
606
  ],
607
- "@typescript-eslint/ban-types": "error",
608
607
  "@typescript-eslint/class-literal-property-style": ["error", "fields"],
609
608
  "class-methods-use-this": "off",
610
609
  "@typescript-eslint/class-methods-use-this": [
@@ -675,10 +674,17 @@ async function typescript(options) {
675
674
  "no-empty-function": "off",
676
675
  "@typescript-eslint/no-empty-function": "error",
677
676
  "@typescript-eslint/no-empty-interface": "error",
677
+ "@typescript-eslint/no-empty-object-type": [
678
+ "error",
679
+ { allowInterfaces: "never", allowObjectTypes: "never" }
680
+ ],
678
681
  "@typescript-eslint/no-explicit-any": ["error", { fixToUnknown: true }],
679
682
  "@typescript-eslint/no-extra-non-null-assertion": "error",
680
683
  "@typescript-eslint/no-extraneous-class": "error",
681
- "@typescript-eslint/no-floating-promises": ["error", { ignoreIIFE: true, ignoreVoid: true }],
684
+ "@typescript-eslint/no-floating-promises": [
685
+ "error",
686
+ { ignoreIIFE: true, ignoreVoid: true, allowForKnownSafePromises: options.knownSafePromises }
687
+ ],
682
688
  "@typescript-eslint/no-for-in-array": "error",
683
689
  "no-implied-eval": "off",
684
690
  "@typescript-eslint/no-implied-eval": "error",
@@ -729,14 +735,17 @@ async function typescript(options) {
729
735
  }
730
736
  ],
731
737
  "@typescript-eslint/no-unnecessary-condition": "error",
738
+ "@typescript-eslint/no-unnecessary-parameter-property-assignment": "error",
732
739
  "@typescript-eslint/no-unnecessary-qualifier": "error",
733
740
  "@typescript-eslint/no-unnecessary-type-arguments": "error",
734
741
  "@typescript-eslint/no-unnecessary-type-assertion": "error",
735
742
  "@typescript-eslint/no-unnecessary-type-constraint": "error",
743
+ "@typescript-eslint/no-unnecessary-type-parameters": "error",
736
744
  "@typescript-eslint/no-unsafe-argument": "off",
737
745
  "@typescript-eslint/no-unsafe-assignment": "off",
738
746
  "@typescript-eslint/no-unsafe-call": "error",
739
747
  "@typescript-eslint/no-unsafe-declaration-merging": "error",
748
+ "@typescript-eslint/no-unsafe-function-type": "error",
740
749
  "@typescript-eslint/no-unsafe-enum-comparison": "off",
741
750
  "@typescript-eslint/no-unsafe-member-access": "error",
742
751
  "@typescript-eslint/no-unsafe-return": "off",
@@ -761,6 +770,7 @@ async function typescript(options) {
761
770
  "@typescript-eslint/no-useless-constructor": "error",
762
771
  "@typescript-eslint/no-useless-empty-export": "error",
763
772
  "@typescript-eslint/no-useless-template-literals": "error",
773
+ "@typescript-eslint/no-wrapper-object-types": "error",
764
774
  "@typescript-eslint/non-nullable-type-assertion-style": "error",
765
775
  "no-throw-literal": "off",
766
776
  "@typescript-eslint/only-throw-error": [
@@ -806,6 +816,8 @@ async function typescript(options) {
806
816
  "@typescript-eslint/require-await": "error",
807
817
  "@typescript-eslint/restrict-plus-operands": "error",
808
818
  "@typescript-eslint/restrict-template-expressions": "error",
819
+ "no-return-await": "off",
820
+ "@typescript-eslint/return-await": ["error", "in-try-catch"],
809
821
  "@typescript-eslint/strict-boolean-expressions": "off",
810
822
  "@typescript-eslint/switch-exhaustiveness-check": [
811
823
  "error",
@@ -850,6 +862,15 @@ async function perfectionist(options) {
850
862
  perfectionist: plugin
851
863
  },
852
864
  rules: {
865
+ "perfectionist/sort-array-includes": [
866
+ "error",
867
+ {
868
+ type: "natural",
869
+ order: "asc",
870
+ ignoreCase: true,
871
+ groupKind: "literals-first"
872
+ }
873
+ ],
853
874
  "perfectionist/sort-enums": [
854
875
  "error",
855
876
  {
@@ -861,7 +882,8 @@ async function perfectionist(options) {
861
882
  "error",
862
883
  {
863
884
  type: "line-length",
864
- order: "asc"
885
+ order: "asc",
886
+ ignoreCase: true
865
887
  }
866
888
  ],
867
889
  "perfectionist/sort-imports": [
@@ -869,8 +891,8 @@ async function perfectionist(options) {
869
891
  {
870
892
  type: "line-length",
871
893
  order: "asc",
872
- "ignore-case": true,
873
- "newlines-between": "never",
894
+ ignoreCase: true,
895
+ newlinesBetween: "never",
874
896
  groups: [["side-effect-style", "side-effect"], "unknown"]
875
897
  }
876
898
  ],
@@ -879,7 +901,7 @@ async function perfectionist(options) {
879
901
  {
880
902
  type: "natural",
881
903
  order: "asc",
882
- "partition-by-new-line": true
904
+ partitionByNewLine: true
883
905
  }
884
906
  ],
885
907
  "perfectionist/sort-intersection-types": [
@@ -917,7 +939,15 @@ async function perfectionist(options) {
917
939
  {
918
940
  type: "natural",
919
941
  order: "asc",
920
- "partition-by-new-line": true
942
+ partitionByNewLine: true
943
+ }
944
+ ],
945
+ "perfectionist/sort-switch-case": [
946
+ "error",
947
+ {
948
+ type: "natural",
949
+ order: "asc",
950
+ ignoreCase: true
921
951
  }
922
952
  ],
923
953
  ...overrides == null ? void 0 : overrides.perfectionist
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tb-dev/eslint-config",
3
- "version": "3.8.10",
3
+ "version": "4.1.0",
4
4
  "description": "ESLint config",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -17,10 +17,10 @@
17
17
  "*.{?(c|m)@(j|t)s,css,vue,md,json}": "prettier --write"
18
18
  },
19
19
  "dependencies": {
20
- "@typescript-eslint/eslint-plugin": "^7.16.1",
21
- "@typescript-eslint/parser": "^7.16.1",
20
+ "@typescript-eslint/eslint-plugin": "^7.17.0",
21
+ "@typescript-eslint/parser": "^7.17.0",
22
22
  "eslint-config-prettier": "^9.1.0",
23
- "eslint-plugin-perfectionist": "^2.11.0",
23
+ "eslint-plugin-perfectionist": "^3.0.0",
24
24
  "eslint-plugin-unicorn": "^54.0.0",
25
25
  "eslint-plugin-vitest": "^0.5.4",
26
26
  "eslint-plugin-vue": "^9.27.0",
@@ -29,14 +29,14 @@
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/eslint-config-prettier": "^6.11.3",
32
- "@types/node": "^20.14.10",
32
+ "@types/node": "^20.14.11",
33
33
  "eslint": "^8.57.0",
34
- "husky": "^9.0.11",
34
+ "husky": "^9.1.1",
35
35
  "lint-staged": "^15.2.7",
36
36
  "prettier": "^3.3.3",
37
37
  "tslib": "^2.6.3",
38
38
  "typescript": "^5.5.3",
39
- "vite": "^5.3.3",
39
+ "vite": "^5.3.4",
40
40
  "vite-plugin-dts": "^3.9.1"
41
41
  },
42
42
  "peerDependencies": {