@tb-dev/eslint-config 4.4.1 → 5.0.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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2023 Andrew Ferreira
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Andrew Ferreira
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.cjs CHANGED
@@ -10,7 +10,6 @@ var Glob = /* @__PURE__ */ ((Glob2) => {
10
10
  Glob2["Javascript"] = "**/*.?([cm])js?(x)";
11
11
  Glob2["Json"] = "**/*.json?([c5])";
12
12
  Glob2["Typescript"] = "**/*.?([cm])ts?(x)";
13
- Glob2["Vitest"] = "**/*.{test,spec}.[jt]s";
14
13
  Glob2["Vue"] = "**/*.vue";
15
14
  return Glob2;
16
15
  })(Glob || {});
@@ -482,49 +481,6 @@ async function jsonc(options) {
482
481
  ];
483
482
  }
484
483
 
485
- async function vitest(options) {
486
- if (!options.features?.vitest) return {};
487
- const plugin = await interopDefault(import('eslint-plugin-vitest'));
488
- return {
489
- plugins: { vitest: plugin },
490
- files: [Glob.Vitest],
491
- rules: {
492
- "vitest/consistent-test-it": ["error", { fn: "it", withinDescribe: "it" }],
493
- "vitest/expect-expect": ["error", { assertFunctionNames: ["expect"] }],
494
- "vitest/max-expects": ["error", { max: 5 }],
495
- "vitest/max-nested-describe": ["error", { max: 1 }],
496
- "vitest/no-alias-methods": "error",
497
- "vitest/no-commented-out-tests": "error",
498
- "vitest/no-conditional-expect": "error",
499
- "vitest/no-conditional-in-test": "error",
500
- "vitest/no-conditional-tests": "error",
501
- "vitest/no-done-callback": "error",
502
- "vitest/no-duplicate-hooks": "error",
503
- "vitest/no-identical-title": "error",
504
- "vitest/no-import-node-test": "error",
505
- "vitest/no-standalone-expect": "error",
506
- "vitest/no-test-return-statement": "error",
507
- "vitest/prefer-comparison-matcher": "error",
508
- "vitest/prefer-each": "error",
509
- "vitest/prefer-equality-matcher": "error",
510
- "vitest/prefer-expect-resolves": "error",
511
- "vitest/prefer-hooks-in-order": "error",
512
- "vitest/prefer-hooks-on-top": "error",
513
- "vitest/prefer-lowercase-title": "error",
514
- "vitest/prefer-mock-promise-shorthand": "error",
515
- "vitest/prefer-spy-on": "error",
516
- "vitest/prefer-to-be-object": "error",
517
- "vitest/prefer-to-contain": "error",
518
- "vitest/prefer-to-have-length": "error",
519
- "vitest/prefer-todo": "error",
520
- "vitest/require-top-level-describe": ["error", { maxNumberOfTopLevelDescribes: 10 }],
521
- "vitest/valid-describe-callback": "error",
522
- "vitest/valid-expect": "error",
523
- ...options.overrides?.vitest
524
- }
525
- };
526
- }
527
-
528
484
  async function unicorn(options) {
529
485
  const { unicorn: enabled = true } = options.features ?? {};
530
486
  if (!enabled) return {};
@@ -544,6 +500,7 @@ async function unicorn(options) {
544
500
  "unicorn/no-await-in-promise-methods": "error",
545
501
  "unicorn/no-invalid-fetch-options": "error",
546
502
  "unicorn/no-invalid-remove-event-listener": "error",
503
+ "unicorn/no-length-as-slice-end": "error",
547
504
  "unicorn/no-magic-array-flat-depth": "error",
548
505
  "unicorn/no-negation-in-equality-check": "error",
549
506
  "unicorn/no-single-promise-in-promise-methods": "error",
@@ -579,10 +536,11 @@ async function unicorn(options) {
579
536
  async function tailwind(options) {
580
537
  if (!options.features?.tailwind) return {};
581
538
  const plugin = await interopDefault(import('eslint-plugin-tailwindcss'));
539
+ const callees = ["classnames", "clsx", "cn", "ctl", "cva", "tv"];
582
540
  const rules = {
583
- "tailwindcss/classnames-order": "error",
584
- "tailwindcss/enforces-shorthand": "error",
585
- "tailwindcss/no-contradicting-classname": "error",
541
+ "tailwindcss/classnames-order": ["error", { callees }],
542
+ "tailwindcss/enforces-shorthand": ["error", { callees }],
543
+ "tailwindcss/no-contradicting-classname": ["error", { callees }],
586
544
  ...options.overrides?.tailwind
587
545
  };
588
546
  return {
@@ -662,6 +620,7 @@ function javascript(options) {
662
620
  "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
663
621
  "no-lone-blocks": "error",
664
622
  "no-lonely-if": "error",
623
+ "no-loss-of-precision": "error",
665
624
  "no-misleading-character-class": "error",
666
625
  "no-multi-assign": "error",
667
626
  "no-multi-str": "error",
@@ -813,7 +772,6 @@ async function typescript(options) {
813
772
  "@typescript-eslint/no-dynamic-delete": "error",
814
773
  "no-empty-function": "off",
815
774
  "@typescript-eslint/no-empty-function": "error",
816
- "@typescript-eslint/no-empty-interface": "error",
817
775
  "@typescript-eslint/no-empty-object-type": ["error", {
818
776
  allowInterfaces: "never",
819
777
  allowObjectTypes: "never"
@@ -822,9 +780,10 @@ async function typescript(options) {
822
780
  "@typescript-eslint/no-extra-non-null-assertion": "error",
823
781
  "@typescript-eslint/no-extraneous-class": "error",
824
782
  "@typescript-eslint/no-floating-promises": ["error", {
783
+ allowForKnownSafePromises: options.knownSafePromises ?? [],
784
+ checkThenables: false,
825
785
  ignoreIIFE: true,
826
- ignoreVoid: true,
827
- allowForKnownSafePromises: options.knownSafePromises ?? []
786
+ ignoreVoid: true
828
787
  }],
829
788
  "@typescript-eslint/no-for-in-array": "error",
830
789
  "no-implied-eval": "off",
@@ -837,8 +796,6 @@ async function typescript(options) {
837
796
  }],
838
797
  "no-loop-func": "off",
839
798
  "@typescript-eslint/no-loop-func": "error",
840
- "no-loss-of-precision": "off",
841
- "@typescript-eslint/no-loss-of-precision": "error",
842
799
  "@typescript-eslint/no-meaningless-void-operator": "error",
843
800
  "@typescript-eslint/no-misused-new": "error",
844
801
  "@typescript-eslint/no-misused-promises": ["error", {
@@ -893,7 +850,6 @@ async function typescript(options) {
893
850
  "no-useless-constructor": "off",
894
851
  "@typescript-eslint/no-useless-constructor": "error",
895
852
  "@typescript-eslint/no-useless-empty-export": "error",
896
- "@typescript-eslint/no-useless-template-literals": "error",
897
853
  "@typescript-eslint/no-wrapper-object-types": "error",
898
854
  "@typescript-eslint/non-nullable-type-assertion-style": "error",
899
855
  "no-throw-literal": "off",
@@ -1039,7 +995,6 @@ async function defineConfig(options) {
1039
995
  stylistic(options),
1040
996
  perfectionist(options),
1041
997
  unicorn(options),
1042
- vitest(options),
1043
998
  tailwind(options),
1044
999
  ignores
1045
1000
  ]);
package/dist/index.d.ts CHANGED
@@ -27,8 +27,6 @@ declare interface ConfigOptions {
27
27
  /** @default true */
28
28
  unicorn?: boolean;
29
29
  /** @default false */
30
- vitest?: boolean;
31
- /** @default false */
32
30
  vue?: boolean;
33
31
  };
34
32
  /** `tsconfig.json` files for TypeScript. */
@@ -42,7 +40,6 @@ declare interface ConfigOptions {
42
40
  tailwind?: Rules;
43
41
  typescript?: Rules;
44
42
  unicorn?: Rules;
45
- vitest?: Rules;
46
43
  vue?: Rules;
47
44
  };
48
45
  /** @see https://typescript-eslint.io/rules/no-floating-promises#allowforknownsafepromises */
package/dist/index.js CHANGED
@@ -6,7 +6,6 @@ var Glob = /* @__PURE__ */ ((Glob2) => {
6
6
  Glob2["Javascript"] = "**/*.?([cm])js?(x)";
7
7
  Glob2["Json"] = "**/*.json?([c5])";
8
8
  Glob2["Typescript"] = "**/*.?([cm])ts?(x)";
9
- Glob2["Vitest"] = "**/*.{test,spec}.[jt]s";
10
9
  Glob2["Vue"] = "**/*.vue";
11
10
  return Glob2;
12
11
  })(Glob || {});
@@ -478,49 +477,6 @@ async function jsonc(options) {
478
477
  ];
479
478
  }
480
479
 
481
- async function vitest(options) {
482
- if (!options.features?.vitest) return {};
483
- const plugin = await interopDefault(import('eslint-plugin-vitest'));
484
- return {
485
- plugins: { vitest: plugin },
486
- files: [Glob.Vitest],
487
- rules: {
488
- "vitest/consistent-test-it": ["error", { fn: "it", withinDescribe: "it" }],
489
- "vitest/expect-expect": ["error", { assertFunctionNames: ["expect"] }],
490
- "vitest/max-expects": ["error", { max: 5 }],
491
- "vitest/max-nested-describe": ["error", { max: 1 }],
492
- "vitest/no-alias-methods": "error",
493
- "vitest/no-commented-out-tests": "error",
494
- "vitest/no-conditional-expect": "error",
495
- "vitest/no-conditional-in-test": "error",
496
- "vitest/no-conditional-tests": "error",
497
- "vitest/no-done-callback": "error",
498
- "vitest/no-duplicate-hooks": "error",
499
- "vitest/no-identical-title": "error",
500
- "vitest/no-import-node-test": "error",
501
- "vitest/no-standalone-expect": "error",
502
- "vitest/no-test-return-statement": "error",
503
- "vitest/prefer-comparison-matcher": "error",
504
- "vitest/prefer-each": "error",
505
- "vitest/prefer-equality-matcher": "error",
506
- "vitest/prefer-expect-resolves": "error",
507
- "vitest/prefer-hooks-in-order": "error",
508
- "vitest/prefer-hooks-on-top": "error",
509
- "vitest/prefer-lowercase-title": "error",
510
- "vitest/prefer-mock-promise-shorthand": "error",
511
- "vitest/prefer-spy-on": "error",
512
- "vitest/prefer-to-be-object": "error",
513
- "vitest/prefer-to-contain": "error",
514
- "vitest/prefer-to-have-length": "error",
515
- "vitest/prefer-todo": "error",
516
- "vitest/require-top-level-describe": ["error", { maxNumberOfTopLevelDescribes: 10 }],
517
- "vitest/valid-describe-callback": "error",
518
- "vitest/valid-expect": "error",
519
- ...options.overrides?.vitest
520
- }
521
- };
522
- }
523
-
524
480
  async function unicorn(options) {
525
481
  const { unicorn: enabled = true } = options.features ?? {};
526
482
  if (!enabled) return {};
@@ -540,6 +496,7 @@ async function unicorn(options) {
540
496
  "unicorn/no-await-in-promise-methods": "error",
541
497
  "unicorn/no-invalid-fetch-options": "error",
542
498
  "unicorn/no-invalid-remove-event-listener": "error",
499
+ "unicorn/no-length-as-slice-end": "error",
543
500
  "unicorn/no-magic-array-flat-depth": "error",
544
501
  "unicorn/no-negation-in-equality-check": "error",
545
502
  "unicorn/no-single-promise-in-promise-methods": "error",
@@ -575,10 +532,11 @@ async function unicorn(options) {
575
532
  async function tailwind(options) {
576
533
  if (!options.features?.tailwind) return {};
577
534
  const plugin = await interopDefault(import('eslint-plugin-tailwindcss'));
535
+ const callees = ["classnames", "clsx", "cn", "ctl", "cva", "tv"];
578
536
  const rules = {
579
- "tailwindcss/classnames-order": "error",
580
- "tailwindcss/enforces-shorthand": "error",
581
- "tailwindcss/no-contradicting-classname": "error",
537
+ "tailwindcss/classnames-order": ["error", { callees }],
538
+ "tailwindcss/enforces-shorthand": ["error", { callees }],
539
+ "tailwindcss/no-contradicting-classname": ["error", { callees }],
582
540
  ...options.overrides?.tailwind
583
541
  };
584
542
  return {
@@ -658,6 +616,7 @@ function javascript(options) {
658
616
  "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
659
617
  "no-lone-blocks": "error",
660
618
  "no-lonely-if": "error",
619
+ "no-loss-of-precision": "error",
661
620
  "no-misleading-character-class": "error",
662
621
  "no-multi-assign": "error",
663
622
  "no-multi-str": "error",
@@ -809,7 +768,6 @@ async function typescript(options) {
809
768
  "@typescript-eslint/no-dynamic-delete": "error",
810
769
  "no-empty-function": "off",
811
770
  "@typescript-eslint/no-empty-function": "error",
812
- "@typescript-eslint/no-empty-interface": "error",
813
771
  "@typescript-eslint/no-empty-object-type": ["error", {
814
772
  allowInterfaces: "never",
815
773
  allowObjectTypes: "never"
@@ -818,9 +776,10 @@ async function typescript(options) {
818
776
  "@typescript-eslint/no-extra-non-null-assertion": "error",
819
777
  "@typescript-eslint/no-extraneous-class": "error",
820
778
  "@typescript-eslint/no-floating-promises": ["error", {
779
+ allowForKnownSafePromises: options.knownSafePromises ?? [],
780
+ checkThenables: false,
821
781
  ignoreIIFE: true,
822
- ignoreVoid: true,
823
- allowForKnownSafePromises: options.knownSafePromises ?? []
782
+ ignoreVoid: true
824
783
  }],
825
784
  "@typescript-eslint/no-for-in-array": "error",
826
785
  "no-implied-eval": "off",
@@ -833,8 +792,6 @@ async function typescript(options) {
833
792
  }],
834
793
  "no-loop-func": "off",
835
794
  "@typescript-eslint/no-loop-func": "error",
836
- "no-loss-of-precision": "off",
837
- "@typescript-eslint/no-loss-of-precision": "error",
838
795
  "@typescript-eslint/no-meaningless-void-operator": "error",
839
796
  "@typescript-eslint/no-misused-new": "error",
840
797
  "@typescript-eslint/no-misused-promises": ["error", {
@@ -889,7 +846,6 @@ async function typescript(options) {
889
846
  "no-useless-constructor": "off",
890
847
  "@typescript-eslint/no-useless-constructor": "error",
891
848
  "@typescript-eslint/no-useless-empty-export": "error",
892
- "@typescript-eslint/no-useless-template-literals": "error",
893
849
  "@typescript-eslint/no-wrapper-object-types": "error",
894
850
  "@typescript-eslint/non-nullable-type-assertion-style": "error",
895
851
  "no-throw-literal": "off",
@@ -1035,7 +991,6 @@ async function defineConfig(options) {
1035
991
  stylistic(options),
1036
992
  perfectionist(options),
1037
993
  unicorn(options),
1038
- vitest(options),
1039
994
  tailwind(options),
1040
995
  ignores
1041
996
  ]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tb-dev/eslint-config",
3
- "version": "4.4.1",
3
+ "version": "5.0.0",
4
4
  "description": "ESLint config",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -24,32 +24,31 @@
24
24
  "*.{?(c|m)@(j|t)s,css,vue,md,json}": "eslint --config eslint.config.js --fix"
25
25
  },
26
26
  "dependencies": {
27
- "@stylistic/eslint-plugin": "^2.3.0",
28
- "@typescript-eslint/eslint-plugin": "^7.17.0",
29
- "@typescript-eslint/parser": "^7.17.0",
27
+ "@stylistic/eslint-plugin": "^2.6.1",
28
+ "@typescript-eslint/eslint-plugin": "^8.0.1",
29
+ "@typescript-eslint/parser": "^8.0.1",
30
30
  "eslint-plugin-jsonc": "^2.16.0",
31
- "eslint-plugin-perfectionist": "^3.0.0",
31
+ "eslint-plugin-perfectionist": "^3.1.2",
32
32
  "eslint-plugin-tailwindcss": "^3.17.4",
33
- "eslint-plugin-unicorn": "^54.0.0",
34
- "eslint-plugin-vitest": "^0.5.4",
33
+ "eslint-plugin-unicorn": "^55.0.0",
35
34
  "eslint-plugin-vue": "^9.27.0",
36
- "globals": "^15.8.0",
35
+ "globals": "^15.9.0",
37
36
  "vue-eslint-parser": "^9.4.3"
38
37
  },
39
38
  "devDependencies": {
40
- "@types/node": "^20.14.11",
41
- "eslint": "^8.57.0",
42
- "husky": "^9.1.1",
43
- "lint-staged": "^15.2.7",
39
+ "@types/node": "^22.1.0",
40
+ "eslint": "^9.8.0",
41
+ "husky": "^9.1.4",
42
+ "lint-staged": "^15.2.8",
44
43
  "prettier": "^3.3.3",
45
44
  "tslib": "^2.6.3",
46
45
  "typescript": "^5.5.4",
47
- "vite": "^5.3.4",
48
- "vite-plugin-dts": "^3.9.1"
46
+ "vite": "^5.3.5",
47
+ "vite-plugin-dts": "3.9.1"
49
48
  },
50
49
  "peerDependencies": {
51
- "eslint": "^8.57.0",
52
- "typescript": "^5.4.0"
50
+ "eslint": "^9.8.0",
51
+ "typescript": "^5.5.0"
53
52
  },
54
53
  "engines": {
55
54
  "node": ">=22"