@vitest/eslint-plugin 1.6.8 → 1.6.10
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 +87 -17
- package/dist/index.mjs +87 -17
- package/package.json +8 -4
package/dist/index.cjs
CHANGED
|
@@ -4,7 +4,7 @@ let node_path = require("node:path");
|
|
|
4
4
|
let _typescript_eslint_scope_manager = require("@typescript-eslint/scope-manager");
|
|
5
5
|
|
|
6
6
|
//#region package.json
|
|
7
|
-
var version = "1.6.
|
|
7
|
+
var version = "1.6.10";
|
|
8
8
|
|
|
9
9
|
//#endregion
|
|
10
10
|
//#region src/utils/index.ts
|
|
@@ -1806,18 +1806,22 @@ var consistent_each_for_default = createEslintRule({
|
|
|
1806
1806
|
type: "object",
|
|
1807
1807
|
properties: {
|
|
1808
1808
|
test: {
|
|
1809
|
+
description: "Preferred method for `test`.",
|
|
1809
1810
|
type: "string",
|
|
1810
1811
|
enum: ["each", "for"]
|
|
1811
1812
|
},
|
|
1812
1813
|
it: {
|
|
1814
|
+
description: "Preferred method for `it`.",
|
|
1813
1815
|
type: "string",
|
|
1814
1816
|
enum: ["each", "for"]
|
|
1815
1817
|
},
|
|
1816
1818
|
describe: {
|
|
1819
|
+
description: "Preferred method for `describe`.",
|
|
1817
1820
|
type: "string",
|
|
1818
1821
|
enum: ["each", "for"]
|
|
1819
1822
|
},
|
|
1820
1823
|
suite: {
|
|
1824
|
+
description: "Preferred method for `suite`.",
|
|
1821
1825
|
type: "string",
|
|
1822
1826
|
enum: ["each", "for"]
|
|
1823
1827
|
}
|
|
@@ -1871,10 +1875,12 @@ var consistent_test_filename_default = createEslintRule({
|
|
|
1871
1875
|
additionalProperties: false,
|
|
1872
1876
|
properties: {
|
|
1873
1877
|
pattern: {
|
|
1878
|
+
description: "Regex pattern for files that should be treated as tests.",
|
|
1874
1879
|
type: "string",
|
|
1875
1880
|
format: "regex"
|
|
1876
1881
|
},
|
|
1877
1882
|
allTestPattern: {
|
|
1883
|
+
description: "Regex pattern used to identify all possible test files.",
|
|
1878
1884
|
type: "string",
|
|
1879
1885
|
format: "regex"
|
|
1880
1886
|
}
|
|
@@ -1930,10 +1936,12 @@ var consistent_test_it_default = createEslintRule({
|
|
|
1930
1936
|
type: "object",
|
|
1931
1937
|
properties: {
|
|
1932
1938
|
fn: {
|
|
1939
|
+
description: "Preferred global test function keyword.",
|
|
1933
1940
|
type: "string",
|
|
1934
1941
|
enum: [TestCaseName.test, TestCaseName.it]
|
|
1935
1942
|
},
|
|
1936
1943
|
withinDescribe: {
|
|
1944
|
+
description: "Preferred test function keyword inside `describe`.",
|
|
1937
1945
|
type: "string",
|
|
1938
1946
|
enum: [TestCaseName.test, TestCaseName.it]
|
|
1939
1947
|
}
|
|
@@ -2038,6 +2046,7 @@ var consistent_vitest_vi_default = createEslintRule({
|
|
|
2038
2046
|
schema: [{
|
|
2039
2047
|
type: "object",
|
|
2040
2048
|
properties: { fn: {
|
|
2049
|
+
description: "Preferred utility keyword to enforce.",
|
|
2041
2050
|
type: "string",
|
|
2042
2051
|
enum: [UtilName.vi, UtilName.vitest]
|
|
2043
2052
|
} },
|
|
@@ -2120,10 +2129,12 @@ var expect_expect_default = createEslintRule({
|
|
|
2120
2129
|
type: "object",
|
|
2121
2130
|
properties: {
|
|
2122
2131
|
assertFunctionNames: {
|
|
2132
|
+
description: "List of function names treated as assertions.",
|
|
2123
2133
|
type: "array",
|
|
2124
2134
|
items: { type: "string" }
|
|
2125
2135
|
},
|
|
2126
2136
|
additionalTestBlockFunctions: {
|
|
2137
|
+
description: "Additional functions that should be treated as test blocks.",
|
|
2127
2138
|
type: "array",
|
|
2128
2139
|
items: { type: "string" }
|
|
2129
2140
|
}
|
|
@@ -2271,7 +2282,10 @@ var max_expects_default = createEslintRule({
|
|
|
2271
2282
|
type: "suggestion",
|
|
2272
2283
|
schema: [{
|
|
2273
2284
|
type: "object",
|
|
2274
|
-
properties: { max: {
|
|
2285
|
+
properties: { max: {
|
|
2286
|
+
description: "Maximum number of `expect` calls allowed in a test.",
|
|
2287
|
+
type: "number"
|
|
2288
|
+
} },
|
|
2275
2289
|
additionalProperties: false
|
|
2276
2290
|
}],
|
|
2277
2291
|
defaultOptions: [{ max: 5 }]
|
|
@@ -2316,7 +2330,10 @@ var max_nested_describe_default = createEslintRule({
|
|
|
2316
2330
|
},
|
|
2317
2331
|
schema: [{
|
|
2318
2332
|
type: "object",
|
|
2319
|
-
properties: { max: {
|
|
2333
|
+
properties: { max: {
|
|
2334
|
+
description: "Maximum allowed nesting depth for `describe` blocks.",
|
|
2335
|
+
type: "number"
|
|
2336
|
+
} },
|
|
2320
2337
|
additionalProperties: false
|
|
2321
2338
|
}],
|
|
2322
2339
|
messages: { maxNestedDescribe: "Nested describe block should be less than set max value" },
|
|
@@ -2789,7 +2806,10 @@ var no_focused_tests_default = createEslintRule({
|
|
|
2789
2806
|
fixable: "code",
|
|
2790
2807
|
schema: [{
|
|
2791
2808
|
type: "object",
|
|
2792
|
-
properties: { fixable: {
|
|
2809
|
+
properties: { fixable: {
|
|
2810
|
+
description: "Whether the rule should provide an autofix.",
|
|
2811
|
+
type: "boolean"
|
|
2812
|
+
} },
|
|
2793
2813
|
additionalProperties: false
|
|
2794
2814
|
}],
|
|
2795
2815
|
messages: { noFocusedTests: "Focused tests are not allowed" },
|
|
@@ -3160,9 +3180,16 @@ var no_large_snapshots_default = createEslintRule({
|
|
|
3160
3180
|
schema: [{
|
|
3161
3181
|
type: "object",
|
|
3162
3182
|
properties: {
|
|
3163
|
-
maxSize: {
|
|
3164
|
-
|
|
3183
|
+
maxSize: {
|
|
3184
|
+
description: "Maximum number of lines allowed in external snapshots.",
|
|
3185
|
+
type: "number"
|
|
3186
|
+
},
|
|
3187
|
+
inlineMaxSize: {
|
|
3188
|
+
description: "Maximum number of lines allowed in inline snapshots.",
|
|
3189
|
+
type: "number"
|
|
3190
|
+
},
|
|
3165
3191
|
allowedSnapshots: {
|
|
3192
|
+
description: "Allowed snapshot names by absolute snapshot file path.",
|
|
3166
3193
|
type: "object",
|
|
3167
3194
|
additionalProperties: { type: "array" }
|
|
3168
3195
|
}
|
|
@@ -3238,6 +3265,7 @@ var no_restricted_matchers_default = createEslintRule({
|
|
|
3238
3265
|
},
|
|
3239
3266
|
type: "suggestion",
|
|
3240
3267
|
schema: [{
|
|
3268
|
+
description: "Restricted matcher chains mapped to optional custom messages.",
|
|
3241
3269
|
type: "object",
|
|
3242
3270
|
additionalProperties: { type: ["string", "null"] }
|
|
3243
3271
|
}],
|
|
@@ -3282,6 +3310,7 @@ var no_restricted_vi_methods_default = createEslintRule({
|
|
|
3282
3310
|
recommended: false
|
|
3283
3311
|
},
|
|
3284
3312
|
schema: [{
|
|
3313
|
+
description: "Restricted `vi` methods mapped to optional custom messages.",
|
|
3285
3314
|
type: "object",
|
|
3286
3315
|
additionalProperties: { type: ["string", "null"] }
|
|
3287
3316
|
}],
|
|
@@ -3340,6 +3369,7 @@ var no_standalone_expect_default = createEslintRule({
|
|
|
3340
3369
|
schema: [{
|
|
3341
3370
|
type: "object",
|
|
3342
3371
|
properties: { additionalTestBlockFunctions: {
|
|
3372
|
+
description: "Additional functions that should be treated as test blocks.",
|
|
3343
3373
|
type: "array",
|
|
3344
3374
|
items: { type: "string" }
|
|
3345
3375
|
} },
|
|
@@ -4369,9 +4399,18 @@ var prefer_expect_assertions_default = createEslintRule({
|
|
|
4369
4399
|
schema: [{
|
|
4370
4400
|
type: "object",
|
|
4371
4401
|
properties: {
|
|
4372
|
-
onlyFunctionsWithAsyncKeyword: {
|
|
4373
|
-
|
|
4374
|
-
|
|
4402
|
+
onlyFunctionsWithAsyncKeyword: {
|
|
4403
|
+
description: "Only check test functions declared with the async keyword.",
|
|
4404
|
+
type: "boolean"
|
|
4405
|
+
},
|
|
4406
|
+
onlyFunctionsWithExpectInLoop: {
|
|
4407
|
+
description: "Only check test functions that contain `expect` inside loops.",
|
|
4408
|
+
type: "boolean"
|
|
4409
|
+
},
|
|
4410
|
+
onlyFunctionsWithExpectInCallback: {
|
|
4411
|
+
description: "Only check test functions that contain `expect` in callbacks.",
|
|
4412
|
+
type: "boolean"
|
|
4413
|
+
}
|
|
4375
4414
|
},
|
|
4376
4415
|
additionalProperties: false
|
|
4377
4416
|
}],
|
|
@@ -4685,6 +4724,7 @@ var prefer_hooks_on_top_default = createEslintRule({
|
|
|
4685
4724
|
//#endregion
|
|
4686
4725
|
//#region src/rules/prefer-import-in-mock.ts
|
|
4687
4726
|
const RULE_NAME$30 = "prefer-import-in-mock";
|
|
4727
|
+
const MOCK_METHODS = new Set(["mock", "doMock"]);
|
|
4688
4728
|
var prefer_import_in_mock_default = createEslintRule({
|
|
4689
4729
|
name: RULE_NAME$30,
|
|
4690
4730
|
meta: {
|
|
@@ -4694,7 +4734,10 @@ var prefer_import_in_mock_default = createEslintRule({
|
|
|
4694
4734
|
messages: { preferImport: "Replace '{{path}}' with import('{{path}}')" },
|
|
4695
4735
|
schema: [{
|
|
4696
4736
|
type: "object",
|
|
4697
|
-
properties: { fixable: {
|
|
4737
|
+
properties: { fixable: {
|
|
4738
|
+
description: "Whether the rule should provide an autofix.",
|
|
4739
|
+
type: "boolean"
|
|
4740
|
+
} },
|
|
4698
4741
|
additionalProperties: false
|
|
4699
4742
|
}],
|
|
4700
4743
|
defaultOptions: [{ fixable: true }]
|
|
@@ -4705,7 +4748,7 @@ var prefer_import_in_mock_default = createEslintRule({
|
|
|
4705
4748
|
if (node.callee.type !== _typescript_eslint_utils.AST_NODE_TYPES.MemberExpression) return;
|
|
4706
4749
|
if (parseVitestFnCall(node, context)?.type !== "vi") return false;
|
|
4707
4750
|
const { property } = node.callee;
|
|
4708
|
-
if (property.type != _typescript_eslint_utils.AST_NODE_TYPES.Identifier || property.name
|
|
4751
|
+
if (property.type != _typescript_eslint_utils.AST_NODE_TYPES.Identifier || !MOCK_METHODS.has(property.name)) return;
|
|
4709
4752
|
const pathArg = node.arguments[0];
|
|
4710
4753
|
if (pathArg && pathArg.type === _typescript_eslint_utils.AST_NODE_TYPES.Literal) context.report({
|
|
4711
4754
|
messageId: "preferImport",
|
|
@@ -4822,6 +4865,7 @@ var prefer_lowercase_title_default = createEslintRule({
|
|
|
4822
4865
|
type: "object",
|
|
4823
4866
|
properties: {
|
|
4824
4867
|
ignore: {
|
|
4868
|
+
description: "Functions whose titles should be ignored when checking case.",
|
|
4825
4869
|
type: "array",
|
|
4826
4870
|
items: {
|
|
4827
4871
|
type: "string",
|
|
@@ -4833,12 +4877,19 @@ var prefer_lowercase_title_default = createEslintRule({
|
|
|
4833
4877
|
}
|
|
4834
4878
|
},
|
|
4835
4879
|
allowedPrefixes: {
|
|
4880
|
+
description: "Title prefixes that are exempt from this rule.",
|
|
4836
4881
|
type: "array",
|
|
4837
4882
|
items: { type: "string" },
|
|
4838
4883
|
additionalItems: false
|
|
4839
4884
|
},
|
|
4840
|
-
ignoreTopLevelDescribe: {
|
|
4841
|
-
|
|
4885
|
+
ignoreTopLevelDescribe: {
|
|
4886
|
+
description: "Ignore the first top-level `describe` title.",
|
|
4887
|
+
type: "boolean"
|
|
4888
|
+
},
|
|
4889
|
+
lowercaseFirstCharacterOnly: {
|
|
4890
|
+
description: "Only require the first character to be lowercase.",
|
|
4891
|
+
type: "boolean"
|
|
4892
|
+
}
|
|
4842
4893
|
},
|
|
4843
4894
|
additionalProperties: false
|
|
4844
4895
|
}],
|
|
@@ -5010,6 +5061,7 @@ var prefer_snapshot_hint_default = createEslintRule({
|
|
|
5010
5061
|
},
|
|
5011
5062
|
messages: { missingHint: "You should provide a hint for this snapshot" },
|
|
5012
5063
|
schema: [{
|
|
5064
|
+
description: "When to require snapshot hints.",
|
|
5013
5065
|
type: "string",
|
|
5014
5066
|
enum: ["always", "multi"]
|
|
5015
5067
|
}],
|
|
@@ -5638,6 +5690,7 @@ var require_hook_default = createEslintRule({
|
|
|
5638
5690
|
schema: [{
|
|
5639
5691
|
type: "object",
|
|
5640
5692
|
properties: { allowedFunctionCalls: {
|
|
5693
|
+
description: "Function calls that are allowed outside of hooks.",
|
|
5641
5694
|
type: "array",
|
|
5642
5695
|
items: { type: "string" }
|
|
5643
5696
|
} },
|
|
@@ -5811,7 +5864,10 @@ var require_mock_type_parameters_default = createEslintRule({
|
|
|
5811
5864
|
fixable: "code",
|
|
5812
5865
|
schema: [{
|
|
5813
5866
|
type: "object",
|
|
5814
|
-
properties: { checkImportFunctions: {
|
|
5867
|
+
properties: { checkImportFunctions: {
|
|
5868
|
+
description: "Also require type parameters for `importActual` and `importMock`.",
|
|
5869
|
+
type: "boolean"
|
|
5870
|
+
} },
|
|
5815
5871
|
additionalProperties: false
|
|
5816
5872
|
}],
|
|
5817
5873
|
defaultOptions: [{ checkImportFunctions: false }]
|
|
@@ -5883,6 +5939,7 @@ var require_top_level_describe_default = createEslintRule({
|
|
|
5883
5939
|
schema: [{
|
|
5884
5940
|
type: "object",
|
|
5885
5941
|
properties: { maxNumberOfTopLevelDescribes: {
|
|
5942
|
+
description: "Maximum number of `describe` blocks allowed at the top level.",
|
|
5886
5943
|
type: "number",
|
|
5887
5944
|
minimum: 1
|
|
5888
5945
|
} },
|
|
@@ -6264,16 +6321,22 @@ var valid_expect_default = createEslintRule({
|
|
|
6264
6321
|
schema: [{
|
|
6265
6322
|
type: "object",
|
|
6266
6323
|
properties: {
|
|
6267
|
-
alwaysAwait: {
|
|
6324
|
+
alwaysAwait: {
|
|
6325
|
+
description: "Require awaiting every async assertion.",
|
|
6326
|
+
type: "boolean"
|
|
6327
|
+
},
|
|
6268
6328
|
asyncMatchers: {
|
|
6329
|
+
description: "Matchers that should be considered async assertions.",
|
|
6269
6330
|
type: "array",
|
|
6270
6331
|
items: { type: "string" }
|
|
6271
6332
|
},
|
|
6272
6333
|
minArgs: {
|
|
6334
|
+
description: "Minimum number of arguments allowed for `expect`.",
|
|
6273
6335
|
type: "number",
|
|
6274
6336
|
minimum: 1
|
|
6275
6337
|
},
|
|
6276
6338
|
maxArgs: {
|
|
6339
|
+
description: "Maximum number of arguments allowed for `expect`.",
|
|
6277
6340
|
type: "number",
|
|
6278
6341
|
minimum: 1
|
|
6279
6342
|
}
|
|
@@ -6494,9 +6557,16 @@ var valid_title_default = createEslintRule({
|
|
|
6494
6557
|
schema: [{
|
|
6495
6558
|
type: "object",
|
|
6496
6559
|
properties: {
|
|
6497
|
-
ignoreTypeOfDescribeName: {
|
|
6498
|
-
|
|
6560
|
+
ignoreTypeOfDescribeName: {
|
|
6561
|
+
description: "Skip validating `describe` titles that come from `typeof`.",
|
|
6562
|
+
type: "boolean"
|
|
6563
|
+
},
|
|
6564
|
+
allowArguments: {
|
|
6565
|
+
description: "Allow dynamic arguments as titles.",
|
|
6566
|
+
type: "boolean"
|
|
6567
|
+
},
|
|
6499
6568
|
disallowedWords: {
|
|
6569
|
+
description: "Words that are not allowed in test titles.",
|
|
6500
6570
|
type: "array",
|
|
6501
6571
|
items: { type: "string" }
|
|
6502
6572
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { isAbsolute, posix } from "node:path";
|
|
|
4
4
|
import { DefinitionType } from "@typescript-eslint/scope-manager";
|
|
5
5
|
|
|
6
6
|
//#region package.json
|
|
7
|
-
var version = "1.6.
|
|
7
|
+
var version = "1.6.10";
|
|
8
8
|
|
|
9
9
|
//#endregion
|
|
10
10
|
//#region src/utils/index.ts
|
|
@@ -1806,18 +1806,22 @@ var consistent_each_for_default = createEslintRule({
|
|
|
1806
1806
|
type: "object",
|
|
1807
1807
|
properties: {
|
|
1808
1808
|
test: {
|
|
1809
|
+
description: "Preferred method for `test`.",
|
|
1809
1810
|
type: "string",
|
|
1810
1811
|
enum: ["each", "for"]
|
|
1811
1812
|
},
|
|
1812
1813
|
it: {
|
|
1814
|
+
description: "Preferred method for `it`.",
|
|
1813
1815
|
type: "string",
|
|
1814
1816
|
enum: ["each", "for"]
|
|
1815
1817
|
},
|
|
1816
1818
|
describe: {
|
|
1819
|
+
description: "Preferred method for `describe`.",
|
|
1817
1820
|
type: "string",
|
|
1818
1821
|
enum: ["each", "for"]
|
|
1819
1822
|
},
|
|
1820
1823
|
suite: {
|
|
1824
|
+
description: "Preferred method for `suite`.",
|
|
1821
1825
|
type: "string",
|
|
1822
1826
|
enum: ["each", "for"]
|
|
1823
1827
|
}
|
|
@@ -1871,10 +1875,12 @@ var consistent_test_filename_default = createEslintRule({
|
|
|
1871
1875
|
additionalProperties: false,
|
|
1872
1876
|
properties: {
|
|
1873
1877
|
pattern: {
|
|
1878
|
+
description: "Regex pattern for files that should be treated as tests.",
|
|
1874
1879
|
type: "string",
|
|
1875
1880
|
format: "regex"
|
|
1876
1881
|
},
|
|
1877
1882
|
allTestPattern: {
|
|
1883
|
+
description: "Regex pattern used to identify all possible test files.",
|
|
1878
1884
|
type: "string",
|
|
1879
1885
|
format: "regex"
|
|
1880
1886
|
}
|
|
@@ -1930,10 +1936,12 @@ var consistent_test_it_default = createEslintRule({
|
|
|
1930
1936
|
type: "object",
|
|
1931
1937
|
properties: {
|
|
1932
1938
|
fn: {
|
|
1939
|
+
description: "Preferred global test function keyword.",
|
|
1933
1940
|
type: "string",
|
|
1934
1941
|
enum: [TestCaseName.test, TestCaseName.it]
|
|
1935
1942
|
},
|
|
1936
1943
|
withinDescribe: {
|
|
1944
|
+
description: "Preferred test function keyword inside `describe`.",
|
|
1937
1945
|
type: "string",
|
|
1938
1946
|
enum: [TestCaseName.test, TestCaseName.it]
|
|
1939
1947
|
}
|
|
@@ -2038,6 +2046,7 @@ var consistent_vitest_vi_default = createEslintRule({
|
|
|
2038
2046
|
schema: [{
|
|
2039
2047
|
type: "object",
|
|
2040
2048
|
properties: { fn: {
|
|
2049
|
+
description: "Preferred utility keyword to enforce.",
|
|
2041
2050
|
type: "string",
|
|
2042
2051
|
enum: [UtilName.vi, UtilName.vitest]
|
|
2043
2052
|
} },
|
|
@@ -2120,10 +2129,12 @@ var expect_expect_default = createEslintRule({
|
|
|
2120
2129
|
type: "object",
|
|
2121
2130
|
properties: {
|
|
2122
2131
|
assertFunctionNames: {
|
|
2132
|
+
description: "List of function names treated as assertions.",
|
|
2123
2133
|
type: "array",
|
|
2124
2134
|
items: { type: "string" }
|
|
2125
2135
|
},
|
|
2126
2136
|
additionalTestBlockFunctions: {
|
|
2137
|
+
description: "Additional functions that should be treated as test blocks.",
|
|
2127
2138
|
type: "array",
|
|
2128
2139
|
items: { type: "string" }
|
|
2129
2140
|
}
|
|
@@ -2271,7 +2282,10 @@ var max_expects_default = createEslintRule({
|
|
|
2271
2282
|
type: "suggestion",
|
|
2272
2283
|
schema: [{
|
|
2273
2284
|
type: "object",
|
|
2274
|
-
properties: { max: {
|
|
2285
|
+
properties: { max: {
|
|
2286
|
+
description: "Maximum number of `expect` calls allowed in a test.",
|
|
2287
|
+
type: "number"
|
|
2288
|
+
} },
|
|
2275
2289
|
additionalProperties: false
|
|
2276
2290
|
}],
|
|
2277
2291
|
defaultOptions: [{ max: 5 }]
|
|
@@ -2316,7 +2330,10 @@ var max_nested_describe_default = createEslintRule({
|
|
|
2316
2330
|
},
|
|
2317
2331
|
schema: [{
|
|
2318
2332
|
type: "object",
|
|
2319
|
-
properties: { max: {
|
|
2333
|
+
properties: { max: {
|
|
2334
|
+
description: "Maximum allowed nesting depth for `describe` blocks.",
|
|
2335
|
+
type: "number"
|
|
2336
|
+
} },
|
|
2320
2337
|
additionalProperties: false
|
|
2321
2338
|
}],
|
|
2322
2339
|
messages: { maxNestedDescribe: "Nested describe block should be less than set max value" },
|
|
@@ -2789,7 +2806,10 @@ var no_focused_tests_default = createEslintRule({
|
|
|
2789
2806
|
fixable: "code",
|
|
2790
2807
|
schema: [{
|
|
2791
2808
|
type: "object",
|
|
2792
|
-
properties: { fixable: {
|
|
2809
|
+
properties: { fixable: {
|
|
2810
|
+
description: "Whether the rule should provide an autofix.",
|
|
2811
|
+
type: "boolean"
|
|
2812
|
+
} },
|
|
2793
2813
|
additionalProperties: false
|
|
2794
2814
|
}],
|
|
2795
2815
|
messages: { noFocusedTests: "Focused tests are not allowed" },
|
|
@@ -3160,9 +3180,16 @@ var no_large_snapshots_default = createEslintRule({
|
|
|
3160
3180
|
schema: [{
|
|
3161
3181
|
type: "object",
|
|
3162
3182
|
properties: {
|
|
3163
|
-
maxSize: {
|
|
3164
|
-
|
|
3183
|
+
maxSize: {
|
|
3184
|
+
description: "Maximum number of lines allowed in external snapshots.",
|
|
3185
|
+
type: "number"
|
|
3186
|
+
},
|
|
3187
|
+
inlineMaxSize: {
|
|
3188
|
+
description: "Maximum number of lines allowed in inline snapshots.",
|
|
3189
|
+
type: "number"
|
|
3190
|
+
},
|
|
3165
3191
|
allowedSnapshots: {
|
|
3192
|
+
description: "Allowed snapshot names by absolute snapshot file path.",
|
|
3166
3193
|
type: "object",
|
|
3167
3194
|
additionalProperties: { type: "array" }
|
|
3168
3195
|
}
|
|
@@ -3238,6 +3265,7 @@ var no_restricted_matchers_default = createEslintRule({
|
|
|
3238
3265
|
},
|
|
3239
3266
|
type: "suggestion",
|
|
3240
3267
|
schema: [{
|
|
3268
|
+
description: "Restricted matcher chains mapped to optional custom messages.",
|
|
3241
3269
|
type: "object",
|
|
3242
3270
|
additionalProperties: { type: ["string", "null"] }
|
|
3243
3271
|
}],
|
|
@@ -3282,6 +3310,7 @@ var no_restricted_vi_methods_default = createEslintRule({
|
|
|
3282
3310
|
recommended: false
|
|
3283
3311
|
},
|
|
3284
3312
|
schema: [{
|
|
3313
|
+
description: "Restricted `vi` methods mapped to optional custom messages.",
|
|
3285
3314
|
type: "object",
|
|
3286
3315
|
additionalProperties: { type: ["string", "null"] }
|
|
3287
3316
|
}],
|
|
@@ -3340,6 +3369,7 @@ var no_standalone_expect_default = createEslintRule({
|
|
|
3340
3369
|
schema: [{
|
|
3341
3370
|
type: "object",
|
|
3342
3371
|
properties: { additionalTestBlockFunctions: {
|
|
3372
|
+
description: "Additional functions that should be treated as test blocks.",
|
|
3343
3373
|
type: "array",
|
|
3344
3374
|
items: { type: "string" }
|
|
3345
3375
|
} },
|
|
@@ -4369,9 +4399,18 @@ var prefer_expect_assertions_default = createEslintRule({
|
|
|
4369
4399
|
schema: [{
|
|
4370
4400
|
type: "object",
|
|
4371
4401
|
properties: {
|
|
4372
|
-
onlyFunctionsWithAsyncKeyword: {
|
|
4373
|
-
|
|
4374
|
-
|
|
4402
|
+
onlyFunctionsWithAsyncKeyword: {
|
|
4403
|
+
description: "Only check test functions declared with the async keyword.",
|
|
4404
|
+
type: "boolean"
|
|
4405
|
+
},
|
|
4406
|
+
onlyFunctionsWithExpectInLoop: {
|
|
4407
|
+
description: "Only check test functions that contain `expect` inside loops.",
|
|
4408
|
+
type: "boolean"
|
|
4409
|
+
},
|
|
4410
|
+
onlyFunctionsWithExpectInCallback: {
|
|
4411
|
+
description: "Only check test functions that contain `expect` in callbacks.",
|
|
4412
|
+
type: "boolean"
|
|
4413
|
+
}
|
|
4375
4414
|
},
|
|
4376
4415
|
additionalProperties: false
|
|
4377
4416
|
}],
|
|
@@ -4685,6 +4724,7 @@ var prefer_hooks_on_top_default = createEslintRule({
|
|
|
4685
4724
|
//#endregion
|
|
4686
4725
|
//#region src/rules/prefer-import-in-mock.ts
|
|
4687
4726
|
const RULE_NAME$30 = "prefer-import-in-mock";
|
|
4727
|
+
const MOCK_METHODS = new Set(["mock", "doMock"]);
|
|
4688
4728
|
var prefer_import_in_mock_default = createEslintRule({
|
|
4689
4729
|
name: RULE_NAME$30,
|
|
4690
4730
|
meta: {
|
|
@@ -4694,7 +4734,10 @@ var prefer_import_in_mock_default = createEslintRule({
|
|
|
4694
4734
|
messages: { preferImport: "Replace '{{path}}' with import('{{path}}')" },
|
|
4695
4735
|
schema: [{
|
|
4696
4736
|
type: "object",
|
|
4697
|
-
properties: { fixable: {
|
|
4737
|
+
properties: { fixable: {
|
|
4738
|
+
description: "Whether the rule should provide an autofix.",
|
|
4739
|
+
type: "boolean"
|
|
4740
|
+
} },
|
|
4698
4741
|
additionalProperties: false
|
|
4699
4742
|
}],
|
|
4700
4743
|
defaultOptions: [{ fixable: true }]
|
|
@@ -4705,7 +4748,7 @@ var prefer_import_in_mock_default = createEslintRule({
|
|
|
4705
4748
|
if (node.callee.type !== AST_NODE_TYPES.MemberExpression) return;
|
|
4706
4749
|
if (parseVitestFnCall(node, context)?.type !== "vi") return false;
|
|
4707
4750
|
const { property } = node.callee;
|
|
4708
|
-
if (property.type != AST_NODE_TYPES.Identifier || property.name
|
|
4751
|
+
if (property.type != AST_NODE_TYPES.Identifier || !MOCK_METHODS.has(property.name)) return;
|
|
4709
4752
|
const pathArg = node.arguments[0];
|
|
4710
4753
|
if (pathArg && pathArg.type === AST_NODE_TYPES.Literal) context.report({
|
|
4711
4754
|
messageId: "preferImport",
|
|
@@ -4822,6 +4865,7 @@ var prefer_lowercase_title_default = createEslintRule({
|
|
|
4822
4865
|
type: "object",
|
|
4823
4866
|
properties: {
|
|
4824
4867
|
ignore: {
|
|
4868
|
+
description: "Functions whose titles should be ignored when checking case.",
|
|
4825
4869
|
type: "array",
|
|
4826
4870
|
items: {
|
|
4827
4871
|
type: "string",
|
|
@@ -4833,12 +4877,19 @@ var prefer_lowercase_title_default = createEslintRule({
|
|
|
4833
4877
|
}
|
|
4834
4878
|
},
|
|
4835
4879
|
allowedPrefixes: {
|
|
4880
|
+
description: "Title prefixes that are exempt from this rule.",
|
|
4836
4881
|
type: "array",
|
|
4837
4882
|
items: { type: "string" },
|
|
4838
4883
|
additionalItems: false
|
|
4839
4884
|
},
|
|
4840
|
-
ignoreTopLevelDescribe: {
|
|
4841
|
-
|
|
4885
|
+
ignoreTopLevelDescribe: {
|
|
4886
|
+
description: "Ignore the first top-level `describe` title.",
|
|
4887
|
+
type: "boolean"
|
|
4888
|
+
},
|
|
4889
|
+
lowercaseFirstCharacterOnly: {
|
|
4890
|
+
description: "Only require the first character to be lowercase.",
|
|
4891
|
+
type: "boolean"
|
|
4892
|
+
}
|
|
4842
4893
|
},
|
|
4843
4894
|
additionalProperties: false
|
|
4844
4895
|
}],
|
|
@@ -5010,6 +5061,7 @@ var prefer_snapshot_hint_default = createEslintRule({
|
|
|
5010
5061
|
},
|
|
5011
5062
|
messages: { missingHint: "You should provide a hint for this snapshot" },
|
|
5012
5063
|
schema: [{
|
|
5064
|
+
description: "When to require snapshot hints.",
|
|
5013
5065
|
type: "string",
|
|
5014
5066
|
enum: ["always", "multi"]
|
|
5015
5067
|
}],
|
|
@@ -5638,6 +5690,7 @@ var require_hook_default = createEslintRule({
|
|
|
5638
5690
|
schema: [{
|
|
5639
5691
|
type: "object",
|
|
5640
5692
|
properties: { allowedFunctionCalls: {
|
|
5693
|
+
description: "Function calls that are allowed outside of hooks.",
|
|
5641
5694
|
type: "array",
|
|
5642
5695
|
items: { type: "string" }
|
|
5643
5696
|
} },
|
|
@@ -5811,7 +5864,10 @@ var require_mock_type_parameters_default = createEslintRule({
|
|
|
5811
5864
|
fixable: "code",
|
|
5812
5865
|
schema: [{
|
|
5813
5866
|
type: "object",
|
|
5814
|
-
properties: { checkImportFunctions: {
|
|
5867
|
+
properties: { checkImportFunctions: {
|
|
5868
|
+
description: "Also require type parameters for `importActual` and `importMock`.",
|
|
5869
|
+
type: "boolean"
|
|
5870
|
+
} },
|
|
5815
5871
|
additionalProperties: false
|
|
5816
5872
|
}],
|
|
5817
5873
|
defaultOptions: [{ checkImportFunctions: false }]
|
|
@@ -5883,6 +5939,7 @@ var require_top_level_describe_default = createEslintRule({
|
|
|
5883
5939
|
schema: [{
|
|
5884
5940
|
type: "object",
|
|
5885
5941
|
properties: { maxNumberOfTopLevelDescribes: {
|
|
5942
|
+
description: "Maximum number of `describe` blocks allowed at the top level.",
|
|
5886
5943
|
type: "number",
|
|
5887
5944
|
minimum: 1
|
|
5888
5945
|
} },
|
|
@@ -6264,16 +6321,22 @@ var valid_expect_default = createEslintRule({
|
|
|
6264
6321
|
schema: [{
|
|
6265
6322
|
type: "object",
|
|
6266
6323
|
properties: {
|
|
6267
|
-
alwaysAwait: {
|
|
6324
|
+
alwaysAwait: {
|
|
6325
|
+
description: "Require awaiting every async assertion.",
|
|
6326
|
+
type: "boolean"
|
|
6327
|
+
},
|
|
6268
6328
|
asyncMatchers: {
|
|
6329
|
+
description: "Matchers that should be considered async assertions.",
|
|
6269
6330
|
type: "array",
|
|
6270
6331
|
items: { type: "string" }
|
|
6271
6332
|
},
|
|
6272
6333
|
minArgs: {
|
|
6334
|
+
description: "Minimum number of arguments allowed for `expect`.",
|
|
6273
6335
|
type: "number",
|
|
6274
6336
|
minimum: 1
|
|
6275
6337
|
},
|
|
6276
6338
|
maxArgs: {
|
|
6339
|
+
description: "Maximum number of arguments allowed for `expect`.",
|
|
6277
6340
|
type: "number",
|
|
6278
6341
|
minimum: 1
|
|
6279
6342
|
}
|
|
@@ -6494,9 +6557,16 @@ var valid_title_default = createEslintRule({
|
|
|
6494
6557
|
schema: [{
|
|
6495
6558
|
type: "object",
|
|
6496
6559
|
properties: {
|
|
6497
|
-
ignoreTypeOfDescribeName: {
|
|
6498
|
-
|
|
6560
|
+
ignoreTypeOfDescribeName: {
|
|
6561
|
+
description: "Skip validating `describe` titles that come from `typeof`.",
|
|
6562
|
+
type: "boolean"
|
|
6563
|
+
},
|
|
6564
|
+
allowArguments: {
|
|
6565
|
+
description: "Allow dynamic arguments as titles.",
|
|
6566
|
+
type: "boolean"
|
|
6567
|
+
},
|
|
6499
6568
|
disallowedWords: {
|
|
6569
|
+
description: "Words that are not allowed in test titles.",
|
|
6500
6570
|
type: "array",
|
|
6501
6571
|
items: { type: "string" }
|
|
6502
6572
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitest/eslint-plugin",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.10",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ESLint plugin for Vitest",
|
|
6
6
|
"repository": "vitest-dev/eslint-plugin-vitest",
|
|
@@ -15,11 +15,15 @@
|
|
|
15
15
|
"author": "Verite Mugabo <https://veritemugabo.com/>",
|
|
16
16
|
"type": "module",
|
|
17
17
|
"main": "./dist/index.cjs",
|
|
18
|
-
"module": "./dist/index.
|
|
19
|
-
"types": "./dist/index.d.
|
|
18
|
+
"module": "./dist/index.mjs",
|
|
19
|
+
"types": "./dist/index.d.mts",
|
|
20
20
|
"exports": {
|
|
21
21
|
".": {
|
|
22
|
-
"
|
|
22
|
+
"types": {
|
|
23
|
+
"import": "./dist/index.d.mts",
|
|
24
|
+
"require": "./dist/index.d.cts"
|
|
25
|
+
},
|
|
26
|
+
"import": "./dist/index.mjs",
|
|
23
27
|
"require": "./dist/index.cjs"
|
|
24
28
|
},
|
|
25
29
|
"./package.json": "./package.json"
|