@tb-dev/eslint-config 1.4.11 → 1.5.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 +61 -1
- package/dist/index.mjs +61 -1
- package/package.json +3 -1
package/dist/index.cjs
CHANGED
|
@@ -9,6 +9,7 @@ var Glob;
|
|
|
9
9
|
Glob["ALL"] = "**/*.?([cm])[jt]s?(x)";
|
|
10
10
|
Glob["JAVASCRIPT"] = "**/*.?([cm])js?(x)";
|
|
11
11
|
Glob["TYPESCRIPT"] = "**/*.?([cm])ts?(x)";
|
|
12
|
+
Glob["VITEST"] = "**/*.{test,spec}.[jt]s";
|
|
12
13
|
Glob["VUE"] = "**/*.vue";
|
|
13
14
|
})(Glob || (Glob = {}));
|
|
14
15
|
var GlobIgnore;
|
|
@@ -132,7 +133,7 @@ function javascript(options) {
|
|
|
132
133
|
'no-sequences': 'error',
|
|
133
134
|
'no-shadow-restricted-names': 'error',
|
|
134
135
|
'no-sparse-arrays': 'error',
|
|
135
|
-
'no-template-curly-in-string': '
|
|
136
|
+
'no-template-curly-in-string': 'error',
|
|
136
137
|
'no-undef-init': 'error',
|
|
137
138
|
'no-undefined': 'error',
|
|
138
139
|
'no-unexpected-multiline': 'error',
|
|
@@ -588,6 +589,64 @@ async function unicorn(options) {
|
|
|
588
589
|
};
|
|
589
590
|
}
|
|
590
591
|
|
|
592
|
+
async function vitest(options) {
|
|
593
|
+
const { overrides, vitest: enabled } = options;
|
|
594
|
+
if (!enabled)
|
|
595
|
+
return {};
|
|
596
|
+
const plugin = await interopDefault(import('eslint-plugin-vitest'));
|
|
597
|
+
return {
|
|
598
|
+
plugins: {
|
|
599
|
+
vitest: plugin
|
|
600
|
+
},
|
|
601
|
+
files: [Glob.VITEST],
|
|
602
|
+
rules: {
|
|
603
|
+
'vitest/consistent-test-it': ['error', { fn: 'it', withinDescribe: 'it' }],
|
|
604
|
+
'vitest/expect-expect': [
|
|
605
|
+
'error',
|
|
606
|
+
{
|
|
607
|
+
assertFunctionNames: ['expect']
|
|
608
|
+
}
|
|
609
|
+
],
|
|
610
|
+
'vitest/max-expects': ['error', { max: 5 }],
|
|
611
|
+
'vitest/max-nested-describe': ['error', { max: 1 }],
|
|
612
|
+
'vitest/no-alias-methods': 'error',
|
|
613
|
+
'vitest/no-commented-out-tests': 'error',
|
|
614
|
+
'vitest/no-conditional-expect': 'error',
|
|
615
|
+
'vitest/no-conditional-in-test': 'error',
|
|
616
|
+
'vitest/no-conditional-tests': 'error',
|
|
617
|
+
'vitest/no-done-callback': 'error',
|
|
618
|
+
'vitest/no-duplicate-hooks': 'error',
|
|
619
|
+
'vitest/no-identical-title': 'error',
|
|
620
|
+
'vitest/no-import-node-test': 'error',
|
|
621
|
+
'vitest/no-standalone-expect': 'error',
|
|
622
|
+
'vitest/no-test-return-statement': 'error',
|
|
623
|
+
'vitest/prefer-called-exactly-once-with': 'error',
|
|
624
|
+
'vitest/prefer-comparison-matcher': 'error',
|
|
625
|
+
'vitest/prefer-each': 'error',
|
|
626
|
+
'vitest/prefer-equality-matcher': 'error',
|
|
627
|
+
'vitest/prefer-expect-resolves': 'error',
|
|
628
|
+
'vitest/prefer-hooks-in-order': 'error',
|
|
629
|
+
'vitest/prefer-hooks-on-top': 'error',
|
|
630
|
+
'vitest/prefer-lowercase-title': 'error',
|
|
631
|
+
'vitest/prefer-mock-promise-shorthand': 'error',
|
|
632
|
+
'vitest/prefer-spy-on': 'error',
|
|
633
|
+
'vitest/prefer-to-be-object': 'error',
|
|
634
|
+
'vitest/prefer-to-contain': 'error',
|
|
635
|
+
'vitest/prefer-to-have-length': 'error',
|
|
636
|
+
'vitest/prefer-todo': 'error',
|
|
637
|
+
'vitest/require-top-level-describe': [
|
|
638
|
+
'error',
|
|
639
|
+
{
|
|
640
|
+
maxNumberOfTopLevelDescribes: 10
|
|
641
|
+
}
|
|
642
|
+
],
|
|
643
|
+
'vitest/valid-describe-callback': 'error',
|
|
644
|
+
'vitest/valid-expect': 'error',
|
|
645
|
+
...overrides?.vitest
|
|
646
|
+
}
|
|
647
|
+
};
|
|
648
|
+
}
|
|
649
|
+
|
|
591
650
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
592
651
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
593
652
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
@@ -881,6 +940,7 @@ async function config(options) {
|
|
|
881
940
|
...(await vue(options)),
|
|
882
941
|
perfectionist(options),
|
|
883
942
|
unicorn(options),
|
|
943
|
+
vitest(options),
|
|
884
944
|
prettier ? eslintConfigPrettier : {},
|
|
885
945
|
{
|
|
886
946
|
ignores: [...getIgnores(), ...(options.ignores ?? [])]
|
package/dist/index.mjs
CHANGED
|
@@ -7,6 +7,7 @@ var Glob;
|
|
|
7
7
|
Glob["ALL"] = "**/*.?([cm])[jt]s?(x)";
|
|
8
8
|
Glob["JAVASCRIPT"] = "**/*.?([cm])js?(x)";
|
|
9
9
|
Glob["TYPESCRIPT"] = "**/*.?([cm])ts?(x)";
|
|
10
|
+
Glob["VITEST"] = "**/*.{test,spec}.[jt]s";
|
|
10
11
|
Glob["VUE"] = "**/*.vue";
|
|
11
12
|
})(Glob || (Glob = {}));
|
|
12
13
|
var GlobIgnore;
|
|
@@ -130,7 +131,7 @@ function javascript(options) {
|
|
|
130
131
|
'no-sequences': 'error',
|
|
131
132
|
'no-shadow-restricted-names': 'error',
|
|
132
133
|
'no-sparse-arrays': 'error',
|
|
133
|
-
'no-template-curly-in-string': '
|
|
134
|
+
'no-template-curly-in-string': 'error',
|
|
134
135
|
'no-undef-init': 'error',
|
|
135
136
|
'no-undefined': 'error',
|
|
136
137
|
'no-unexpected-multiline': 'error',
|
|
@@ -586,6 +587,64 @@ async function unicorn(options) {
|
|
|
586
587
|
};
|
|
587
588
|
}
|
|
588
589
|
|
|
590
|
+
async function vitest(options) {
|
|
591
|
+
const { overrides, vitest: enabled } = options;
|
|
592
|
+
if (!enabled)
|
|
593
|
+
return {};
|
|
594
|
+
const plugin = await interopDefault(import('eslint-plugin-vitest'));
|
|
595
|
+
return {
|
|
596
|
+
plugins: {
|
|
597
|
+
vitest: plugin
|
|
598
|
+
},
|
|
599
|
+
files: [Glob.VITEST],
|
|
600
|
+
rules: {
|
|
601
|
+
'vitest/consistent-test-it': ['error', { fn: 'it', withinDescribe: 'it' }],
|
|
602
|
+
'vitest/expect-expect': [
|
|
603
|
+
'error',
|
|
604
|
+
{
|
|
605
|
+
assertFunctionNames: ['expect']
|
|
606
|
+
}
|
|
607
|
+
],
|
|
608
|
+
'vitest/max-expects': ['error', { max: 5 }],
|
|
609
|
+
'vitest/max-nested-describe': ['error', { max: 1 }],
|
|
610
|
+
'vitest/no-alias-methods': 'error',
|
|
611
|
+
'vitest/no-commented-out-tests': 'error',
|
|
612
|
+
'vitest/no-conditional-expect': 'error',
|
|
613
|
+
'vitest/no-conditional-in-test': 'error',
|
|
614
|
+
'vitest/no-conditional-tests': 'error',
|
|
615
|
+
'vitest/no-done-callback': 'error',
|
|
616
|
+
'vitest/no-duplicate-hooks': 'error',
|
|
617
|
+
'vitest/no-identical-title': 'error',
|
|
618
|
+
'vitest/no-import-node-test': 'error',
|
|
619
|
+
'vitest/no-standalone-expect': 'error',
|
|
620
|
+
'vitest/no-test-return-statement': 'error',
|
|
621
|
+
'vitest/prefer-called-exactly-once-with': 'error',
|
|
622
|
+
'vitest/prefer-comparison-matcher': 'error',
|
|
623
|
+
'vitest/prefer-each': 'error',
|
|
624
|
+
'vitest/prefer-equality-matcher': 'error',
|
|
625
|
+
'vitest/prefer-expect-resolves': 'error',
|
|
626
|
+
'vitest/prefer-hooks-in-order': 'error',
|
|
627
|
+
'vitest/prefer-hooks-on-top': 'error',
|
|
628
|
+
'vitest/prefer-lowercase-title': 'error',
|
|
629
|
+
'vitest/prefer-mock-promise-shorthand': 'error',
|
|
630
|
+
'vitest/prefer-spy-on': 'error',
|
|
631
|
+
'vitest/prefer-to-be-object': 'error',
|
|
632
|
+
'vitest/prefer-to-contain': 'error',
|
|
633
|
+
'vitest/prefer-to-have-length': 'error',
|
|
634
|
+
'vitest/prefer-todo': 'error',
|
|
635
|
+
'vitest/require-top-level-describe': [
|
|
636
|
+
'error',
|
|
637
|
+
{
|
|
638
|
+
maxNumberOfTopLevelDescribes: 10
|
|
639
|
+
}
|
|
640
|
+
],
|
|
641
|
+
'vitest/valid-describe-callback': 'error',
|
|
642
|
+
'vitest/valid-expect': 'error',
|
|
643
|
+
...overrides?.vitest
|
|
644
|
+
}
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
|
|
589
648
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
590
649
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
591
650
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
@@ -879,6 +938,7 @@ async function config(options) {
|
|
|
879
938
|
...(await vue(options)),
|
|
880
939
|
perfectionist(options),
|
|
881
940
|
unicorn(options),
|
|
941
|
+
vitest(options),
|
|
882
942
|
prettier ? eslintConfigPrettier : {},
|
|
883
943
|
{
|
|
884
944
|
ignores: [...getIgnores(), ...(options.ignores ?? [])]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tb-dev/eslint-config",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "ESLint config",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"eslint-config-prettier": "^9.1.0",
|
|
24
24
|
"eslint-plugin-perfectionist": "^2.5.0",
|
|
25
25
|
"eslint-plugin-unicorn": "^49.0.0",
|
|
26
|
+
"eslint-plugin-vitest": "^0.3.18",
|
|
26
27
|
"eslint-plugin-vue": "^9.19.2",
|
|
27
28
|
"globals": "^13.24.0",
|
|
28
29
|
"vue-eslint-parser": "^9.3.2"
|
|
@@ -33,6 +34,7 @@
|
|
|
33
34
|
"@types/eslint-config-prettier": "^6.11.3",
|
|
34
35
|
"@types/node": "^20.10.5",
|
|
35
36
|
"eslint": "^8.56.0",
|
|
37
|
+
"execa": "^8.0.1",
|
|
36
38
|
"husky": "^8.0.3",
|
|
37
39
|
"lint-staged": "^15.2.0",
|
|
38
40
|
"miho": "^2.2.3",
|