eslint-config-decent 2.6.7 → 2.8.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
@@ -22,6 +22,7 @@ const security = require('eslint-plugin-security');
22
22
  const stylistic = require('@stylistic/eslint-plugin');
23
23
  const testingLibrary = require('eslint-plugin-testing-library');
24
24
  const unicorn = require('eslint-plugin-unicorn');
25
+ const vitest = require('@vitest/eslint-plugin');
25
26
 
26
27
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
27
28
 
@@ -43,8 +44,9 @@ const security__default = /*#__PURE__*/_interopDefaultCompat(security);
43
44
  const stylistic__default = /*#__PURE__*/_interopDefaultCompat(stylistic);
44
45
  const testingLibrary__default = /*#__PURE__*/_interopDefaultCompat(testingLibrary);
45
46
  const unicorn__default = /*#__PURE__*/_interopDefaultCompat(unicorn);
47
+ const vitest__default = /*#__PURE__*/_interopDefaultCompat(vitest);
46
48
 
47
- const base$d = {
49
+ const base$e = {
48
50
  rules: {
49
51
  "array-callback-return": ["error", { allowImplicit: true }],
50
52
  "block-scoped-var": "error",
@@ -252,8 +254,8 @@ const cjs = {
252
254
  strict: ["error", "global"]
253
255
  }
254
256
  };
255
- const configs$d = {
256
- base: base$d,
257
+ const configs$e = {
258
+ base: base$e,
257
259
  cjsAndEsm,
258
260
  cjs
259
261
  };
@@ -352,7 +354,7 @@ const requireIndexRule = utils.ESLintUtils.RuleCreator(() => "https://github.com
352
354
  }
353
355
  });
354
356
 
355
- const base$c = {
357
+ const base$d = {
356
358
  plugins: {
357
359
  "decent-extension": {
358
360
  meta: {
@@ -370,11 +372,11 @@ const base$c = {
370
372
  "decent-extension/require-index": "error"
371
373
  }
372
374
  };
373
- const configs$c = {
374
- base: base$c
375
+ const configs$d = {
376
+ base: base$d
375
377
  };
376
378
 
377
- const base$b = {
379
+ const base$c = {
378
380
  plugins: {
379
381
  import: importPlugin__default
380
382
  },
@@ -389,11 +391,11 @@ const base$b = {
389
391
  ]
390
392
  }
391
393
  };
392
- const configs$b = {
393
- base: base$b
394
+ const configs$c = {
395
+ base: base$c
394
396
  };
395
397
 
396
- const base$a = {
398
+ const base$b = {
397
399
  plugins: {
398
400
  jest: jest__default,
399
401
  "jest-dom": jestDom__default
@@ -436,11 +438,11 @@ const base$a = {
436
438
  "@typescript-eslint/unbound-method": "off"
437
439
  }
438
440
  };
439
- const configs$a = {
440
- base: base$a
441
+ const configs$b = {
442
+ base: base$b
441
443
  };
442
444
 
443
- const base$9 = {
445
+ const base$a = {
444
446
  settings: {
445
447
  jsdoc: {
446
448
  preferredTypes: {
@@ -483,11 +485,11 @@ const base$9 = {
483
485
  "jsdoc/valid-types": "error"
484
486
  }
485
487
  };
486
- const configs$9 = {
487
- base: base$9
488
+ const configs$a = {
489
+ base: base$a
488
490
  };
489
491
 
490
- const base$8 = {
492
+ const base$9 = {
491
493
  plugins: {
492
494
  mocha: mocha__default
493
495
  },
@@ -506,15 +508,15 @@ const base$8 = {
506
508
  "mocha/no-mocha-arrows": "off"
507
509
  }
508
510
  };
509
- const configs$8 = {
510
- base: base$8
511
+ const configs$9 = {
512
+ base: base$9
511
513
  };
512
514
 
513
515
  const recommendedRules = {};
514
516
  for (const ruleName of Object.keys({ ...nextJs__default.configs.recommended.rules })) {
515
517
  recommendedRules[ruleName] = "error";
516
518
  }
517
- const base$7 = {
519
+ const base$8 = {
518
520
  plugins: {
519
521
  "@next/next": compat.fixupPluginRules(nextJs__default)
520
522
  },
@@ -522,11 +524,11 @@ const base$7 = {
522
524
  ...recommendedRules
523
525
  }
524
526
  };
525
- const configs$7 = {
526
- base: base$7
527
+ const configs$8 = {
528
+ base: base$8
527
529
  };
528
530
 
529
- const base$6 = {
531
+ const base$7 = {
530
532
  plugins: {
531
533
  promise: promise__default
532
534
  },
@@ -543,11 +545,11 @@ const base$6 = {
543
545
  "promise/param-names": "error"
544
546
  }
545
547
  };
546
- const configs$6 = {
547
- base: base$6
548
+ const configs$7 = {
549
+ base: base$7
548
550
  };
549
551
 
550
- const base$5 = {
552
+ const base$6 = {
551
553
  settings: {
552
554
  react: {
553
555
  version: "detect",
@@ -615,11 +617,11 @@ const base$5 = {
615
617
  "react-hooks/exhaustive-deps": "error"
616
618
  }
617
619
  };
618
- const configs$5 = {
619
- base: base$5
620
+ const configs$6 = {
621
+ base: base$6
620
622
  };
621
623
 
622
- const base$4 = {
624
+ const base$5 = {
623
625
  plugins: {
624
626
  security: security__default
625
627
  },
@@ -639,15 +641,15 @@ const base$4 = {
639
641
  "security/detect-unsafe-regex": "error"
640
642
  }
641
643
  };
642
- const configs$4 = {
643
- base: base$4
644
+ const configs$5 = {
645
+ base: base$5
644
646
  };
645
647
 
646
648
  const baseStylistic = stylistic__default.configs.customize({
647
649
  braceStyle: "1tbs",
648
650
  jsx: true
649
651
  });
650
- const base$3 = {
652
+ const base$4 = {
651
653
  ...baseStylistic,
652
654
  rules: {
653
655
  ...stylistic__default.configs["disable-legacy"].rules,
@@ -692,11 +694,11 @@ const base$3 = {
692
694
  ]
693
695
  }
694
696
  };
695
- const configs$3 = {
696
- base: base$3
697
+ const configs$4 = {
698
+ base: base$4
697
699
  };
698
700
 
699
- const base$2 = {
701
+ const base$3 = {
700
702
  plugins: {
701
703
  "testing-library": compat.fixupPluginRules(testingLibrary__default)
702
704
  },
@@ -708,11 +710,11 @@ const base$2 = {
708
710
  "testing-library/prefer-query-matchers": "off"
709
711
  }
710
712
  };
711
- const configs$2 = {
712
- base: base$2
713
+ const configs$3 = {
714
+ base: base$3
713
715
  };
714
716
 
715
- const base$1 = {
717
+ const base$2 = {
716
718
  rules: {
717
719
  "no-loss-of-precision": "off",
718
720
  "no-loop-func": "off",
@@ -782,11 +784,11 @@ const base$1 = {
782
784
  "@typescript-eslint/use-unknown-in-catch-callback-variable": "off"
783
785
  }
784
786
  };
785
- const configs$1 = {
786
- base: base$1
787
+ const configs$2 = {
788
+ base: base$2
787
789
  };
788
790
 
789
- const base = {
791
+ const base$1 = {
790
792
  plugins: {
791
793
  unicorn: unicorn__default
792
794
  },
@@ -801,6 +803,46 @@ const base = {
801
803
  "unicorn/prefer-set-has": "error"
802
804
  }
803
805
  };
806
+ const configs$1 = {
807
+ base: base$1
808
+ };
809
+
810
+ const base = {
811
+ plugins: {
812
+ vitest: vitest__default
813
+ },
814
+ rules: {
815
+ ...vitest__default.configs.recommended.rules,
816
+ "vitest/consistent-test-it": [
817
+ "error",
818
+ {
819
+ fn: "it",
820
+ withinDescribe: "it"
821
+ }
822
+ ],
823
+ "vitest/no-conditional-tests": "error",
824
+ "vitest/no-disabled-tests": "error",
825
+ "vitest/no-duplicate-hooks": "error",
826
+ "vitest/no-focused-tests": "error",
827
+ "vitest/no-standalone-expect": "error",
828
+ "vitest/no-test-prefixes": "error",
829
+ "vitest/padding-around-after-all-blocks": "error",
830
+ "vitest/padding-around-after-each-blocks": "error",
831
+ "vitest/padding-around-describe-blocks": "error",
832
+ "vitest/prefer-comparison-matcher": "error",
833
+ "vitest/prefer-equality-matcher": "error",
834
+ "vitest/prefer-hooks-in-order": "error",
835
+ "vitest/prefer-hooks-on-top": "error",
836
+ "vitest/prefer-lowercase-title": ["error", { ignore: ["describe"] }],
837
+ "vitest/prefer-mock-promise-shorthand": "error",
838
+ "vitest/prefer-snapshot-hint": "error",
839
+ "vitest/prefer-spy-on": "error",
840
+ "vitest/prefer-strict-equal": "error",
841
+ "vitest/prefer-vi-mocked": "error",
842
+ "vitest/require-to-throw-message": "error",
843
+ "vitest/require-top-level-describe": "error"
844
+ }
845
+ };
804
846
  const configs = {
805
847
  base
806
848
  };
@@ -809,6 +851,7 @@ const defaultConfig = tsEslintConfig;
809
851
  function tsEslintConfig(options) {
810
852
  const enableRequireExtensionRule = options?.enableRequireExtensionRule ?? true;
811
853
  const enableJest = options?.enableJest ?? true;
854
+ const enableVitest = options?.enableVitest ?? true;
812
855
  const enableMocha = options?.enableMocha ?? true;
813
856
  const enableReact = options?.enableReact ?? true;
814
857
  const enableNextJs = options?.enableNextJs ?? false;
@@ -842,40 +885,53 @@ function tsEslintConfig(options) {
842
885
  {
843
886
  languageOptions,
844
887
  settings: {
845
- ...configs$9.base.settings
888
+ ...configs$a.base.settings
846
889
  }
847
890
  },
848
891
  {
849
892
  name: "eslint-config-decent/base",
850
893
  files: ["**/*.ts", "**/*.js", "**/*.cjs", "**/*.mjs", "**/*.tsx"],
851
894
  plugins: {
895
+ ...configs$d.base.plugins,
852
896
  ...configs$c.base.plugins,
853
- ...configs$b.base.plugins,
854
- ...configs$9.base.plugins,
855
- ...configs$6.base.plugins,
856
- ...configs$4.base.plugins,
857
- ...configs.base.plugins
897
+ ...configs$a.base.plugins,
898
+ ...configs$7.base.plugins,
899
+ ...configs$5.base.plugins,
900
+ ...configs$1.base.plugins
858
901
  },
859
902
  rules: {
860
- ...configs$d.base.rules,
861
- ...enableRequireExtensionRule ? configs$c.base.rules : {},
862
- ...configs$b.base.rules,
863
- ...configs$9.base.rules,
864
- ...configs$6.base.rules,
865
- ...configs$4.base.rules,
866
- ...configs.base.rules
903
+ ...configs$e.base.rules,
904
+ ...enableRequireExtensionRule ? configs$d.base.rules : {},
905
+ ...configs$c.base.rules,
906
+ ...configs$a.base.rules,
907
+ ...configs$7.base.rules,
908
+ ...configs$5.base.rules,
909
+ ...configs$1.base.rules
867
910
  }
868
911
  },
869
912
  {
870
913
  name: "eslint-config-decent/ts",
871
914
  files: ["**/*.ts", "**/*.tsx"],
872
- ...configs$1.base
915
+ ...configs$2.base
873
916
  },
874
917
  ...enableReact ? [
875
918
  {
876
919
  name: "eslint-config-decent/tsx",
877
920
  files: ["**/*.tsx"],
878
- ...configs$5.base
921
+ ...configs$6.base
922
+ },
923
+ {
924
+ name: "eslint-config-decent/tsx-components",
925
+ files: ["**/components/**/*.tsx"],
926
+ rules: {
927
+ "import/no-default-export": "error",
928
+ "unicorn/filename-case": [
929
+ "error",
930
+ {
931
+ case: "pascalCase"
932
+ }
933
+ ]
934
+ }
879
935
  },
880
936
  {
881
937
  name: "eslint-config-decent/tsx-disable-ts-rules",
@@ -894,7 +950,7 @@ function tsEslintConfig(options) {
894
950
  rootDir: options?.nextJsRootDir
895
951
  }
896
952
  },
897
- ...configs$7.base
953
+ ...configs$8.base
898
954
  }
899
955
  ] : [],
900
956
  {
@@ -903,7 +959,7 @@ function tsEslintConfig(options) {
903
959
  languageOptions: {
904
960
  sourceType: "script"
905
961
  },
906
- ...configs$d.cjsAndEsm
962
+ ...configs$e.cjsAndEsm
907
963
  },
908
964
  {
909
965
  name: "eslint-config-decent/cjs",
@@ -911,27 +967,34 @@ function tsEslintConfig(options) {
911
967
  languageOptions: {
912
968
  sourceType: "script"
913
969
  },
914
- ...configs$d.cjs
970
+ ...configs$e.cjs
915
971
  },
916
972
  ...enableMocha ? [
917
973
  {
918
974
  name: "eslint-config-decent/mocha-tests",
919
975
  files: ["**/*.tests.ts", "tests/tests.ts"],
920
- ...configs$8.base
976
+ ...configs$9.base
921
977
  }
922
978
  ] : [],
923
979
  ...enableJest ? [
924
980
  {
925
981
  name: "eslint-config-decent/jest-tests",
926
982
  files: ["**/__tests__/**/*.ts?(x)", "**/*.{spec,test}.ts?(x)"],
927
- ...configs$a.base
983
+ ...configs$b.base
984
+ }
985
+ ] : [],
986
+ ...enableVitest ? [
987
+ {
988
+ name: "eslint-config-decent/vitest-tests",
989
+ files: ["**/__tests__/**/*.ts?(x)", "**/*.{spec,test}.ts?(x)"],
990
+ ...configs.base
928
991
  }
929
992
  ] : [],
930
993
  ...enableTestingLibrary ? [
931
994
  {
932
995
  name: "eslint-config-decent/testing-library",
933
996
  files: ["**/__tests__/**/*.ts?(x)", "**/*.{spec,test,tests}.ts?(x)"],
934
- ...configs$2.base
997
+ ...configs$3.base
935
998
  },
936
999
  {
937
1000
  name: "eslint-config-decent/testing-library-disable-ts-rules",
@@ -942,7 +1005,7 @@ function tsEslintConfig(options) {
942
1005
  }
943
1006
  ] : [],
944
1007
  {
945
- ...configs$3.base,
1008
+ ...configs$4.base,
946
1009
  name: "eslint-config-decent/stylistic",
947
1010
  files: ["**/*.ts", "**/*.js", "**/*.cjs", "**/*.mjs", "**/*.tsx"]
948
1011
  },
@@ -969,17 +1032,18 @@ function config(options) {
969
1032
 
970
1033
  exports.config = config;
971
1034
  exports.defaultConfig = defaultConfig;
972
- exports.eslintConfigs = configs$d;
973
- exports.extensionConfigs = configs$c;
974
- exports.importConfigs = configs$b;
975
- exports.jestConfigs = configs$a;
976
- exports.jsdocConfigs = configs$9;
977
- exports.mochaConfigs = configs$8;
978
- exports.nextJsConfigs = configs$7;
979
- exports.promiseConfigs = configs$6;
980
- exports.reactConfigs = configs$5;
981
- exports.securityConfigs = configs$4;
982
- exports.testingLibraryConfigs = configs$2;
1035
+ exports.eslintConfigs = configs$e;
1036
+ exports.extensionConfigs = configs$d;
1037
+ exports.importConfigs = configs$c;
1038
+ exports.jestConfigs = configs$b;
1039
+ exports.jsdocConfigs = configs$a;
1040
+ exports.mochaConfigs = configs$9;
1041
+ exports.nextJsConfigs = configs$8;
1042
+ exports.promiseConfigs = configs$7;
1043
+ exports.reactConfigs = configs$6;
1044
+ exports.securityConfigs = configs$5;
1045
+ exports.testingLibraryConfigs = configs$3;
983
1046
  exports.tsEslintConfig = tsEslintConfig;
984
- exports.typescriptEslintConfigs = configs$1;
985
- exports.unicornConfigs = configs;
1047
+ exports.typescriptEslintConfigs = configs$2;
1048
+ exports.unicornConfigs = configs$1;
1049
+ exports.vitestConfigs = configs;
package/dist/index.d.cts CHANGED
@@ -1,12 +1,16 @@
1
1
  import { TSESLint } from '@typescript-eslint/utils';
2
2
  import { ConfigWithExtends } from 'typescript-eslint';
3
3
 
4
- declare const configs$c: {
4
+ declare const configs$d: {
5
5
  base: TSESLint.FlatConfig.Config;
6
6
  cjsAndEsm: TSESLint.FlatConfig.Config;
7
7
  cjs: TSESLint.FlatConfig.Config;
8
8
  };
9
9
 
10
+ declare const configs$c: {
11
+ base: TSESLint.FlatConfig.Config;
12
+ };
13
+
10
14
  declare const configs$b: {
11
15
  base: TSESLint.FlatConfig.Config;
12
16
  };
@@ -60,6 +64,7 @@ interface DefaultConfigOptions {
60
64
  tsconfigRootDir?: string;
61
65
  enableRequireExtensionRule?: boolean;
62
66
  enableJest?: boolean;
67
+ enableVitest?: boolean;
63
68
  enableMocha?: boolean;
64
69
  enableReact?: boolean;
65
70
  enableNextJs?: boolean;
@@ -83,5 +88,5 @@ declare function tsEslintConfig(options?: DefaultConfigOptions): ConfigWithExten
83
88
  */
84
89
  declare function config(options?: DefaultConfigOptions): TSESLint.FlatConfig.ConfigArray;
85
90
 
86
- export { config, defaultConfig, configs$c as eslintConfigs, configs$b as extensionConfigs, configs$a as importConfigs, configs$9 as jestConfigs, configs$8 as jsdocConfigs, configs$7 as mochaConfigs, configs$6 as nextJsConfigs, configs$5 as promiseConfigs, configs$4 as reactConfigs, configs$3 as securityConfigs, configs$2 as testingLibraryConfigs, tsEslintConfig, configs$1 as typescriptEslintConfigs, configs as unicornConfigs };
91
+ export { config, defaultConfig, configs$d as eslintConfigs, configs$c as extensionConfigs, configs$b as importConfigs, configs$a as jestConfigs, configs$9 as jsdocConfigs, configs$8 as mochaConfigs, configs$7 as nextJsConfigs, configs$6 as promiseConfigs, configs$5 as reactConfigs, configs$4 as securityConfigs, configs$3 as testingLibraryConfigs, tsEslintConfig, configs$2 as typescriptEslintConfigs, configs$1 as unicornConfigs, configs as vitestConfigs };
87
92
  export type { DefaultConfigOptions };
package/dist/index.d.mts CHANGED
@@ -1,12 +1,16 @@
1
1
  import { TSESLint } from '@typescript-eslint/utils';
2
2
  import { ConfigWithExtends } from 'typescript-eslint';
3
3
 
4
- declare const configs$c: {
4
+ declare const configs$d: {
5
5
  base: TSESLint.FlatConfig.Config;
6
6
  cjsAndEsm: TSESLint.FlatConfig.Config;
7
7
  cjs: TSESLint.FlatConfig.Config;
8
8
  };
9
9
 
10
+ declare const configs$c: {
11
+ base: TSESLint.FlatConfig.Config;
12
+ };
13
+
10
14
  declare const configs$b: {
11
15
  base: TSESLint.FlatConfig.Config;
12
16
  };
@@ -60,6 +64,7 @@ interface DefaultConfigOptions {
60
64
  tsconfigRootDir?: string;
61
65
  enableRequireExtensionRule?: boolean;
62
66
  enableJest?: boolean;
67
+ enableVitest?: boolean;
63
68
  enableMocha?: boolean;
64
69
  enableReact?: boolean;
65
70
  enableNextJs?: boolean;
@@ -83,5 +88,5 @@ declare function tsEslintConfig(options?: DefaultConfigOptions): ConfigWithExten
83
88
  */
84
89
  declare function config(options?: DefaultConfigOptions): TSESLint.FlatConfig.ConfigArray;
85
90
 
86
- export { config, defaultConfig, configs$c as eslintConfigs, configs$b as extensionConfigs, configs$a as importConfigs, configs$9 as jestConfigs, configs$8 as jsdocConfigs, configs$7 as mochaConfigs, configs$6 as nextJsConfigs, configs$5 as promiseConfigs, configs$4 as reactConfigs, configs$3 as securityConfigs, configs$2 as testingLibraryConfigs, tsEslintConfig, configs$1 as typescriptEslintConfigs, configs as unicornConfigs };
91
+ export { config, defaultConfig, configs$d as eslintConfigs, configs$c as extensionConfigs, configs$b as importConfigs, configs$a as jestConfigs, configs$9 as jsdocConfigs, configs$8 as mochaConfigs, configs$7 as nextJsConfigs, configs$6 as promiseConfigs, configs$5 as reactConfigs, configs$4 as securityConfigs, configs$3 as testingLibraryConfigs, tsEslintConfig, configs$2 as typescriptEslintConfigs, configs$1 as unicornConfigs, configs as vitestConfigs };
87
92
  export type { DefaultConfigOptions };
package/dist/index.d.ts CHANGED
@@ -1,12 +1,16 @@
1
1
  import { TSESLint } from '@typescript-eslint/utils';
2
2
  import { ConfigWithExtends } from 'typescript-eslint';
3
3
 
4
- declare const configs$c: {
4
+ declare const configs$d: {
5
5
  base: TSESLint.FlatConfig.Config;
6
6
  cjsAndEsm: TSESLint.FlatConfig.Config;
7
7
  cjs: TSESLint.FlatConfig.Config;
8
8
  };
9
9
 
10
+ declare const configs$c: {
11
+ base: TSESLint.FlatConfig.Config;
12
+ };
13
+
10
14
  declare const configs$b: {
11
15
  base: TSESLint.FlatConfig.Config;
12
16
  };
@@ -60,6 +64,7 @@ interface DefaultConfigOptions {
60
64
  tsconfigRootDir?: string;
61
65
  enableRequireExtensionRule?: boolean;
62
66
  enableJest?: boolean;
67
+ enableVitest?: boolean;
63
68
  enableMocha?: boolean;
64
69
  enableReact?: boolean;
65
70
  enableNextJs?: boolean;
@@ -83,5 +88,5 @@ declare function tsEslintConfig(options?: DefaultConfigOptions): ConfigWithExten
83
88
  */
84
89
  declare function config(options?: DefaultConfigOptions): TSESLint.FlatConfig.ConfigArray;
85
90
 
86
- export { config, defaultConfig, configs$c as eslintConfigs, configs$b as extensionConfigs, configs$a as importConfigs, configs$9 as jestConfigs, configs$8 as jsdocConfigs, configs$7 as mochaConfigs, configs$6 as nextJsConfigs, configs$5 as promiseConfigs, configs$4 as reactConfigs, configs$3 as securityConfigs, configs$2 as testingLibraryConfigs, tsEslintConfig, configs$1 as typescriptEslintConfigs, configs as unicornConfigs };
91
+ export { config, defaultConfig, configs$d as eslintConfigs, configs$c as extensionConfigs, configs$b as importConfigs, configs$a as jestConfigs, configs$9 as jsdocConfigs, configs$8 as mochaConfigs, configs$7 as nextJsConfigs, configs$6 as promiseConfigs, configs$5 as reactConfigs, configs$4 as securityConfigs, configs$3 as testingLibraryConfigs, tsEslintConfig, configs$2 as typescriptEslintConfigs, configs$1 as unicornConfigs, configs as vitestConfigs };
87
92
  export type { DefaultConfigOptions };
package/dist/index.mjs CHANGED
@@ -20,8 +20,9 @@ import security from 'eslint-plugin-security';
20
20
  import stylistic from '@stylistic/eslint-plugin';
21
21
  import testingLibrary from 'eslint-plugin-testing-library';
22
22
  import unicorn from 'eslint-plugin-unicorn';
23
+ import vitest from '@vitest/eslint-plugin';
23
24
 
24
- const base$d = {
25
+ const base$e = {
25
26
  rules: {
26
27
  "array-callback-return": ["error", { allowImplicit: true }],
27
28
  "block-scoped-var": "error",
@@ -229,8 +230,8 @@ const cjs = {
229
230
  strict: ["error", "global"]
230
231
  }
231
232
  };
232
- const configs$d = {
233
- base: base$d,
233
+ const configs$e = {
234
+ base: base$e,
234
235
  cjsAndEsm,
235
236
  cjs
236
237
  };
@@ -329,7 +330,7 @@ const requireIndexRule = ESLintUtils.RuleCreator(() => "https://github.com/jgeur
329
330
  }
330
331
  });
331
332
 
332
- const base$c = {
333
+ const base$d = {
333
334
  plugins: {
334
335
  "decent-extension": {
335
336
  meta: {
@@ -347,11 +348,11 @@ const base$c = {
347
348
  "decent-extension/require-index": "error"
348
349
  }
349
350
  };
350
- const configs$c = {
351
- base: base$c
351
+ const configs$d = {
352
+ base: base$d
352
353
  };
353
354
 
354
- const base$b = {
355
+ const base$c = {
355
356
  plugins: {
356
357
  import: importPlugin
357
358
  },
@@ -366,11 +367,11 @@ const base$b = {
366
367
  ]
367
368
  }
368
369
  };
369
- const configs$b = {
370
- base: base$b
370
+ const configs$c = {
371
+ base: base$c
371
372
  };
372
373
 
373
- const base$a = {
374
+ const base$b = {
374
375
  plugins: {
375
376
  jest,
376
377
  "jest-dom": jestDom
@@ -413,11 +414,11 @@ const base$a = {
413
414
  "@typescript-eslint/unbound-method": "off"
414
415
  }
415
416
  };
416
- const configs$a = {
417
- base: base$a
417
+ const configs$b = {
418
+ base: base$b
418
419
  };
419
420
 
420
- const base$9 = {
421
+ const base$a = {
421
422
  settings: {
422
423
  jsdoc: {
423
424
  preferredTypes: {
@@ -460,11 +461,11 @@ const base$9 = {
460
461
  "jsdoc/valid-types": "error"
461
462
  }
462
463
  };
463
- const configs$9 = {
464
- base: base$9
464
+ const configs$a = {
465
+ base: base$a
465
466
  };
466
467
 
467
- const base$8 = {
468
+ const base$9 = {
468
469
  plugins: {
469
470
  mocha
470
471
  },
@@ -483,15 +484,15 @@ const base$8 = {
483
484
  "mocha/no-mocha-arrows": "off"
484
485
  }
485
486
  };
486
- const configs$8 = {
487
- base: base$8
487
+ const configs$9 = {
488
+ base: base$9
488
489
  };
489
490
 
490
491
  const recommendedRules = {};
491
492
  for (const ruleName of Object.keys({ ...nextJs.configs.recommended.rules })) {
492
493
  recommendedRules[ruleName] = "error";
493
494
  }
494
- const base$7 = {
495
+ const base$8 = {
495
496
  plugins: {
496
497
  "@next/next": fixupPluginRules(nextJs)
497
498
  },
@@ -499,11 +500,11 @@ const base$7 = {
499
500
  ...recommendedRules
500
501
  }
501
502
  };
502
- const configs$7 = {
503
- base: base$7
503
+ const configs$8 = {
504
+ base: base$8
504
505
  };
505
506
 
506
- const base$6 = {
507
+ const base$7 = {
507
508
  plugins: {
508
509
  promise
509
510
  },
@@ -520,11 +521,11 @@ const base$6 = {
520
521
  "promise/param-names": "error"
521
522
  }
522
523
  };
523
- const configs$6 = {
524
- base: base$6
524
+ const configs$7 = {
525
+ base: base$7
525
526
  };
526
527
 
527
- const base$5 = {
528
+ const base$6 = {
528
529
  settings: {
529
530
  react: {
530
531
  version: "detect",
@@ -592,11 +593,11 @@ const base$5 = {
592
593
  "react-hooks/exhaustive-deps": "error"
593
594
  }
594
595
  };
595
- const configs$5 = {
596
- base: base$5
596
+ const configs$6 = {
597
+ base: base$6
597
598
  };
598
599
 
599
- const base$4 = {
600
+ const base$5 = {
600
601
  plugins: {
601
602
  security
602
603
  },
@@ -616,15 +617,15 @@ const base$4 = {
616
617
  "security/detect-unsafe-regex": "error"
617
618
  }
618
619
  };
619
- const configs$4 = {
620
- base: base$4
620
+ const configs$5 = {
621
+ base: base$5
621
622
  };
622
623
 
623
624
  const baseStylistic = stylistic.configs.customize({
624
625
  braceStyle: "1tbs",
625
626
  jsx: true
626
627
  });
627
- const base$3 = {
628
+ const base$4 = {
628
629
  ...baseStylistic,
629
630
  rules: {
630
631
  ...stylistic.configs["disable-legacy"].rules,
@@ -669,11 +670,11 @@ const base$3 = {
669
670
  ]
670
671
  }
671
672
  };
672
- const configs$3 = {
673
- base: base$3
673
+ const configs$4 = {
674
+ base: base$4
674
675
  };
675
676
 
676
- const base$2 = {
677
+ const base$3 = {
677
678
  plugins: {
678
679
  "testing-library": fixupPluginRules(testingLibrary)
679
680
  },
@@ -685,11 +686,11 @@ const base$2 = {
685
686
  "testing-library/prefer-query-matchers": "off"
686
687
  }
687
688
  };
688
- const configs$2 = {
689
- base: base$2
689
+ const configs$3 = {
690
+ base: base$3
690
691
  };
691
692
 
692
- const base$1 = {
693
+ const base$2 = {
693
694
  rules: {
694
695
  "no-loss-of-precision": "off",
695
696
  "no-loop-func": "off",
@@ -759,11 +760,11 @@ const base$1 = {
759
760
  "@typescript-eslint/use-unknown-in-catch-callback-variable": "off"
760
761
  }
761
762
  };
762
- const configs$1 = {
763
- base: base$1
763
+ const configs$2 = {
764
+ base: base$2
764
765
  };
765
766
 
766
- const base = {
767
+ const base$1 = {
767
768
  plugins: {
768
769
  unicorn
769
770
  },
@@ -778,6 +779,46 @@ const base = {
778
779
  "unicorn/prefer-set-has": "error"
779
780
  }
780
781
  };
782
+ const configs$1 = {
783
+ base: base$1
784
+ };
785
+
786
+ const base = {
787
+ plugins: {
788
+ vitest
789
+ },
790
+ rules: {
791
+ ...vitest.configs.recommended.rules,
792
+ "vitest/consistent-test-it": [
793
+ "error",
794
+ {
795
+ fn: "it",
796
+ withinDescribe: "it"
797
+ }
798
+ ],
799
+ "vitest/no-conditional-tests": "error",
800
+ "vitest/no-disabled-tests": "error",
801
+ "vitest/no-duplicate-hooks": "error",
802
+ "vitest/no-focused-tests": "error",
803
+ "vitest/no-standalone-expect": "error",
804
+ "vitest/no-test-prefixes": "error",
805
+ "vitest/padding-around-after-all-blocks": "error",
806
+ "vitest/padding-around-after-each-blocks": "error",
807
+ "vitest/padding-around-describe-blocks": "error",
808
+ "vitest/prefer-comparison-matcher": "error",
809
+ "vitest/prefer-equality-matcher": "error",
810
+ "vitest/prefer-hooks-in-order": "error",
811
+ "vitest/prefer-hooks-on-top": "error",
812
+ "vitest/prefer-lowercase-title": ["error", { ignore: ["describe"] }],
813
+ "vitest/prefer-mock-promise-shorthand": "error",
814
+ "vitest/prefer-snapshot-hint": "error",
815
+ "vitest/prefer-spy-on": "error",
816
+ "vitest/prefer-strict-equal": "error",
817
+ "vitest/prefer-vi-mocked": "error",
818
+ "vitest/require-to-throw-message": "error",
819
+ "vitest/require-top-level-describe": "error"
820
+ }
821
+ };
781
822
  const configs = {
782
823
  base
783
824
  };
@@ -786,6 +827,7 @@ const defaultConfig = tsEslintConfig;
786
827
  function tsEslintConfig(options) {
787
828
  const enableRequireExtensionRule = options?.enableRequireExtensionRule ?? true;
788
829
  const enableJest = options?.enableJest ?? true;
830
+ const enableVitest = options?.enableVitest ?? true;
789
831
  const enableMocha = options?.enableMocha ?? true;
790
832
  const enableReact = options?.enableReact ?? true;
791
833
  const enableNextJs = options?.enableNextJs ?? false;
@@ -819,40 +861,53 @@ function tsEslintConfig(options) {
819
861
  {
820
862
  languageOptions,
821
863
  settings: {
822
- ...configs$9.base.settings
864
+ ...configs$a.base.settings
823
865
  }
824
866
  },
825
867
  {
826
868
  name: "eslint-config-decent/base",
827
869
  files: ["**/*.ts", "**/*.js", "**/*.cjs", "**/*.mjs", "**/*.tsx"],
828
870
  plugins: {
871
+ ...configs$d.base.plugins,
829
872
  ...configs$c.base.plugins,
830
- ...configs$b.base.plugins,
831
- ...configs$9.base.plugins,
832
- ...configs$6.base.plugins,
833
- ...configs$4.base.plugins,
834
- ...configs.base.plugins
873
+ ...configs$a.base.plugins,
874
+ ...configs$7.base.plugins,
875
+ ...configs$5.base.plugins,
876
+ ...configs$1.base.plugins
835
877
  },
836
878
  rules: {
837
- ...configs$d.base.rules,
838
- ...enableRequireExtensionRule ? configs$c.base.rules : {},
839
- ...configs$b.base.rules,
840
- ...configs$9.base.rules,
841
- ...configs$6.base.rules,
842
- ...configs$4.base.rules,
843
- ...configs.base.rules
879
+ ...configs$e.base.rules,
880
+ ...enableRequireExtensionRule ? configs$d.base.rules : {},
881
+ ...configs$c.base.rules,
882
+ ...configs$a.base.rules,
883
+ ...configs$7.base.rules,
884
+ ...configs$5.base.rules,
885
+ ...configs$1.base.rules
844
886
  }
845
887
  },
846
888
  {
847
889
  name: "eslint-config-decent/ts",
848
890
  files: ["**/*.ts", "**/*.tsx"],
849
- ...configs$1.base
891
+ ...configs$2.base
850
892
  },
851
893
  ...enableReact ? [
852
894
  {
853
895
  name: "eslint-config-decent/tsx",
854
896
  files: ["**/*.tsx"],
855
- ...configs$5.base
897
+ ...configs$6.base
898
+ },
899
+ {
900
+ name: "eslint-config-decent/tsx-components",
901
+ files: ["**/components/**/*.tsx"],
902
+ rules: {
903
+ "import/no-default-export": "error",
904
+ "unicorn/filename-case": [
905
+ "error",
906
+ {
907
+ case: "pascalCase"
908
+ }
909
+ ]
910
+ }
856
911
  },
857
912
  {
858
913
  name: "eslint-config-decent/tsx-disable-ts-rules",
@@ -871,7 +926,7 @@ function tsEslintConfig(options) {
871
926
  rootDir: options?.nextJsRootDir
872
927
  }
873
928
  },
874
- ...configs$7.base
929
+ ...configs$8.base
875
930
  }
876
931
  ] : [],
877
932
  {
@@ -880,7 +935,7 @@ function tsEslintConfig(options) {
880
935
  languageOptions: {
881
936
  sourceType: "script"
882
937
  },
883
- ...configs$d.cjsAndEsm
938
+ ...configs$e.cjsAndEsm
884
939
  },
885
940
  {
886
941
  name: "eslint-config-decent/cjs",
@@ -888,27 +943,34 @@ function tsEslintConfig(options) {
888
943
  languageOptions: {
889
944
  sourceType: "script"
890
945
  },
891
- ...configs$d.cjs
946
+ ...configs$e.cjs
892
947
  },
893
948
  ...enableMocha ? [
894
949
  {
895
950
  name: "eslint-config-decent/mocha-tests",
896
951
  files: ["**/*.tests.ts", "tests/tests.ts"],
897
- ...configs$8.base
952
+ ...configs$9.base
898
953
  }
899
954
  ] : [],
900
955
  ...enableJest ? [
901
956
  {
902
957
  name: "eslint-config-decent/jest-tests",
903
958
  files: ["**/__tests__/**/*.ts?(x)", "**/*.{spec,test}.ts?(x)"],
904
- ...configs$a.base
959
+ ...configs$b.base
960
+ }
961
+ ] : [],
962
+ ...enableVitest ? [
963
+ {
964
+ name: "eslint-config-decent/vitest-tests",
965
+ files: ["**/__tests__/**/*.ts?(x)", "**/*.{spec,test}.ts?(x)"],
966
+ ...configs.base
905
967
  }
906
968
  ] : [],
907
969
  ...enableTestingLibrary ? [
908
970
  {
909
971
  name: "eslint-config-decent/testing-library",
910
972
  files: ["**/__tests__/**/*.ts?(x)", "**/*.{spec,test,tests}.ts?(x)"],
911
- ...configs$2.base
973
+ ...configs$3.base
912
974
  },
913
975
  {
914
976
  name: "eslint-config-decent/testing-library-disable-ts-rules",
@@ -919,7 +981,7 @@ function tsEslintConfig(options) {
919
981
  }
920
982
  ] : [],
921
983
  {
922
- ...configs$3.base,
984
+ ...configs$4.base,
923
985
  name: "eslint-config-decent/stylistic",
924
986
  files: ["**/*.ts", "**/*.js", "**/*.cjs", "**/*.mjs", "**/*.tsx"]
925
987
  },
@@ -944,4 +1006,4 @@ function config(options) {
944
1006
  return tsEslint.config(...tsEslintConfig(options));
945
1007
  }
946
1008
 
947
- export { config, defaultConfig, configs$d as eslintConfigs, configs$c as extensionConfigs, configs$b as importConfigs, configs$a as jestConfigs, configs$9 as jsdocConfigs, configs$8 as mochaConfigs, configs$7 as nextJsConfigs, configs$6 as promiseConfigs, configs$5 as reactConfigs, configs$4 as securityConfigs, configs$2 as testingLibraryConfigs, tsEslintConfig, configs$1 as typescriptEslintConfigs, configs as unicornConfigs };
1009
+ export { config, defaultConfig, configs$e as eslintConfigs, configs$d as extensionConfigs, configs$c as importConfigs, configs$b as jestConfigs, configs$a as jsdocConfigs, configs$9 as mochaConfigs, configs$8 as nextJsConfigs, configs$7 as promiseConfigs, configs$6 as reactConfigs, configs$5 as securityConfigs, configs$3 as testingLibraryConfigs, tsEslintConfig, configs$2 as typescriptEslintConfigs, configs$1 as unicornConfigs, configs as vitestConfigs };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-config-decent",
3
- "version": "2.6.7",
3
+ "version": "2.8.0",
4
4
  "description": "A decent ESLint configuration",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
@@ -66,42 +66,43 @@
66
66
  "node": ">=20.11.0"
67
67
  },
68
68
  "dependencies": {
69
- "@eslint/compat": "1.2.8",
70
- "@eslint/js": "9.25.1",
69
+ "@eslint/compat": "1.2.9",
70
+ "@eslint/js": "9.26.0",
71
71
  "@next/eslint-plugin-next": "15.3.1",
72
72
  "@stylistic/eslint-plugin": "4.2.0",
73
- "@typescript-eslint/utils": "8.31.0",
73
+ "@typescript-eslint/utils": "8.32.0",
74
+ "@vitest/eslint-plugin": "1.1.44",
74
75
  "eslint-config-prettier": "10.1.2",
75
- "eslint-plugin-import-x": "4.10.6",
76
+ "eslint-plugin-import-x": "4.11.0",
76
77
  "eslint-plugin-jest": "28.11.0",
77
78
  "eslint-plugin-jest-dom": "5.5.0",
78
- "eslint-plugin-jsdoc": "50.6.9",
79
+ "eslint-plugin-jsdoc": "50.6.11",
79
80
  "eslint-plugin-jsx-a11y": "6.10.2",
80
- "eslint-plugin-mocha": "10.5.0",
81
- "eslint-plugin-prettier": "5.2.6",
81
+ "eslint-plugin-mocha": "11.0.0",
82
+ "eslint-plugin-prettier": "5.4.0",
82
83
  "eslint-plugin-promise": "7.2.1",
83
84
  "eslint-plugin-react": "7.37.5",
84
85
  "eslint-plugin-react-hooks": "6.0.0",
85
86
  "eslint-plugin-security": "3.0.1",
86
87
  "eslint-plugin-testing-library": "7.1.1",
87
- "eslint-plugin-unicorn": "58.0.0",
88
+ "eslint-plugin-unicorn": "59.0.1",
88
89
  "globals": "16.0.0",
89
- "typescript-eslint": "8.31.0"
90
+ "typescript-eslint": "8.32.0"
90
91
  },
91
92
  "devDependencies": {
92
93
  "@semantic-release/changelog": "6.0.3",
93
94
  "@semantic-release/commit-analyzer": "13.0.1",
94
95
  "@semantic-release/git": "10.0.1",
95
- "@semantic-release/github": "11.0.1",
96
+ "@semantic-release/github": "11.0.2",
96
97
  "@semantic-release/npm": "12.0.1",
97
98
  "@semantic-release/release-notes-generator": "14.0.3",
98
- "@swc/core": "1.11.21",
99
+ "@swc/core": "1.11.24",
99
100
  "@types/node": ">=22",
100
- "eslint": "9.25.1",
101
+ "eslint": "9.26.0",
101
102
  "husky": "9.1.7",
102
- "lint-staged": "15.5.1",
103
+ "lint-staged": "15.5.2",
103
104
  "markdownlint-cli": "0.44.0",
104
- "npm-run-all2": "7.0.2",
105
+ "npm-run-all2": "8.0.1",
105
106
  "pinst": "3.0.0",
106
107
  "prettier": "3.5.3",
107
108
  "semantic-release": "24.2.3",
package/src/index.ts CHANGED
@@ -18,6 +18,7 @@ import { configs as stylisticConfigs } from './stylistic.js';
18
18
  import { configs as testingLibraryConfigs } from './testingLibrary.js';
19
19
  import { configs as typescriptEslintConfigs } from './typescriptEslint.js';
20
20
  import { configs as unicornConfigs } from './unicorn.js';
21
+ import { configs as vitestConfigs } from './vitest.js';
21
22
 
22
23
  export {
23
24
  eslintConfigs, //
@@ -33,6 +34,7 @@ export {
33
34
  testingLibraryConfigs,
34
35
  typescriptEslintConfigs,
35
36
  unicornConfigs,
37
+ vitestConfigs,
36
38
  };
37
39
 
38
40
  export interface DefaultConfigOptions {
@@ -40,6 +42,7 @@ export interface DefaultConfigOptions {
40
42
  tsconfigRootDir?: string;
41
43
  enableRequireExtensionRule?: boolean;
42
44
  enableJest?: boolean;
45
+ enableVitest?: boolean;
43
46
  enableMocha?: boolean;
44
47
  enableReact?: boolean;
45
48
  enableNextJs?: boolean;
@@ -60,6 +63,7 @@ export const defaultConfig = tsEslintConfig;
60
63
  export function tsEslintConfig(options?: DefaultConfigOptions): ConfigWithExtends[] {
61
64
  const enableRequireExtensionRule = options?.enableRequireExtensionRule ?? true;
62
65
  const enableJest = options?.enableJest ?? true;
66
+ const enableVitest = options?.enableVitest ?? true;
63
67
  const enableMocha = options?.enableMocha ?? true;
64
68
  const enableReact = options?.enableReact ?? true;
65
69
  const enableNextJs = options?.enableNextJs ?? false;
@@ -130,6 +134,19 @@ export function tsEslintConfig(options?: DefaultConfigOptions): ConfigWithExtend
130
134
  files: ['**/*.tsx'],
131
135
  ...reactConfigs.base,
132
136
  },
137
+ {
138
+ name: 'eslint-config-decent/tsx-components',
139
+ files: ['**/components/**/*.tsx'],
140
+ rules: {
141
+ 'import/no-default-export': 'error',
142
+ 'unicorn/filename-case': [
143
+ 'error',
144
+ {
145
+ case: 'pascalCase',
146
+ },
147
+ ],
148
+ },
149
+ },
133
150
  {
134
151
  name: 'eslint-config-decent/tsx-disable-ts-rules',
135
152
  files: ['**/*.tsx'],
@@ -189,6 +206,16 @@ export function tsEslintConfig(options?: DefaultConfigOptions): ConfigWithExtend
189
206
  },
190
207
  ]
191
208
  : []),
209
+ ...(enableVitest
210
+ ? [
211
+ {
212
+ name: 'eslint-config-decent/vitest-tests',
213
+ files: ['**/__tests__/**/*.ts?(x)', '**/*.{spec,test}.ts?(x)'],
214
+
215
+ ...vitestConfigs.base,
216
+ },
217
+ ]
218
+ : []),
192
219
  ...(enableTestingLibrary
193
220
  ? ([
194
221
  {
package/src/vitest.ts ADDED
@@ -0,0 +1,47 @@
1
+ import type { TSESLint } from '@typescript-eslint/utils';
2
+ import vitest from '@vitest/eslint-plugin';
3
+
4
+ const base: TSESLint.FlatConfig.Config = {
5
+ plugins: {
6
+ vitest,
7
+ },
8
+ rules: {
9
+ ...vitest.configs.recommended.rules,
10
+ 'vitest/consistent-test-it': [
11
+ 'error',
12
+ {
13
+ fn: 'it',
14
+ withinDescribe: 'it',
15
+ },
16
+ ],
17
+ 'vitest/no-conditional-tests': 'error',
18
+ 'vitest/no-disabled-tests': 'error',
19
+ 'vitest/no-duplicate-hooks': 'error',
20
+ 'vitest/no-focused-tests': 'error',
21
+ 'vitest/no-standalone-expect': 'error',
22
+ 'vitest/no-test-prefixes': 'error',
23
+ 'vitest/padding-around-after-all-blocks': 'error',
24
+ 'vitest/padding-around-after-each-blocks': 'error',
25
+ 'vitest/padding-around-describe-blocks': 'error',
26
+ 'vitest/prefer-comparison-matcher': 'error',
27
+ 'vitest/prefer-equality-matcher': 'error',
28
+ 'vitest/prefer-hooks-in-order': 'error',
29
+ 'vitest/prefer-hooks-on-top': 'error',
30
+ 'vitest/prefer-lowercase-title': ['error', { ignore: ['describe'] }],
31
+ 'vitest/prefer-mock-promise-shorthand': 'error',
32
+ 'vitest/prefer-snapshot-hint': 'error',
33
+ 'vitest/prefer-spy-on': 'error',
34
+ 'vitest/prefer-strict-equal': 'error',
35
+ 'vitest/prefer-vi-mocked': 'error',
36
+ 'vitest/require-to-throw-message': 'error',
37
+ 'vitest/require-top-level-describe': 'error',
38
+ },
39
+ };
40
+
41
+ export const configs = {
42
+ base,
43
+ };
44
+
45
+ export default {
46
+ configs,
47
+ };