eslint-config-decent 2.6.7 → 2.7.1
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 +126 -75
- package/dist/index.d.cts +7 -2
- package/dist/index.d.mts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.mjs +112 -63
- package/package.json +15 -14
- package/src/index.ts +14 -0
- package/src/vitest.ts +47 -0
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$
|
|
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$
|
|
256
|
-
base: base$
|
|
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$
|
|
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$
|
|
374
|
-
base: base$
|
|
375
|
+
const configs$d = {
|
|
376
|
+
base: base$d
|
|
375
377
|
};
|
|
376
378
|
|
|
377
|
-
const base$
|
|
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$
|
|
393
|
-
base: base$
|
|
394
|
+
const configs$c = {
|
|
395
|
+
base: base$c
|
|
394
396
|
};
|
|
395
397
|
|
|
396
|
-
const base$
|
|
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$
|
|
440
|
-
base: base$
|
|
441
|
+
const configs$b = {
|
|
442
|
+
base: base$b
|
|
441
443
|
};
|
|
442
444
|
|
|
443
|
-
const base$
|
|
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$
|
|
487
|
-
base: base$
|
|
488
|
+
const configs$a = {
|
|
489
|
+
base: base$a
|
|
488
490
|
};
|
|
489
491
|
|
|
490
|
-
const base$
|
|
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$
|
|
510
|
-
base: base$
|
|
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$
|
|
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$
|
|
526
|
-
base: base$
|
|
527
|
+
const configs$8 = {
|
|
528
|
+
base: base$8
|
|
527
529
|
};
|
|
528
530
|
|
|
529
|
-
const base$
|
|
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$
|
|
547
|
-
base: base$
|
|
548
|
+
const configs$7 = {
|
|
549
|
+
base: base$7
|
|
548
550
|
};
|
|
549
551
|
|
|
550
|
-
const base$
|
|
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$
|
|
619
|
-
base: base$
|
|
620
|
+
const configs$6 = {
|
|
621
|
+
base: base$6
|
|
620
622
|
};
|
|
621
623
|
|
|
622
|
-
const base$
|
|
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$
|
|
643
|
-
base: base$
|
|
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$
|
|
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$
|
|
696
|
-
base: base$
|
|
697
|
+
const configs$4 = {
|
|
698
|
+
base: base$4
|
|
697
699
|
};
|
|
698
700
|
|
|
699
|
-
const base$
|
|
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$
|
|
712
|
-
base: base$
|
|
713
|
+
const configs$3 = {
|
|
714
|
+
base: base$3
|
|
713
715
|
};
|
|
714
716
|
|
|
715
|
-
const base$
|
|
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$
|
|
786
|
-
base: base$
|
|
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,40 @@ function tsEslintConfig(options) {
|
|
|
842
885
|
{
|
|
843
886
|
languageOptions,
|
|
844
887
|
settings: {
|
|
845
|
-
...configs$
|
|
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$
|
|
854
|
-
...configs$
|
|
855
|
-
...configs$
|
|
856
|
-
...configs$
|
|
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$
|
|
861
|
-
...enableRequireExtensionRule ? configs$
|
|
862
|
-
...configs$
|
|
863
|
-
...configs$
|
|
864
|
-
...configs$
|
|
865
|
-
...configs$
|
|
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$
|
|
915
|
+
...configs$2.base
|
|
873
916
|
},
|
|
874
917
|
...enableReact ? [
|
|
875
918
|
{
|
|
876
919
|
name: "eslint-config-decent/tsx",
|
|
877
920
|
files: ["**/*.tsx"],
|
|
878
|
-
...configs$
|
|
921
|
+
...configs$6.base
|
|
879
922
|
},
|
|
880
923
|
{
|
|
881
924
|
name: "eslint-config-decent/tsx-disable-ts-rules",
|
|
@@ -894,7 +937,7 @@ function tsEslintConfig(options) {
|
|
|
894
937
|
rootDir: options?.nextJsRootDir
|
|
895
938
|
}
|
|
896
939
|
},
|
|
897
|
-
...configs$
|
|
940
|
+
...configs$8.base
|
|
898
941
|
}
|
|
899
942
|
] : [],
|
|
900
943
|
{
|
|
@@ -903,7 +946,7 @@ function tsEslintConfig(options) {
|
|
|
903
946
|
languageOptions: {
|
|
904
947
|
sourceType: "script"
|
|
905
948
|
},
|
|
906
|
-
...configs$
|
|
949
|
+
...configs$e.cjsAndEsm
|
|
907
950
|
},
|
|
908
951
|
{
|
|
909
952
|
name: "eslint-config-decent/cjs",
|
|
@@ -911,27 +954,34 @@ function tsEslintConfig(options) {
|
|
|
911
954
|
languageOptions: {
|
|
912
955
|
sourceType: "script"
|
|
913
956
|
},
|
|
914
|
-
...configs$
|
|
957
|
+
...configs$e.cjs
|
|
915
958
|
},
|
|
916
959
|
...enableMocha ? [
|
|
917
960
|
{
|
|
918
961
|
name: "eslint-config-decent/mocha-tests",
|
|
919
962
|
files: ["**/*.tests.ts", "tests/tests.ts"],
|
|
920
|
-
...configs$
|
|
963
|
+
...configs$9.base
|
|
921
964
|
}
|
|
922
965
|
] : [],
|
|
923
966
|
...enableJest ? [
|
|
924
967
|
{
|
|
925
968
|
name: "eslint-config-decent/jest-tests",
|
|
926
969
|
files: ["**/__tests__/**/*.ts?(x)", "**/*.{spec,test}.ts?(x)"],
|
|
927
|
-
...configs$
|
|
970
|
+
...configs$b.base
|
|
971
|
+
}
|
|
972
|
+
] : [],
|
|
973
|
+
...enableVitest ? [
|
|
974
|
+
{
|
|
975
|
+
name: "eslint-config-decent/vitest-tests",
|
|
976
|
+
files: ["**/__tests__/**/*.ts?(x)", "**/*.{spec,test}.ts?(x)"],
|
|
977
|
+
...configs.base
|
|
928
978
|
}
|
|
929
979
|
] : [],
|
|
930
980
|
...enableTestingLibrary ? [
|
|
931
981
|
{
|
|
932
982
|
name: "eslint-config-decent/testing-library",
|
|
933
983
|
files: ["**/__tests__/**/*.ts?(x)", "**/*.{spec,test,tests}.ts?(x)"],
|
|
934
|
-
...configs$
|
|
984
|
+
...configs$3.base
|
|
935
985
|
},
|
|
936
986
|
{
|
|
937
987
|
name: "eslint-config-decent/testing-library-disable-ts-rules",
|
|
@@ -942,7 +992,7 @@ function tsEslintConfig(options) {
|
|
|
942
992
|
}
|
|
943
993
|
] : [],
|
|
944
994
|
{
|
|
945
|
-
...configs$
|
|
995
|
+
...configs$4.base,
|
|
946
996
|
name: "eslint-config-decent/stylistic",
|
|
947
997
|
files: ["**/*.ts", "**/*.js", "**/*.cjs", "**/*.mjs", "**/*.tsx"]
|
|
948
998
|
},
|
|
@@ -969,17 +1019,18 @@ function config(options) {
|
|
|
969
1019
|
|
|
970
1020
|
exports.config = config;
|
|
971
1021
|
exports.defaultConfig = defaultConfig;
|
|
972
|
-
exports.eslintConfigs = configs$
|
|
973
|
-
exports.extensionConfigs = configs$
|
|
974
|
-
exports.importConfigs = configs$
|
|
975
|
-
exports.jestConfigs = configs$
|
|
976
|
-
exports.jsdocConfigs = configs$
|
|
977
|
-
exports.mochaConfigs = configs$
|
|
978
|
-
exports.nextJsConfigs = configs$
|
|
979
|
-
exports.promiseConfigs = configs$
|
|
980
|
-
exports.reactConfigs = configs$
|
|
981
|
-
exports.securityConfigs = configs$
|
|
982
|
-
exports.testingLibraryConfigs = configs$
|
|
1022
|
+
exports.eslintConfigs = configs$e;
|
|
1023
|
+
exports.extensionConfigs = configs$d;
|
|
1024
|
+
exports.importConfigs = configs$c;
|
|
1025
|
+
exports.jestConfigs = configs$b;
|
|
1026
|
+
exports.jsdocConfigs = configs$a;
|
|
1027
|
+
exports.mochaConfigs = configs$9;
|
|
1028
|
+
exports.nextJsConfigs = configs$8;
|
|
1029
|
+
exports.promiseConfigs = configs$7;
|
|
1030
|
+
exports.reactConfigs = configs$6;
|
|
1031
|
+
exports.securityConfigs = configs$5;
|
|
1032
|
+
exports.testingLibraryConfigs = configs$3;
|
|
983
1033
|
exports.tsEslintConfig = tsEslintConfig;
|
|
984
|
-
exports.typescriptEslintConfigs = configs$
|
|
985
|
-
exports.unicornConfigs = configs;
|
|
1034
|
+
exports.typescriptEslintConfigs = configs$2;
|
|
1035
|
+
exports.unicornConfigs = configs$1;
|
|
1036
|
+
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
233
|
-
base: base$
|
|
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$
|
|
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$
|
|
351
|
-
base: base$
|
|
351
|
+
const configs$d = {
|
|
352
|
+
base: base$d
|
|
352
353
|
};
|
|
353
354
|
|
|
354
|
-
const base$
|
|
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$
|
|
370
|
-
base: base$
|
|
370
|
+
const configs$c = {
|
|
371
|
+
base: base$c
|
|
371
372
|
};
|
|
372
373
|
|
|
373
|
-
const base$
|
|
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$
|
|
417
|
-
base: base$
|
|
417
|
+
const configs$b = {
|
|
418
|
+
base: base$b
|
|
418
419
|
};
|
|
419
420
|
|
|
420
|
-
const base$
|
|
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$
|
|
464
|
-
base: base$
|
|
464
|
+
const configs$a = {
|
|
465
|
+
base: base$a
|
|
465
466
|
};
|
|
466
467
|
|
|
467
|
-
const base$
|
|
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$
|
|
487
|
-
base: base$
|
|
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$
|
|
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$
|
|
503
|
-
base: base$
|
|
503
|
+
const configs$8 = {
|
|
504
|
+
base: base$8
|
|
504
505
|
};
|
|
505
506
|
|
|
506
|
-
const base$
|
|
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$
|
|
524
|
-
base: base$
|
|
524
|
+
const configs$7 = {
|
|
525
|
+
base: base$7
|
|
525
526
|
};
|
|
526
527
|
|
|
527
|
-
const base$
|
|
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$
|
|
596
|
-
base: base$
|
|
596
|
+
const configs$6 = {
|
|
597
|
+
base: base$6
|
|
597
598
|
};
|
|
598
599
|
|
|
599
|
-
const base$
|
|
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$
|
|
620
|
-
base: base$
|
|
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$
|
|
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$
|
|
673
|
-
base: base$
|
|
673
|
+
const configs$4 = {
|
|
674
|
+
base: base$4
|
|
674
675
|
};
|
|
675
676
|
|
|
676
|
-
const base$
|
|
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$
|
|
689
|
-
base: base$
|
|
689
|
+
const configs$3 = {
|
|
690
|
+
base: base$3
|
|
690
691
|
};
|
|
691
692
|
|
|
692
|
-
const base$
|
|
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$
|
|
763
|
-
base: base$
|
|
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,40 @@ function tsEslintConfig(options) {
|
|
|
819
861
|
{
|
|
820
862
|
languageOptions,
|
|
821
863
|
settings: {
|
|
822
|
-
...configs$
|
|
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$
|
|
831
|
-
...configs$
|
|
832
|
-
...configs$
|
|
833
|
-
...configs$
|
|
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$
|
|
838
|
-
...enableRequireExtensionRule ? configs$
|
|
839
|
-
...configs$
|
|
840
|
-
...configs$
|
|
841
|
-
...configs$
|
|
842
|
-
...configs$
|
|
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$
|
|
891
|
+
...configs$2.base
|
|
850
892
|
},
|
|
851
893
|
...enableReact ? [
|
|
852
894
|
{
|
|
853
895
|
name: "eslint-config-decent/tsx",
|
|
854
896
|
files: ["**/*.tsx"],
|
|
855
|
-
...configs$
|
|
897
|
+
...configs$6.base
|
|
856
898
|
},
|
|
857
899
|
{
|
|
858
900
|
name: "eslint-config-decent/tsx-disable-ts-rules",
|
|
@@ -871,7 +913,7 @@ function tsEslintConfig(options) {
|
|
|
871
913
|
rootDir: options?.nextJsRootDir
|
|
872
914
|
}
|
|
873
915
|
},
|
|
874
|
-
...configs$
|
|
916
|
+
...configs$8.base
|
|
875
917
|
}
|
|
876
918
|
] : [],
|
|
877
919
|
{
|
|
@@ -880,7 +922,7 @@ function tsEslintConfig(options) {
|
|
|
880
922
|
languageOptions: {
|
|
881
923
|
sourceType: "script"
|
|
882
924
|
},
|
|
883
|
-
...configs$
|
|
925
|
+
...configs$e.cjsAndEsm
|
|
884
926
|
},
|
|
885
927
|
{
|
|
886
928
|
name: "eslint-config-decent/cjs",
|
|
@@ -888,27 +930,34 @@ function tsEslintConfig(options) {
|
|
|
888
930
|
languageOptions: {
|
|
889
931
|
sourceType: "script"
|
|
890
932
|
},
|
|
891
|
-
...configs$
|
|
933
|
+
...configs$e.cjs
|
|
892
934
|
},
|
|
893
935
|
...enableMocha ? [
|
|
894
936
|
{
|
|
895
937
|
name: "eslint-config-decent/mocha-tests",
|
|
896
938
|
files: ["**/*.tests.ts", "tests/tests.ts"],
|
|
897
|
-
...configs$
|
|
939
|
+
...configs$9.base
|
|
898
940
|
}
|
|
899
941
|
] : [],
|
|
900
942
|
...enableJest ? [
|
|
901
943
|
{
|
|
902
944
|
name: "eslint-config-decent/jest-tests",
|
|
903
945
|
files: ["**/__tests__/**/*.ts?(x)", "**/*.{spec,test}.ts?(x)"],
|
|
904
|
-
...configs$
|
|
946
|
+
...configs$b.base
|
|
947
|
+
}
|
|
948
|
+
] : [],
|
|
949
|
+
...enableVitest ? [
|
|
950
|
+
{
|
|
951
|
+
name: "eslint-config-decent/vitest-tests",
|
|
952
|
+
files: ["**/__tests__/**/*.ts?(x)", "**/*.{spec,test}.ts?(x)"],
|
|
953
|
+
...configs.base
|
|
905
954
|
}
|
|
906
955
|
] : [],
|
|
907
956
|
...enableTestingLibrary ? [
|
|
908
957
|
{
|
|
909
958
|
name: "eslint-config-decent/testing-library",
|
|
910
959
|
files: ["**/__tests__/**/*.ts?(x)", "**/*.{spec,test,tests}.ts?(x)"],
|
|
911
|
-
...configs$
|
|
960
|
+
...configs$3.base
|
|
912
961
|
},
|
|
913
962
|
{
|
|
914
963
|
name: "eslint-config-decent/testing-library-disable-ts-rules",
|
|
@@ -919,7 +968,7 @@ function tsEslintConfig(options) {
|
|
|
919
968
|
}
|
|
920
969
|
] : [],
|
|
921
970
|
{
|
|
922
|
-
...configs$
|
|
971
|
+
...configs$4.base,
|
|
923
972
|
name: "eslint-config-decent/stylistic",
|
|
924
973
|
files: ["**/*.ts", "**/*.js", "**/*.cjs", "**/*.mjs", "**/*.tsx"]
|
|
925
974
|
},
|
|
@@ -944,4 +993,4 @@ function config(options) {
|
|
|
944
993
|
return tsEslint.config(...tsEslintConfig(options));
|
|
945
994
|
}
|
|
946
995
|
|
|
947
|
-
export { config, defaultConfig, configs$
|
|
996
|
+
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.
|
|
3
|
+
"version": "2.7.1",
|
|
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.
|
|
70
|
-
"@eslint/js": "9.
|
|
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.
|
|
73
|
+
"@typescript-eslint/utils": "8.31.1",
|
|
74
|
+
"@vitest/eslint-plugin": "1.1.44",
|
|
74
75
|
"eslint-config-prettier": "10.1.2",
|
|
75
|
-
"eslint-plugin-import-x": "4.
|
|
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.
|
|
79
|
+
"eslint-plugin-jsdoc": "50.6.11",
|
|
79
80
|
"eslint-plugin-jsx-a11y": "6.10.2",
|
|
80
|
-
"eslint-plugin-mocha": "
|
|
81
|
-
"eslint-plugin-prettier": "5.
|
|
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": "
|
|
88
|
+
"eslint-plugin-unicorn": "59.0.0",
|
|
88
89
|
"globals": "16.0.0",
|
|
89
|
-
"typescript-eslint": "8.31.
|
|
90
|
+
"typescript-eslint": "8.31.1"
|
|
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.
|
|
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.
|
|
99
|
+
"@swc/core": "1.11.24",
|
|
99
100
|
"@types/node": ">=22",
|
|
100
|
-
"eslint": "9.
|
|
101
|
+
"eslint": "9.26.0",
|
|
101
102
|
"husky": "9.1.7",
|
|
102
103
|
"lint-staged": "15.5.1",
|
|
103
104
|
"markdownlint-cli": "0.44.0",
|
|
104
|
-
"npm-run-all2": "
|
|
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;
|
|
@@ -189,6 +193,16 @@ export function tsEslintConfig(options?: DefaultConfigOptions): ConfigWithExtend
|
|
|
189
193
|
},
|
|
190
194
|
]
|
|
191
195
|
: []),
|
|
196
|
+
...(enableVitest
|
|
197
|
+
? [
|
|
198
|
+
{
|
|
199
|
+
name: 'eslint-config-decent/vitest-tests',
|
|
200
|
+
files: ['**/__tests__/**/*.ts?(x)', '**/*.{spec,test}.ts?(x)'],
|
|
201
|
+
|
|
202
|
+
...vitestConfigs.base,
|
|
203
|
+
},
|
|
204
|
+
]
|
|
205
|
+
: []),
|
|
192
206
|
...(enableTestingLibrary
|
|
193
207
|
? ([
|
|
194
208
|
{
|
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
|
+
};
|