@vitest/eslint-plugin 1.4.3 → 1.4.4
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/README.md +3 -1
- package/dist/index.cjs +299 -188
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +299 -188
- package/package.json +1 -1
package/dist/index.js
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.4.
|
|
7
|
+
var version = "1.4.4";
|
|
8
8
|
|
|
9
9
|
//#endregion
|
|
10
10
|
//#region src/utils/index.ts
|
|
@@ -82,58 +82,6 @@ const isParsedInstanceOfMatcherCall = (expectFnCall, classArg) => {
|
|
|
82
82
|
return getAccessorValue(expectFnCall.matcher) === "toBeInstanceOf" && expectFnCall.args.length === 1 && isSupportedAccessor(expectFnCall.args[0], classArg);
|
|
83
83
|
};
|
|
84
84
|
|
|
85
|
-
//#endregion
|
|
86
|
-
//#region src/rules/consistent-test-filename.ts
|
|
87
|
-
const RULE_NAME$74 = "consistent-test-filename";
|
|
88
|
-
const defaultPattern = /.*\.test\.[tj]sx?$/;
|
|
89
|
-
const defaultTestsPattern = /.*\.(test|spec)\.[tj]sx?$/;
|
|
90
|
-
var consistent_test_filename_default = createEslintRule({
|
|
91
|
-
name: RULE_NAME$74,
|
|
92
|
-
meta: {
|
|
93
|
-
type: "problem",
|
|
94
|
-
docs: {
|
|
95
|
-
recommended: false,
|
|
96
|
-
requiresTypeChecking: false,
|
|
97
|
-
description: "require test file pattern"
|
|
98
|
-
},
|
|
99
|
-
messages: { consistentTestFilename: "Use test file name pattern {{ pattern }}" },
|
|
100
|
-
schema: [{
|
|
101
|
-
type: "object",
|
|
102
|
-
additionalProperties: false,
|
|
103
|
-
properties: {
|
|
104
|
-
pattern: {
|
|
105
|
-
type: "string",
|
|
106
|
-
format: "regex",
|
|
107
|
-
default: defaultPattern.source
|
|
108
|
-
},
|
|
109
|
-
allTestPattern: {
|
|
110
|
-
type: "string",
|
|
111
|
-
format: "regex",
|
|
112
|
-
default: defaultTestsPattern.source
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}]
|
|
116
|
-
},
|
|
117
|
-
defaultOptions: [{
|
|
118
|
-
pattern: defaultPattern.source,
|
|
119
|
-
allTestPattern: defaultTestsPattern.source
|
|
120
|
-
}],
|
|
121
|
-
create: (context, options) => {
|
|
122
|
-
const { pattern: patternRaw, allTestPattern: allTestPatternRaw } = options[0];
|
|
123
|
-
const pattern = new RegExp(patternRaw);
|
|
124
|
-
const allTestPattern = new RegExp(allTestPatternRaw);
|
|
125
|
-
const { filename } = context;
|
|
126
|
-
if (!allTestPattern.test(filename)) return {};
|
|
127
|
-
return { Program: (p) => {
|
|
128
|
-
if (!pattern.test(filename)) context.report({
|
|
129
|
-
node: p,
|
|
130
|
-
messageId: "consistentTestFilename",
|
|
131
|
-
data: { pattern: patternRaw }
|
|
132
|
-
});
|
|
133
|
-
} };
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
|
|
137
85
|
//#endregion
|
|
138
86
|
//#region src/utils/require.ts
|
|
139
87
|
const require = createRequire(import.meta.url);
|
|
@@ -1828,9 +1776,129 @@ const getFirstMatcherArg = (expectFnCall) => {
|
|
|
1828
1776
|
const isTypeCastExpression$1 = (node) => node.type === AST_NODE_TYPES.TSAsExpression || node.type === AST_NODE_TYPES.TSTypeAssertion;
|
|
1829
1777
|
const followTypeAssertionChain$1 = (expression) => isTypeCastExpression$1(expression) ? followTypeAssertionChain$1(expression.expression) : expression;
|
|
1830
1778
|
|
|
1779
|
+
//#endregion
|
|
1780
|
+
//#region src/rules/consistent-each-for.ts
|
|
1781
|
+
const RULE_NAME$76 = "consistent-each-for";
|
|
1782
|
+
const BASE_FN_NAMES = [
|
|
1783
|
+
"test",
|
|
1784
|
+
"it",
|
|
1785
|
+
"describe",
|
|
1786
|
+
"suite"
|
|
1787
|
+
];
|
|
1788
|
+
var consistent_each_for_default = createEslintRule({
|
|
1789
|
+
name: RULE_NAME$76,
|
|
1790
|
+
meta: {
|
|
1791
|
+
type: "suggestion",
|
|
1792
|
+
docs: {
|
|
1793
|
+
description: "enforce using `.each` or `.for` consistently",
|
|
1794
|
+
recommended: false
|
|
1795
|
+
},
|
|
1796
|
+
messages: { consistentMethod: "Prefer using `{{ functionName }}.{{ preferred }}` over `{{ functionName }}.{{ actual }}`" },
|
|
1797
|
+
schema: [{
|
|
1798
|
+
type: "object",
|
|
1799
|
+
properties: {
|
|
1800
|
+
test: {
|
|
1801
|
+
type: "string",
|
|
1802
|
+
enum: ["each", "for"]
|
|
1803
|
+
},
|
|
1804
|
+
it: {
|
|
1805
|
+
type: "string",
|
|
1806
|
+
enum: ["each", "for"]
|
|
1807
|
+
},
|
|
1808
|
+
describe: {
|
|
1809
|
+
type: "string",
|
|
1810
|
+
enum: ["each", "for"]
|
|
1811
|
+
},
|
|
1812
|
+
suite: {
|
|
1813
|
+
type: "string",
|
|
1814
|
+
enum: ["each", "for"]
|
|
1815
|
+
}
|
|
1816
|
+
},
|
|
1817
|
+
additionalProperties: false
|
|
1818
|
+
}],
|
|
1819
|
+
defaultOptions: [{}]
|
|
1820
|
+
},
|
|
1821
|
+
defaultOptions: [{}],
|
|
1822
|
+
create(context, [options]) {
|
|
1823
|
+
return { CallExpression(node) {
|
|
1824
|
+
const vitestFnCall = parseVitestFnCall(node, context);
|
|
1825
|
+
if (!vitestFnCall) return;
|
|
1826
|
+
const baseFunctionName = vitestFnCall.name.replace(/^[fx]/, "");
|
|
1827
|
+
if (!BASE_FN_NAMES.includes(baseFunctionName)) return;
|
|
1828
|
+
const eachMember = vitestFnCall.members.find((member) => getAccessorValue(member) === "each");
|
|
1829
|
+
const forMember = vitestFnCall.members.find((member) => getAccessorValue(member) === "for");
|
|
1830
|
+
if (!eachMember && !forMember) return;
|
|
1831
|
+
const preference = options[baseFunctionName];
|
|
1832
|
+
if (!preference) return;
|
|
1833
|
+
const actual = eachMember ? "each" : "for";
|
|
1834
|
+
if (actual !== preference) context.report({
|
|
1835
|
+
node: eachMember || forMember,
|
|
1836
|
+
messageId: "consistentMethod",
|
|
1837
|
+
data: {
|
|
1838
|
+
functionName: vitestFnCall.name,
|
|
1839
|
+
preferred: preference,
|
|
1840
|
+
actual
|
|
1841
|
+
}
|
|
1842
|
+
});
|
|
1843
|
+
} };
|
|
1844
|
+
}
|
|
1845
|
+
});
|
|
1846
|
+
|
|
1847
|
+
//#endregion
|
|
1848
|
+
//#region src/rules/consistent-test-filename.ts
|
|
1849
|
+
const RULE_NAME$75 = "consistent-test-filename";
|
|
1850
|
+
const defaultPattern = /.*\.test\.[tj]sx?$/;
|
|
1851
|
+
const defaultTestsPattern = /.*\.(test|spec)\.[tj]sx?$/;
|
|
1852
|
+
var consistent_test_filename_default = createEslintRule({
|
|
1853
|
+
name: RULE_NAME$75,
|
|
1854
|
+
meta: {
|
|
1855
|
+
type: "problem",
|
|
1856
|
+
docs: {
|
|
1857
|
+
recommended: false,
|
|
1858
|
+
requiresTypeChecking: false,
|
|
1859
|
+
description: "require test file pattern"
|
|
1860
|
+
},
|
|
1861
|
+
messages: { consistentTestFilename: "Use test file name pattern {{ pattern }}" },
|
|
1862
|
+
schema: [{
|
|
1863
|
+
type: "object",
|
|
1864
|
+
additionalProperties: false,
|
|
1865
|
+
properties: {
|
|
1866
|
+
pattern: {
|
|
1867
|
+
type: "string",
|
|
1868
|
+
format: "regex",
|
|
1869
|
+
default: defaultPattern.source
|
|
1870
|
+
},
|
|
1871
|
+
allTestPattern: {
|
|
1872
|
+
type: "string",
|
|
1873
|
+
format: "regex",
|
|
1874
|
+
default: defaultTestsPattern.source
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1877
|
+
}]
|
|
1878
|
+
},
|
|
1879
|
+
defaultOptions: [{
|
|
1880
|
+
pattern: defaultPattern.source,
|
|
1881
|
+
allTestPattern: defaultTestsPattern.source
|
|
1882
|
+
}],
|
|
1883
|
+
create: (context, options) => {
|
|
1884
|
+
const { pattern: patternRaw, allTestPattern: allTestPatternRaw } = options[0];
|
|
1885
|
+
const pattern = new RegExp(patternRaw);
|
|
1886
|
+
const allTestPattern = new RegExp(allTestPatternRaw);
|
|
1887
|
+
const { filename } = context;
|
|
1888
|
+
if (!allTestPattern.test(filename)) return {};
|
|
1889
|
+
return { Program: (p) => {
|
|
1890
|
+
if (!pattern.test(filename)) context.report({
|
|
1891
|
+
node: p,
|
|
1892
|
+
messageId: "consistentTestFilename",
|
|
1893
|
+
data: { pattern: patternRaw }
|
|
1894
|
+
});
|
|
1895
|
+
} };
|
|
1896
|
+
}
|
|
1897
|
+
});
|
|
1898
|
+
|
|
1831
1899
|
//#endregion
|
|
1832
1900
|
//#region src/rules/consistent-test-it.ts
|
|
1833
|
-
const RULE_NAME$
|
|
1901
|
+
const RULE_NAME$74 = "consistent-test-it";
|
|
1834
1902
|
const buildFixer = (callee, nodeName, preferredTestKeyword) => (fixer) => [fixer.replaceText(callee.type === AST_NODE_TYPES.MemberExpression ? callee.object : callee, getPreferredNodeName(nodeName, preferredTestKeyword))];
|
|
1835
1903
|
function getPreferredNodeName(nodeName, preferredTestKeyword) {
|
|
1836
1904
|
if (nodeName === TestCaseName.fit) return "test.only";
|
|
@@ -1841,7 +1909,7 @@ function getOppositeTestKeyword(test) {
|
|
|
1841
1909
|
return TestCaseName.test;
|
|
1842
1910
|
}
|
|
1843
1911
|
var consistent_test_it_default = createEslintRule({
|
|
1844
|
-
name: RULE_NAME$
|
|
1912
|
+
name: RULE_NAME$74,
|
|
1845
1913
|
meta: {
|
|
1846
1914
|
type: "suggestion",
|
|
1847
1915
|
fixable: "code",
|
|
@@ -1946,10 +2014,10 @@ var consistent_test_it_default = createEslintRule({
|
|
|
1946
2014
|
|
|
1947
2015
|
//#endregion
|
|
1948
2016
|
//#region src/rules/consistent-vitest-vi.ts
|
|
1949
|
-
const RULE_NAME$
|
|
2017
|
+
const RULE_NAME$73 = "consistent-vitest-vi";
|
|
1950
2018
|
const getOppositeVitestUtilKeyword = (util) => util === UtilName.vi ? UtilName.vitest : UtilName.vi;
|
|
1951
2019
|
var consistent_vitest_vi_default = createEslintRule({
|
|
1952
|
-
name: RULE_NAME$
|
|
2020
|
+
name: RULE_NAME$73,
|
|
1953
2021
|
meta: {
|
|
1954
2022
|
type: "suggestion",
|
|
1955
2023
|
fixable: "code",
|
|
@@ -2029,9 +2097,9 @@ function parsePluginSettings(settings) {
|
|
|
2029
2097
|
|
|
2030
2098
|
//#endregion
|
|
2031
2099
|
//#region src/rules/expect-expect.ts
|
|
2032
|
-
const RULE_NAME$
|
|
2100
|
+
const RULE_NAME$72 = "expect-expect";
|
|
2033
2101
|
var expect_expect_default = createEslintRule({
|
|
2034
|
-
name: RULE_NAME$
|
|
2102
|
+
name: RULE_NAME$72,
|
|
2035
2103
|
meta: {
|
|
2036
2104
|
type: "suggestion",
|
|
2037
2105
|
docs: {
|
|
@@ -2075,8 +2143,11 @@ var expect_expect_default = createEslintRule({
|
|
|
2075
2143
|
return {
|
|
2076
2144
|
CallExpression(node) {
|
|
2077
2145
|
if (node.callee.type === AST_NODE_TYPES.Identifier && node.callee.name === "bench") return;
|
|
2078
|
-
if (node?.callee?.type === AST_NODE_TYPES.MemberExpression && node.callee.property.type === AST_NODE_TYPES.Identifier &&
|
|
2079
|
-
|
|
2146
|
+
if (node?.callee?.type === AST_NODE_TYPES.MemberExpression && node.callee.property.type === AST_NODE_TYPES.Identifier && [
|
|
2147
|
+
"skip",
|
|
2148
|
+
"extend",
|
|
2149
|
+
"scoped"
|
|
2150
|
+
].includes(node.callee.property.name)) return;
|
|
2080
2151
|
const name = getNodeName(node) ?? "";
|
|
2081
2152
|
if (isTypeOfVitestFnCall(node, context, ["test"]) || additionalTestBlockFunctions.includes(name)) {
|
|
2082
2153
|
if (node.callee.type === AST_NODE_TYPES.MemberExpression && isSupportedAccessor(node.callee.property, "todo")) return;
|
|
@@ -2104,14 +2175,14 @@ function buildPatternRegexp(pattern) {
|
|
|
2104
2175
|
|
|
2105
2176
|
//#endregion
|
|
2106
2177
|
//#region src/rules/hoisted-apis-on-top.ts
|
|
2107
|
-
const RULE_NAME$
|
|
2178
|
+
const RULE_NAME$71 = "hoisted-apis-on-top";
|
|
2108
2179
|
const hoistedAPIs = [
|
|
2109
2180
|
"mock",
|
|
2110
2181
|
"hoisted",
|
|
2111
2182
|
"unmock"
|
|
2112
2183
|
];
|
|
2113
2184
|
var hoisted_apis_on_top_default = createEslintRule({
|
|
2114
|
-
name: RULE_NAME$
|
|
2185
|
+
name: RULE_NAME$71,
|
|
2115
2186
|
meta: {
|
|
2116
2187
|
hasSuggestions: true,
|
|
2117
2188
|
type: "suggestion",
|
|
@@ -2178,9 +2249,9 @@ var hoisted_apis_on_top_default = createEslintRule({
|
|
|
2178
2249
|
|
|
2179
2250
|
//#endregion
|
|
2180
2251
|
//#region src/rules/max-expects.ts
|
|
2181
|
-
const RULE_NAME$
|
|
2252
|
+
const RULE_NAME$70 = "max-expects";
|
|
2182
2253
|
var max_expects_default = createEslintRule({
|
|
2183
|
-
name: RULE_NAME$
|
|
2254
|
+
name: RULE_NAME$70,
|
|
2184
2255
|
meta: {
|
|
2185
2256
|
docs: {
|
|
2186
2257
|
requiresTypeChecking: false,
|
|
@@ -2225,9 +2296,9 @@ var max_expects_default = createEslintRule({
|
|
|
2225
2296
|
|
|
2226
2297
|
//#endregion
|
|
2227
2298
|
//#region src/rules/max-nested-describe.ts
|
|
2228
|
-
const RULE_NAME$
|
|
2299
|
+
const RULE_NAME$69 = "max-nested-describe";
|
|
2229
2300
|
var max_nested_describe_default = createEslintRule({
|
|
2230
|
-
name: RULE_NAME$
|
|
2301
|
+
name: RULE_NAME$69,
|
|
2231
2302
|
meta: {
|
|
2232
2303
|
type: "problem",
|
|
2233
2304
|
docs: {
|
|
@@ -2269,9 +2340,9 @@ var max_nested_describe_default = createEslintRule({
|
|
|
2269
2340
|
|
|
2270
2341
|
//#endregion
|
|
2271
2342
|
//#region src/rules/no-alias-methods.ts
|
|
2272
|
-
const RULE_NAME$
|
|
2343
|
+
const RULE_NAME$68 = "no-alias-methods";
|
|
2273
2344
|
var no_alias_methods_default = createEslintRule({
|
|
2274
|
-
name: RULE_NAME$
|
|
2345
|
+
name: RULE_NAME$68,
|
|
2275
2346
|
meta: {
|
|
2276
2347
|
docs: {
|
|
2277
2348
|
description: "disallow alias methods",
|
|
@@ -2321,12 +2392,12 @@ var no_alias_methods_default = createEslintRule({
|
|
|
2321
2392
|
|
|
2322
2393
|
//#endregion
|
|
2323
2394
|
//#region src/rules/no-commented-out-tests.ts
|
|
2324
|
-
const RULE_NAME$
|
|
2395
|
+
const RULE_NAME$67 = "no-commented-out-tests";
|
|
2325
2396
|
function hasTests(node) {
|
|
2326
2397
|
return /^\s*[xf]?(test|it|describe)(\.\w+|\[['"]\w+['"]\])?\s*\(/mu.test(node.value);
|
|
2327
2398
|
}
|
|
2328
2399
|
var no_commented_out_tests_default = createEslintRule({
|
|
2329
|
-
name: RULE_NAME$
|
|
2400
|
+
name: RULE_NAME$67,
|
|
2330
2401
|
meta: {
|
|
2331
2402
|
docs: {
|
|
2332
2403
|
description: "disallow commented out tests",
|
|
@@ -2355,10 +2426,10 @@ var no_commented_out_tests_default = createEslintRule({
|
|
|
2355
2426
|
|
|
2356
2427
|
//#endregion
|
|
2357
2428
|
//#region src/rules/no-conditional-expect.ts
|
|
2358
|
-
const RULE_NAME$
|
|
2429
|
+
const RULE_NAME$66 = "no-conditional-expect";
|
|
2359
2430
|
const isCatchCall = (node) => node.callee.type === AST_NODE_TYPES.MemberExpression && isSupportedAccessor(node.callee.property, "catch");
|
|
2360
2431
|
var no_conditional_expect_default = createEslintRule({
|
|
2361
|
-
name: RULE_NAME$
|
|
2432
|
+
name: RULE_NAME$66,
|
|
2362
2433
|
meta: {
|
|
2363
2434
|
type: "problem",
|
|
2364
2435
|
docs: {
|
|
@@ -2413,9 +2484,9 @@ var no_conditional_expect_default = createEslintRule({
|
|
|
2413
2484
|
|
|
2414
2485
|
//#endregion
|
|
2415
2486
|
//#region src/rules/no-conditional-in-test.ts
|
|
2416
|
-
const RULE_NAME$
|
|
2487
|
+
const RULE_NAME$65 = "no-conditional-in-test";
|
|
2417
2488
|
var no_conditional_in_test_default = createEslintRule({
|
|
2418
|
-
name: RULE_NAME$
|
|
2489
|
+
name: RULE_NAME$65,
|
|
2419
2490
|
meta: {
|
|
2420
2491
|
docs: {
|
|
2421
2492
|
description: "disallow conditional tests",
|
|
@@ -2439,9 +2510,9 @@ var no_conditional_in_test_default = createEslintRule({
|
|
|
2439
2510
|
|
|
2440
2511
|
//#endregion
|
|
2441
2512
|
//#region src/rules/no-conditional-tests.ts
|
|
2442
|
-
const RULE_NAME$
|
|
2513
|
+
const RULE_NAME$64 = "no-conditional-tests";
|
|
2443
2514
|
var no_conditional_tests_default = createEslintRule({
|
|
2444
|
-
name: RULE_NAME$
|
|
2515
|
+
name: RULE_NAME$64,
|
|
2445
2516
|
meta: {
|
|
2446
2517
|
type: "problem",
|
|
2447
2518
|
docs: {
|
|
@@ -2470,9 +2541,9 @@ var no_conditional_tests_default = createEslintRule({
|
|
|
2470
2541
|
|
|
2471
2542
|
//#endregion
|
|
2472
2543
|
//#region src/rules/no-disabled-tests.ts
|
|
2473
|
-
const RULE_NAME$
|
|
2544
|
+
const RULE_NAME$63 = "no-disabled-tests";
|
|
2474
2545
|
var no_disabled_tests_default = createEslintRule({
|
|
2475
|
-
name: RULE_NAME$
|
|
2546
|
+
name: RULE_NAME$63,
|
|
2476
2547
|
meta: {
|
|
2477
2548
|
type: "suggestion",
|
|
2478
2549
|
docs: {
|
|
@@ -2538,7 +2609,7 @@ var no_disabled_tests_default = createEslintRule({
|
|
|
2538
2609
|
|
|
2539
2610
|
//#endregion
|
|
2540
2611
|
//#region src/rules/no-done-callback.ts
|
|
2541
|
-
const RULE_NAME$
|
|
2612
|
+
const RULE_NAME$62 = "no-done-callback";
|
|
2542
2613
|
const findCallbackArg = (node, isVitestEach, context) => {
|
|
2543
2614
|
if (isVitestEach) return node.arguments[1];
|
|
2544
2615
|
const vitestFnCall = parseVitestFnCall(node, context);
|
|
@@ -2547,7 +2618,7 @@ const findCallbackArg = (node, isVitestEach, context) => {
|
|
|
2547
2618
|
return null;
|
|
2548
2619
|
};
|
|
2549
2620
|
var no_done_callback_default = createEslintRule({
|
|
2550
|
-
name: RULE_NAME$
|
|
2621
|
+
name: RULE_NAME$62,
|
|
2551
2622
|
meta: {
|
|
2552
2623
|
type: "suggestion",
|
|
2553
2624
|
docs: {
|
|
@@ -2632,9 +2703,9 @@ var no_done_callback_default = createEslintRule({
|
|
|
2632
2703
|
|
|
2633
2704
|
//#endregion
|
|
2634
2705
|
//#region src/rules/no-duplicate-hooks.ts
|
|
2635
|
-
const RULE_NAME$
|
|
2706
|
+
const RULE_NAME$61 = "no-duplicate-hooks";
|
|
2636
2707
|
var no_duplicate_hooks_default = createEslintRule({
|
|
2637
|
-
name: RULE_NAME$
|
|
2708
|
+
name: RULE_NAME$61,
|
|
2638
2709
|
meta: {
|
|
2639
2710
|
docs: {
|
|
2640
2711
|
recommended: false,
|
|
@@ -2671,7 +2742,7 @@ var no_duplicate_hooks_default = createEslintRule({
|
|
|
2671
2742
|
|
|
2672
2743
|
//#endregion
|
|
2673
2744
|
//#region src/rules/no-focused-tests.ts
|
|
2674
|
-
const RULE_NAME$
|
|
2745
|
+
const RULE_NAME$60 = "no-focused-tests";
|
|
2675
2746
|
const isTestOrDescribe = (node) => {
|
|
2676
2747
|
return node.type === "Identifier" && [
|
|
2677
2748
|
"it",
|
|
@@ -2683,7 +2754,7 @@ const isOnly = (node) => {
|
|
|
2683
2754
|
return node.type === "Identifier" && node.name === "only";
|
|
2684
2755
|
};
|
|
2685
2756
|
var no_focused_tests_default = createEslintRule({
|
|
2686
|
-
name: RULE_NAME$
|
|
2757
|
+
name: RULE_NAME$60,
|
|
2687
2758
|
meta: {
|
|
2688
2759
|
type: "problem",
|
|
2689
2760
|
docs: {
|
|
@@ -2743,9 +2814,9 @@ var no_focused_tests_default = createEslintRule({
|
|
|
2743
2814
|
|
|
2744
2815
|
//#endregion
|
|
2745
2816
|
//#region src/rules/no-hooks.ts
|
|
2746
|
-
const RULE_NAME$
|
|
2817
|
+
const RULE_NAME$59 = "no-hooks";
|
|
2747
2818
|
var no_hooks_default = createEslintRule({
|
|
2748
|
-
name: RULE_NAME$
|
|
2819
|
+
name: RULE_NAME$59,
|
|
2749
2820
|
meta: {
|
|
2750
2821
|
type: "suggestion",
|
|
2751
2822
|
docs: {
|
|
@@ -2788,13 +2859,13 @@ var no_hooks_default = createEslintRule({
|
|
|
2788
2859
|
|
|
2789
2860
|
//#endregion
|
|
2790
2861
|
//#region src/rules/no-identical-title.ts
|
|
2791
|
-
const RULE_NAME$
|
|
2862
|
+
const RULE_NAME$58 = "no-identical-title";
|
|
2792
2863
|
const newDescribeContext = () => ({
|
|
2793
2864
|
describeTitles: [],
|
|
2794
2865
|
testTitles: []
|
|
2795
2866
|
});
|
|
2796
2867
|
var no_identical_title_default = createEslintRule({
|
|
2797
|
-
name: RULE_NAME$
|
|
2868
|
+
name: RULE_NAME$58,
|
|
2798
2869
|
meta: {
|
|
2799
2870
|
type: "problem",
|
|
2800
2871
|
docs: {
|
|
@@ -2817,7 +2888,7 @@ var no_identical_title_default = createEslintRule({
|
|
|
2817
2888
|
const vitestFnCall = parseVitestFnCall(node, context);
|
|
2818
2889
|
if (!vitestFnCall) return;
|
|
2819
2890
|
if (vitestFnCall.name === "describe" || vitestFnCall.name === "suite") stack.push(newDescribeContext());
|
|
2820
|
-
if (vitestFnCall.members.
|
|
2891
|
+
if (vitestFnCall.members.some((member) => ["each", "for"].some((accessor) => isSupportedAccessor(member, accessor)))) return;
|
|
2821
2892
|
const [argument] = node.arguments;
|
|
2822
2893
|
if (!argument || !isStringNode(argument)) return;
|
|
2823
2894
|
const title = getStringValue(argument);
|
|
@@ -2844,9 +2915,9 @@ var no_identical_title_default = createEslintRule({
|
|
|
2844
2915
|
|
|
2845
2916
|
//#endregion
|
|
2846
2917
|
//#region src/rules/no-import-node-test.ts
|
|
2847
|
-
const RULE_NAME$
|
|
2918
|
+
const RULE_NAME$57 = "no-import-node-test";
|
|
2848
2919
|
var no_import_node_test_default = createEslintRule({
|
|
2849
|
-
name: RULE_NAME$
|
|
2920
|
+
name: RULE_NAME$57,
|
|
2850
2921
|
meta: {
|
|
2851
2922
|
docs: {
|
|
2852
2923
|
description: "disallow importing `node:test`",
|
|
@@ -2943,9 +3014,9 @@ const removeNodeFromArray = (fixer, nodes, target) => {
|
|
|
2943
3014
|
|
|
2944
3015
|
//#endregion
|
|
2945
3016
|
//#region src/rules/no-importing-vitest-globals.ts
|
|
2946
|
-
const RULE_NAME$
|
|
3017
|
+
const RULE_NAME$56 = "no-importing-vitest-globals";
|
|
2947
3018
|
var no_importing_vitest_globals_default = createEslintRule({
|
|
2948
|
-
name: RULE_NAME$
|
|
3019
|
+
name: RULE_NAME$56,
|
|
2949
3020
|
meta: {
|
|
2950
3021
|
type: "suggestion",
|
|
2951
3022
|
docs: {
|
|
@@ -3001,9 +3072,9 @@ var no_importing_vitest_globals_default = createEslintRule({
|
|
|
3001
3072
|
|
|
3002
3073
|
//#endregion
|
|
3003
3074
|
//#region src/rules/no-interpolation-in-snapshots.ts
|
|
3004
|
-
const RULE_NAME$
|
|
3075
|
+
const RULE_NAME$55 = "no-interpolation-in-snapshots";
|
|
3005
3076
|
var no_interpolation_in_snapshots_default = createEslintRule({
|
|
3006
|
-
name: RULE_NAME$
|
|
3077
|
+
name: RULE_NAME$55,
|
|
3007
3078
|
meta: {
|
|
3008
3079
|
type: "problem",
|
|
3009
3080
|
docs: {
|
|
@@ -3031,7 +3102,7 @@ var no_interpolation_in_snapshots_default = createEslintRule({
|
|
|
3031
3102
|
|
|
3032
3103
|
//#endregion
|
|
3033
3104
|
//#region src/rules/no-large-snapshots.ts
|
|
3034
|
-
const RULE_NAME$
|
|
3105
|
+
const RULE_NAME$54 = "no-large-snapshots";
|
|
3035
3106
|
const reportOnViolation = (context, node, { maxSize: lineLimit = 50, allowedSnapshots = {} }) => {
|
|
3036
3107
|
const startLine = node.loc.start.line;
|
|
3037
3108
|
const lineCount = node.loc.end.line - startLine;
|
|
@@ -3057,7 +3128,7 @@ const reportOnViolation = (context, node, { maxSize: lineLimit = 50, allowedSnap
|
|
|
3057
3128
|
});
|
|
3058
3129
|
};
|
|
3059
3130
|
var no_large_snapshots_default = createEslintRule({
|
|
3060
|
-
name: RULE_NAME$
|
|
3131
|
+
name: RULE_NAME$54,
|
|
3061
3132
|
meta: {
|
|
3062
3133
|
docs: {
|
|
3063
3134
|
description: "disallow large snapshots",
|
|
@@ -3102,9 +3173,9 @@ var no_large_snapshots_default = createEslintRule({
|
|
|
3102
3173
|
const mocksDirName = "__mocks__";
|
|
3103
3174
|
const isMockPath = (path) => path.split(posix.sep).includes(mocksDirName);
|
|
3104
3175
|
const isMockImportLiteral = (expression) => isStringNode(expression) && isMockPath(getStringValue(expression));
|
|
3105
|
-
const RULE_NAME$
|
|
3176
|
+
const RULE_NAME$53 = "no-mocks-import";
|
|
3106
3177
|
var no_mocks_import_default = createEslintRule({
|
|
3107
|
-
name: RULE_NAME$
|
|
3178
|
+
name: RULE_NAME$53,
|
|
3108
3179
|
meta: {
|
|
3109
3180
|
type: "problem",
|
|
3110
3181
|
docs: {
|
|
@@ -3136,13 +3207,13 @@ var no_mocks_import_default = createEslintRule({
|
|
|
3136
3207
|
|
|
3137
3208
|
//#endregion
|
|
3138
3209
|
//#region src/rules/no-restricted-matchers.ts
|
|
3139
|
-
const RULE_NAME$
|
|
3210
|
+
const RULE_NAME$52 = "no-restricted-matchers";
|
|
3140
3211
|
const isChainRestricted = (chain, restriction) => {
|
|
3141
3212
|
if (Object.prototype.hasOwnProperty.call(ModifierName, restriction) || restriction.endsWith(".not")) return chain.startsWith(restriction);
|
|
3142
3213
|
return chain === restriction;
|
|
3143
3214
|
};
|
|
3144
3215
|
var no_restricted_matchers_default = createEslintRule({
|
|
3145
|
-
name: RULE_NAME$
|
|
3216
|
+
name: RULE_NAME$52,
|
|
3146
3217
|
meta: {
|
|
3147
3218
|
docs: {
|
|
3148
3219
|
description: "disallow the use of certain matchers",
|
|
@@ -3184,9 +3255,9 @@ var no_restricted_matchers_default = createEslintRule({
|
|
|
3184
3255
|
|
|
3185
3256
|
//#endregion
|
|
3186
3257
|
//#region src/rules/no-restricted-vi-methods.ts
|
|
3187
|
-
const RULE_NAME$
|
|
3258
|
+
const RULE_NAME$51 = "no-restricted-vi-methods";
|
|
3188
3259
|
var no_restricted_vi_methods_default = createEslintRule({
|
|
3189
|
-
name: RULE_NAME$
|
|
3260
|
+
name: RULE_NAME$51,
|
|
3190
3261
|
meta: {
|
|
3191
3262
|
type: "suggestion",
|
|
3192
3263
|
docs: {
|
|
@@ -3228,7 +3299,7 @@ var no_restricted_vi_methods_default = createEslintRule({
|
|
|
3228
3299
|
|
|
3229
3300
|
//#endregion
|
|
3230
3301
|
//#region src/rules/no-standalone-expect.ts
|
|
3231
|
-
const RULE_NAME$
|
|
3302
|
+
const RULE_NAME$50 = "no-standalone-expect";
|
|
3232
3303
|
const getBlockType = (statement, context) => {
|
|
3233
3304
|
const func = statement.parent;
|
|
3234
3305
|
if (!func) throw new Error("Unexpected block statement. If you feel like this is a bug report https://github.com/veritem/eslint-plugin-vitest/issues/new");
|
|
@@ -3241,7 +3312,7 @@ const getBlockType = (statement, context) => {
|
|
|
3241
3312
|
return null;
|
|
3242
3313
|
};
|
|
3243
3314
|
var no_standalone_expect_default = createEslintRule({
|
|
3244
|
-
name: RULE_NAME$
|
|
3315
|
+
name: RULE_NAME$50,
|
|
3245
3316
|
meta: {
|
|
3246
3317
|
docs: {
|
|
3247
3318
|
description: "disallow using `expect` outside of `it` or `test` blocks",
|
|
@@ -3300,9 +3371,9 @@ var no_standalone_expect_default = createEslintRule({
|
|
|
3300
3371
|
|
|
3301
3372
|
//#endregion
|
|
3302
3373
|
//#region src/rules/no-test-prefixes.ts
|
|
3303
|
-
const RULE_NAME$
|
|
3374
|
+
const RULE_NAME$49 = "no-test-prefixes";
|
|
3304
3375
|
var no_test_prefixes_default = createEslintRule({
|
|
3305
|
-
name: RULE_NAME$
|
|
3376
|
+
name: RULE_NAME$49,
|
|
3306
3377
|
meta: {
|
|
3307
3378
|
docs: {
|
|
3308
3379
|
description: "disallow using the `f` and `x` prefixes in favour of `.only` and `.skip`",
|
|
@@ -3337,14 +3408,14 @@ var no_test_prefixes_default = createEslintRule({
|
|
|
3337
3408
|
|
|
3338
3409
|
//#endregion
|
|
3339
3410
|
//#region src/rules/no-test-return-statement.ts
|
|
3340
|
-
const RULE_NAME$
|
|
3411
|
+
const RULE_NAME$48 = "no-test-return-statement";
|
|
3341
3412
|
const getBody = (args) => {
|
|
3342
3413
|
const [, secondArg] = args;
|
|
3343
3414
|
if (secondArg && isFunction(secondArg) && secondArg.body.type === AST_NODE_TYPES.BlockStatement) return secondArg.body.body;
|
|
3344
3415
|
return [];
|
|
3345
3416
|
};
|
|
3346
3417
|
var no_test_return_statement_default = createEslintRule({
|
|
3347
|
-
name: RULE_NAME$
|
|
3418
|
+
name: RULE_NAME$48,
|
|
3348
3419
|
meta: {
|
|
3349
3420
|
type: "problem",
|
|
3350
3421
|
docs: {
|
|
@@ -3615,7 +3686,7 @@ const createPaddingRule = (name, description, configs, deprecated = false) => {
|
|
|
3615
3686
|
|
|
3616
3687
|
//#endregion
|
|
3617
3688
|
//#region src/rules/padding-around-after-all-blocks.ts
|
|
3618
|
-
const RULE_NAME$
|
|
3689
|
+
const RULE_NAME$47 = "padding-around-after-all-blocks";
|
|
3619
3690
|
const config = [{
|
|
3620
3691
|
paddingType: PaddingType.Always,
|
|
3621
3692
|
prevStatementType: StatementType.Any,
|
|
@@ -3625,11 +3696,11 @@ const config = [{
|
|
|
3625
3696
|
prevStatementType: StatementType.AfterAllToken,
|
|
3626
3697
|
nextStatementType: StatementType.Any
|
|
3627
3698
|
}];
|
|
3628
|
-
var padding_around_after_all_blocks_default = createPaddingRule(RULE_NAME$
|
|
3699
|
+
var padding_around_after_all_blocks_default = createPaddingRule(RULE_NAME$47, "Enforce padding around `afterAll` blocks", config);
|
|
3629
3700
|
|
|
3630
3701
|
//#endregion
|
|
3631
3702
|
//#region src/rules/padding-around-after-each-blocks.ts
|
|
3632
|
-
const RULE_NAME$
|
|
3703
|
+
const RULE_NAME$46 = "padding-around-after-each-blocks";
|
|
3633
3704
|
const config$1 = [{
|
|
3634
3705
|
paddingType: PaddingType.Always,
|
|
3635
3706
|
prevStatementType: StatementType.Any,
|
|
@@ -3639,11 +3710,11 @@ const config$1 = [{
|
|
|
3639
3710
|
prevStatementType: StatementType.AfterEachToken,
|
|
3640
3711
|
nextStatementType: StatementType.Any
|
|
3641
3712
|
}];
|
|
3642
|
-
var padding_around_after_each_blocks_default = createPaddingRule(RULE_NAME$
|
|
3713
|
+
var padding_around_after_each_blocks_default = createPaddingRule(RULE_NAME$46, "Enforce padding around `afterEach` blocks", config$1);
|
|
3643
3714
|
|
|
3644
3715
|
//#endregion
|
|
3645
3716
|
//#region src/rules/padding-around-before-all-blocks.ts
|
|
3646
|
-
const RULE_NAME$
|
|
3717
|
+
const RULE_NAME$45 = "padding-around-before-all-blocks";
|
|
3647
3718
|
const config$2 = [{
|
|
3648
3719
|
paddingType: PaddingType.Always,
|
|
3649
3720
|
prevStatementType: StatementType.Any,
|
|
@@ -3653,11 +3724,11 @@ const config$2 = [{
|
|
|
3653
3724
|
prevStatementType: StatementType.BeforeAllToken,
|
|
3654
3725
|
nextStatementType: StatementType.Any
|
|
3655
3726
|
}];
|
|
3656
|
-
var padding_around_before_all_blocks_default = createPaddingRule(RULE_NAME$
|
|
3727
|
+
var padding_around_before_all_blocks_default = createPaddingRule(RULE_NAME$45, "Enforce padding around `beforeAll` blocks", config$2);
|
|
3657
3728
|
|
|
3658
3729
|
//#endregion
|
|
3659
3730
|
//#region src/rules/padding-around-before-each-blocks.ts
|
|
3660
|
-
const RULE_NAME$
|
|
3731
|
+
const RULE_NAME$44 = "padding-around-before-each-blocks";
|
|
3661
3732
|
const config$3 = [{
|
|
3662
3733
|
paddingType: PaddingType.Always,
|
|
3663
3734
|
prevStatementType: StatementType.Any,
|
|
@@ -3667,11 +3738,11 @@ const config$3 = [{
|
|
|
3667
3738
|
prevStatementType: StatementType.BeforeEachToken,
|
|
3668
3739
|
nextStatementType: StatementType.Any
|
|
3669
3740
|
}];
|
|
3670
|
-
var padding_around_before_each_blocks_default = createPaddingRule(RULE_NAME$
|
|
3741
|
+
var padding_around_before_each_blocks_default = createPaddingRule(RULE_NAME$44, "Enforce padding around `beforeEach` blocks", config$3);
|
|
3671
3742
|
|
|
3672
3743
|
//#endregion
|
|
3673
3744
|
//#region src/rules/padding-around-describe-blocks.ts
|
|
3674
|
-
const RULE_NAME$
|
|
3745
|
+
const RULE_NAME$43 = "padding-around-describe-blocks";
|
|
3675
3746
|
const config$4 = [{
|
|
3676
3747
|
paddingType: PaddingType.Always,
|
|
3677
3748
|
prevStatementType: StatementType.Any,
|
|
@@ -3689,11 +3760,11 @@ const config$4 = [{
|
|
|
3689
3760
|
],
|
|
3690
3761
|
nextStatementType: StatementType.Any
|
|
3691
3762
|
}];
|
|
3692
|
-
var padding_around_describe_blocks_default = createPaddingRule(RULE_NAME$
|
|
3763
|
+
var padding_around_describe_blocks_default = createPaddingRule(RULE_NAME$43, "Enforce padding around `describe` blocks", config$4);
|
|
3693
3764
|
|
|
3694
3765
|
//#endregion
|
|
3695
3766
|
//#region src/rules/padding-around-expect-groups.ts
|
|
3696
|
-
const RULE_NAME$
|
|
3767
|
+
const RULE_NAME$42 = "padding-around-expect-groups";
|
|
3697
3768
|
const config$5 = [
|
|
3698
3769
|
{
|
|
3699
3770
|
paddingType: PaddingType.Always,
|
|
@@ -3726,11 +3797,11 @@ const config$5 = [
|
|
|
3726
3797
|
nextStatementType: StatementType.ExpectTypeOfToken
|
|
3727
3798
|
}
|
|
3728
3799
|
];
|
|
3729
|
-
var padding_around_expect_groups_default = createPaddingRule(RULE_NAME$
|
|
3800
|
+
var padding_around_expect_groups_default = createPaddingRule(RULE_NAME$42, "Enforce padding around `expect` groups", config$5);
|
|
3730
3801
|
|
|
3731
3802
|
//#endregion
|
|
3732
3803
|
//#region src/rules/padding-around-test-blocks.ts
|
|
3733
|
-
const RULE_NAME$
|
|
3804
|
+
const RULE_NAME$41 = "padding-around-test-blocks";
|
|
3734
3805
|
const config$6 = [{
|
|
3735
3806
|
paddingType: PaddingType.Always,
|
|
3736
3807
|
prevStatementType: StatementType.Any,
|
|
@@ -3752,12 +3823,12 @@ const config$6 = [{
|
|
|
3752
3823
|
],
|
|
3753
3824
|
nextStatementType: StatementType.Any
|
|
3754
3825
|
}];
|
|
3755
|
-
var padding_around_test_blocks_default = createPaddingRule(RULE_NAME$
|
|
3826
|
+
var padding_around_test_blocks_default = createPaddingRule(RULE_NAME$41, "Enforce padding around `test` blocks", config$6);
|
|
3756
3827
|
|
|
3757
3828
|
//#endregion
|
|
3758
3829
|
//#region src/rules/padding-around-all.ts
|
|
3759
|
-
const RULE_NAME$
|
|
3760
|
-
var padding_around_all_default = createPaddingRule(RULE_NAME$
|
|
3830
|
+
const RULE_NAME$40 = "padding-around-all";
|
|
3831
|
+
var padding_around_all_default = createPaddingRule(RULE_NAME$40, "Enforce padding around vitest functions", [
|
|
3761
3832
|
...config,
|
|
3762
3833
|
...config$1,
|
|
3763
3834
|
...config$2,
|
|
@@ -3769,7 +3840,7 @@ var padding_around_all_default = createPaddingRule(RULE_NAME$39, "Enforce paddin
|
|
|
3769
3840
|
|
|
3770
3841
|
//#endregion
|
|
3771
3842
|
//#region src/rules/prefer-called-exactly-once-with.ts
|
|
3772
|
-
const RULE_NAME$
|
|
3843
|
+
const RULE_NAME$39 = "prefer-called-exactly-once-with";
|
|
3773
3844
|
const MATCHERS_TO_COMBINE = ["toHaveBeenCalledOnce", "toHaveBeenCalledWith"];
|
|
3774
3845
|
const MOCK_CALL_RESET_METHODS = [
|
|
3775
3846
|
"mockClear",
|
|
@@ -3828,7 +3899,7 @@ const hasMockResetBetween = (body, firstCallExpression, secondCallExpression) =>
|
|
|
3828
3899
|
};
|
|
3829
3900
|
const getMemberProperty = (expression) => expression.callee.type === AST_NODE_TYPES.MemberExpression ? expression.callee.property : null;
|
|
3830
3901
|
var prefer_called_exactly_once_with_default = createEslintRule({
|
|
3831
|
-
name: RULE_NAME$
|
|
3902
|
+
name: RULE_NAME$39,
|
|
3832
3903
|
meta: {
|
|
3833
3904
|
docs: { description: "Prefer `toHaveBeenCalledExactlyOnceWith` over `toHaveBeenCalledOnce` and `toHaveBeenCalledWith`" },
|
|
3834
3905
|
messages: { preferCalledExactlyOnceWith: "Using `toHaveBeenCalledOnce` and `toHaveBeenCalledWith` on the same target; prefer `toHaveBeenCalledExactlyOnceWith` instead." },
|
|
@@ -3896,10 +3967,10 @@ var prefer_called_exactly_once_with_default = createEslintRule({
|
|
|
3896
3967
|
|
|
3897
3968
|
//#endregion
|
|
3898
3969
|
//#region src/rules/prefer-called-once.ts
|
|
3899
|
-
const RULE_NAME$
|
|
3970
|
+
const RULE_NAME$38 = "prefer-called-once";
|
|
3900
3971
|
const isOneLiteral = (node) => node.type === AST_NODE_TYPES.Literal && node.value === 1;
|
|
3901
3972
|
var prefer_called_once_default = createEslintRule({
|
|
3902
|
-
name: RULE_NAME$
|
|
3973
|
+
name: RULE_NAME$38,
|
|
3903
3974
|
meta: {
|
|
3904
3975
|
docs: {
|
|
3905
3976
|
description: "enforce using `toBeCalledOnce()` or `toHaveBeenCalledOnce()`",
|
|
@@ -3932,9 +4003,9 @@ var prefer_called_once_default = createEslintRule({
|
|
|
3932
4003
|
|
|
3933
4004
|
//#endregion
|
|
3934
4005
|
//#region src/rules/prefer-called-times.ts
|
|
3935
|
-
const RULE_NAME$
|
|
4006
|
+
const RULE_NAME$37 = "prefer-called-times";
|
|
3936
4007
|
var prefer_called_times_default = createEslintRule({
|
|
3937
|
-
name: RULE_NAME$
|
|
4008
|
+
name: RULE_NAME$37,
|
|
3938
4009
|
meta: {
|
|
3939
4010
|
docs: {
|
|
3940
4011
|
description: "enforce using `toBeCalledTimes(1)` or `toHaveBeenCalledTimes(1)`",
|
|
@@ -3967,9 +4038,9 @@ var prefer_called_times_default = createEslintRule({
|
|
|
3967
4038
|
|
|
3968
4039
|
//#endregion
|
|
3969
4040
|
//#region src/rules/prefer-called-with.ts
|
|
3970
|
-
const RULE_NAME$
|
|
4041
|
+
const RULE_NAME$36 = "prefer-called-with";
|
|
3971
4042
|
var prefer_called_with_default = createEslintRule({
|
|
3972
|
-
name: RULE_NAME$
|
|
4043
|
+
name: RULE_NAME$36,
|
|
3973
4044
|
meta: {
|
|
3974
4045
|
docs: {
|
|
3975
4046
|
description: "enforce using `toBeCalledWith()` or `toHaveBeenCalledWith()`",
|
|
@@ -4017,7 +4088,7 @@ const hasOnlyOneArgument = (call) => call.arguments.length === 1;
|
|
|
4017
4088
|
|
|
4018
4089
|
//#endregion
|
|
4019
4090
|
//#region src/rules/prefer-comparison-matcher.ts
|
|
4020
|
-
const RULE_NAME$
|
|
4091
|
+
const RULE_NAME$35 = "prefer-comparison-matcher";
|
|
4021
4092
|
const isString = (node) => {
|
|
4022
4093
|
return isStringNode(node) || node?.type === AST_NODE_TYPES.TemplateLiteral;
|
|
4023
4094
|
};
|
|
@@ -4043,7 +4114,7 @@ const determineMatcher = (operator, negated) => {
|
|
|
4043
4114
|
return null;
|
|
4044
4115
|
};
|
|
4045
4116
|
var prefer_comparison_matcher_default = createEslintRule({
|
|
4046
|
-
name: RULE_NAME$
|
|
4117
|
+
name: RULE_NAME$35,
|
|
4047
4118
|
meta: {
|
|
4048
4119
|
type: "suggestion",
|
|
4049
4120
|
docs: {
|
|
@@ -4089,9 +4160,9 @@ var prefer_comparison_matcher_default = createEslintRule({
|
|
|
4089
4160
|
|
|
4090
4161
|
//#endregion
|
|
4091
4162
|
//#region src/rules/prefer-describe-function-title.ts
|
|
4092
|
-
const RULE_NAME$
|
|
4163
|
+
const RULE_NAME$34 = "prefer-describe-function-title";
|
|
4093
4164
|
var prefer_describe_function_title_default = createEslintRule({
|
|
4094
|
-
name: RULE_NAME$
|
|
4165
|
+
name: RULE_NAME$34,
|
|
4095
4166
|
meta: {
|
|
4096
4167
|
type: "problem",
|
|
4097
4168
|
docs: {
|
|
@@ -4141,9 +4212,9 @@ var prefer_describe_function_title_default = createEslintRule({
|
|
|
4141
4212
|
|
|
4142
4213
|
//#endregion
|
|
4143
4214
|
//#region src/rules/prefer-each.ts
|
|
4144
|
-
const RULE_NAME$
|
|
4215
|
+
const RULE_NAME$33 = "prefer-each";
|
|
4145
4216
|
var prefer_each_default = createEslintRule({
|
|
4146
|
-
name: RULE_NAME$
|
|
4217
|
+
name: RULE_NAME$33,
|
|
4147
4218
|
meta: {
|
|
4148
4219
|
type: "suggestion",
|
|
4149
4220
|
docs: {
|
|
@@ -4196,13 +4267,13 @@ var prefer_each_default = createEslintRule({
|
|
|
4196
4267
|
|
|
4197
4268
|
//#endregion
|
|
4198
4269
|
//#region src/rules/prefer-equality-matcher.ts
|
|
4199
|
-
const RULE_NAME$
|
|
4270
|
+
const RULE_NAME$32 = "prefer-equality-matcher";
|
|
4200
4271
|
var prefer_equality_matcher_default = createEslintRule({
|
|
4201
|
-
name: RULE_NAME$
|
|
4272
|
+
name: RULE_NAME$32,
|
|
4202
4273
|
meta: {
|
|
4203
4274
|
type: "suggestion",
|
|
4204
4275
|
docs: {
|
|
4205
|
-
description: "enforce using the built-in
|
|
4276
|
+
description: "enforce using the built-in equality matchers",
|
|
4206
4277
|
recommended: false
|
|
4207
4278
|
},
|
|
4208
4279
|
messages: {
|
|
@@ -4416,9 +4487,9 @@ var prefer_expect_assertions_default = createEslintRule({
|
|
|
4416
4487
|
|
|
4417
4488
|
//#endregion
|
|
4418
4489
|
//#region src/rules/prefer-expect-resolves.ts
|
|
4419
|
-
const RULE_NAME$
|
|
4490
|
+
const RULE_NAME$31 = "prefer-expect-resolves";
|
|
4420
4491
|
var prefer_expect_resolves_default = createEslintRule({
|
|
4421
|
-
name: RULE_NAME$
|
|
4492
|
+
name: RULE_NAME$31,
|
|
4422
4493
|
meta: {
|
|
4423
4494
|
type: "suggestion",
|
|
4424
4495
|
docs: {
|
|
@@ -4452,7 +4523,7 @@ var prefer_expect_resolves_default = createEslintRule({
|
|
|
4452
4523
|
|
|
4453
4524
|
//#endregion
|
|
4454
4525
|
//#region src/rules/prefer-expect-type-of.ts
|
|
4455
|
-
const RULE_NAME$
|
|
4526
|
+
const RULE_NAME$30 = "prefer-expect-type-of";
|
|
4456
4527
|
const typeMatchers = {
|
|
4457
4528
|
string: "toBeString",
|
|
4458
4529
|
number: "toBeNumber",
|
|
@@ -4464,7 +4535,7 @@ const typeMatchers = {
|
|
|
4464
4535
|
undefined: "toBeUndefined"
|
|
4465
4536
|
};
|
|
4466
4537
|
var prefer_expect_type_of_default = createEslintRule({
|
|
4467
|
-
name: RULE_NAME$
|
|
4538
|
+
name: RULE_NAME$30,
|
|
4468
4539
|
meta: {
|
|
4469
4540
|
type: "suggestion",
|
|
4470
4541
|
docs: {
|
|
@@ -4513,7 +4584,7 @@ var prefer_expect_type_of_default = createEslintRule({
|
|
|
4513
4584
|
|
|
4514
4585
|
//#endregion
|
|
4515
4586
|
//#region src/rules/prefer-hooks-in-order.ts
|
|
4516
|
-
const RULE_NAME$
|
|
4587
|
+
const RULE_NAME$29 = "prefer-hooks-in-order";
|
|
4517
4588
|
const HooksOrder = [
|
|
4518
4589
|
"beforeAll",
|
|
4519
4590
|
"beforeEach",
|
|
@@ -4521,7 +4592,7 @@ const HooksOrder = [
|
|
|
4521
4592
|
"afterAll"
|
|
4522
4593
|
];
|
|
4523
4594
|
var prefer_hooks_in_order_default = createEslintRule({
|
|
4524
|
-
name: RULE_NAME$
|
|
4595
|
+
name: RULE_NAME$29,
|
|
4525
4596
|
meta: {
|
|
4526
4597
|
type: "suggestion",
|
|
4527
4598
|
docs: {
|
|
@@ -4574,9 +4645,9 @@ var prefer_hooks_in_order_default = createEslintRule({
|
|
|
4574
4645
|
|
|
4575
4646
|
//#endregion
|
|
4576
4647
|
//#region src/rules/prefer-hooks-on-top.ts
|
|
4577
|
-
const RULE_NAME$
|
|
4648
|
+
const RULE_NAME$28 = "prefer-hooks-on-top";
|
|
4578
4649
|
var prefer_hooks_on_top_default = createEslintRule({
|
|
4579
|
-
name: RULE_NAME$
|
|
4650
|
+
name: RULE_NAME$28,
|
|
4580
4651
|
meta: {
|
|
4581
4652
|
type: "suggestion",
|
|
4582
4653
|
docs: {
|
|
@@ -4607,9 +4678,9 @@ var prefer_hooks_on_top_default = createEslintRule({
|
|
|
4607
4678
|
|
|
4608
4679
|
//#endregion
|
|
4609
4680
|
//#region src/rules/prefer-import-in-mock.ts
|
|
4610
|
-
const RULE_NAME$
|
|
4681
|
+
const RULE_NAME$27 = "prefer-import-in-mock";
|
|
4611
4682
|
var prefer_import_in_mock_default = createEslintRule({
|
|
4612
|
-
name: RULE_NAME$
|
|
4683
|
+
name: RULE_NAME$27,
|
|
4613
4684
|
meta: {
|
|
4614
4685
|
fixable: "code",
|
|
4615
4686
|
type: "suggestion",
|
|
@@ -4639,9 +4710,9 @@ var prefer_import_in_mock_default = createEslintRule({
|
|
|
4639
4710
|
|
|
4640
4711
|
//#endregion
|
|
4641
4712
|
//#region src/rules/prefer-importing-vitest-globals.ts
|
|
4642
|
-
const RULE_NAME$
|
|
4713
|
+
const RULE_NAME$26 = "prefer-importing-vitest-globals";
|
|
4643
4714
|
var prefer_importing_vitest_globals_default = createEslintRule({
|
|
4644
|
-
name: RULE_NAME$
|
|
4715
|
+
name: RULE_NAME$26,
|
|
4645
4716
|
meta: {
|
|
4646
4717
|
type: "suggestion",
|
|
4647
4718
|
docs: {
|
|
@@ -4714,7 +4785,7 @@ var prefer_importing_vitest_globals_default = createEslintRule({
|
|
|
4714
4785
|
|
|
4715
4786
|
//#endregion
|
|
4716
4787
|
//#region src/rules/prefer-lowercase-title.ts
|
|
4717
|
-
const RULE_NAME$
|
|
4788
|
+
const RULE_NAME$25 = "prefer-lowercase-title";
|
|
4718
4789
|
const hasStringAsFirstArgument = (node) => node.arguments[0] && isStringNode(node.arguments[0]);
|
|
4719
4790
|
const populateIgnores = (ignore) => {
|
|
4720
4791
|
const ignores = [];
|
|
@@ -4724,7 +4795,7 @@ const populateIgnores = (ignore) => {
|
|
|
4724
4795
|
return ignores;
|
|
4725
4796
|
};
|
|
4726
4797
|
var prefer_lowercase_title_default = createEslintRule({
|
|
4727
|
-
name: RULE_NAME$
|
|
4798
|
+
name: RULE_NAME$25,
|
|
4728
4799
|
meta: {
|
|
4729
4800
|
type: "problem",
|
|
4730
4801
|
docs: {
|
|
@@ -4811,7 +4882,7 @@ var prefer_lowercase_title_default = createEslintRule({
|
|
|
4811
4882
|
|
|
4812
4883
|
//#endregion
|
|
4813
4884
|
//#region src/rules/prefer-mock-promise-shorthand.ts
|
|
4814
|
-
const RULE_NAME$
|
|
4885
|
+
const RULE_NAME$24 = "prefer-mock-promise-shorthand";
|
|
4815
4886
|
const withOnce = (name, addOnce) => {
|
|
4816
4887
|
return `${name}${addOnce ? "Once" : ""}`;
|
|
4817
4888
|
};
|
|
@@ -4821,7 +4892,7 @@ const findSingleReturnArgumentNode = (fnNode) => {
|
|
|
4821
4892
|
return null;
|
|
4822
4893
|
};
|
|
4823
4894
|
var prefer_mock_promise_shorthand_default = createEslintRule({
|
|
4824
|
-
name: RULE_NAME$
|
|
4895
|
+
name: RULE_NAME$24,
|
|
4825
4896
|
meta: {
|
|
4826
4897
|
type: "suggestion",
|
|
4827
4898
|
docs: {
|
|
@@ -4866,7 +4937,7 @@ var prefer_mock_promise_shorthand_default = createEslintRule({
|
|
|
4866
4937
|
|
|
4867
4938
|
//#endregion
|
|
4868
4939
|
//#region src/rules/prefer-snapshot-hint.ts
|
|
4869
|
-
const RULE_NAME$
|
|
4940
|
+
const RULE_NAME$23 = "prefer-snapshot-hint";
|
|
4870
4941
|
const snapshotMatcherNames = ["toMatchSnapshot", "toThrowErrorMatchingSnapshot"];
|
|
4871
4942
|
const isSnapshotMatcherWithoutHint = (expectFnCall) => {
|
|
4872
4943
|
if (expectFnCall.args.length === 0) return true;
|
|
@@ -4876,7 +4947,7 @@ const isSnapshotMatcherWithoutHint = (expectFnCall) => {
|
|
|
4876
4947
|
return !isStringNode(arg);
|
|
4877
4948
|
};
|
|
4878
4949
|
var prefer_snapshot_hint_default = createEslintRule({
|
|
4879
|
-
name: RULE_NAME$
|
|
4950
|
+
name: RULE_NAME$23,
|
|
4880
4951
|
meta: {
|
|
4881
4952
|
type: "suggestion",
|
|
4882
4953
|
docs: {
|
|
@@ -4945,7 +5016,7 @@ var prefer_snapshot_hint_default = createEslintRule({
|
|
|
4945
5016
|
|
|
4946
5017
|
//#endregion
|
|
4947
5018
|
//#region src/rules/prefer-spy-on.ts
|
|
4948
|
-
const RULE_NAME$
|
|
5019
|
+
const RULE_NAME$22 = "prefer-spy-on";
|
|
4949
5020
|
const findNodeObject = (node) => {
|
|
4950
5021
|
if ("object" in node) return node.object;
|
|
4951
5022
|
if (node.callee.type === AST_NODE_TYPES.MemberExpression) return node.callee.object;
|
|
@@ -4965,7 +5036,7 @@ const getAutoFixMockImplementation = (vitestFnCall, context) => {
|
|
|
4965
5036
|
return argSource ? `.mockImplementation(${argSource})` : ".mockImplementation()";
|
|
4966
5037
|
};
|
|
4967
5038
|
var prefer_spy_on_default = createEslintRule({
|
|
4968
|
-
name: RULE_NAME$
|
|
5039
|
+
name: RULE_NAME$22,
|
|
4969
5040
|
meta: {
|
|
4970
5041
|
type: "suggestion",
|
|
4971
5042
|
docs: {
|
|
@@ -5002,9 +5073,9 @@ var prefer_spy_on_default = createEslintRule({
|
|
|
5002
5073
|
|
|
5003
5074
|
//#endregion
|
|
5004
5075
|
//#region src/rules/prefer-strict-boolean-matchers.ts
|
|
5005
|
-
const RULE_NAME$
|
|
5076
|
+
const RULE_NAME$21 = "prefer-strict-boolean-matchers";
|
|
5006
5077
|
var prefer_strict_boolean_matchers_default = createEslintRule({
|
|
5007
|
-
name: RULE_NAME$
|
|
5078
|
+
name: RULE_NAME$21,
|
|
5008
5079
|
meta: {
|
|
5009
5080
|
type: "suggestion",
|
|
5010
5081
|
docs: {
|
|
@@ -5040,9 +5111,9 @@ var prefer_strict_boolean_matchers_default = createEslintRule({
|
|
|
5040
5111
|
|
|
5041
5112
|
//#endregion
|
|
5042
5113
|
//#region src/rules/prefer-strict-equal.ts
|
|
5043
|
-
const RULE_NAME$
|
|
5114
|
+
const RULE_NAME$20 = "prefer-strict-equal";
|
|
5044
5115
|
var prefer_strict_equal_default = createEslintRule({
|
|
5045
|
-
name: RULE_NAME$
|
|
5116
|
+
name: RULE_NAME$20,
|
|
5046
5117
|
meta: {
|
|
5047
5118
|
type: "suggestion",
|
|
5048
5119
|
docs: {
|
|
@@ -5076,10 +5147,10 @@ var prefer_strict_equal_default = createEslintRule({
|
|
|
5076
5147
|
|
|
5077
5148
|
//#endregion
|
|
5078
5149
|
//#region src/rules/prefer-to-be-falsy.ts
|
|
5079
|
-
const RULE_NAME$
|
|
5150
|
+
const RULE_NAME$19 = "prefer-to-be-falsy";
|
|
5080
5151
|
const isFalseLiteral = (node) => node.type === AST_NODE_TYPES.Literal && node.value === false;
|
|
5081
5152
|
var prefer_to_be_falsy_default = createEslintRule({
|
|
5082
|
-
name: RULE_NAME$
|
|
5153
|
+
name: RULE_NAME$19,
|
|
5083
5154
|
meta: {
|
|
5084
5155
|
type: "suggestion",
|
|
5085
5156
|
docs: {
|
|
@@ -5106,9 +5177,9 @@ var prefer_to_be_falsy_default = createEslintRule({
|
|
|
5106
5177
|
|
|
5107
5178
|
//#endregion
|
|
5108
5179
|
//#region src/rules/prefer-to-be-object.ts
|
|
5109
|
-
const RULE_NAME$
|
|
5180
|
+
const RULE_NAME$18 = "prefer-to-be-object";
|
|
5110
5181
|
var prefer_to_be_object_default = createEslintRule({
|
|
5111
|
-
name: RULE_NAME$
|
|
5182
|
+
name: RULE_NAME$18,
|
|
5112
5183
|
meta: {
|
|
5113
5184
|
type: "suggestion",
|
|
5114
5185
|
docs: {
|
|
@@ -5160,10 +5231,10 @@ var prefer_to_be_object_default = createEslintRule({
|
|
|
5160
5231
|
|
|
5161
5232
|
//#endregion
|
|
5162
5233
|
//#region src/rules/prefer-to-be-truthy.ts
|
|
5163
|
-
const RULE_NAME$
|
|
5234
|
+
const RULE_NAME$17 = "prefer-to-be-truthy";
|
|
5164
5235
|
const isTrueLiteral = (node) => node.type === AST_NODE_TYPES.Literal && node.value === true;
|
|
5165
5236
|
var prefer_to_be_truthy_default = createEslintRule({
|
|
5166
|
-
name: RULE_NAME$
|
|
5237
|
+
name: RULE_NAME$17,
|
|
5167
5238
|
meta: {
|
|
5168
5239
|
type: "suggestion",
|
|
5169
5240
|
docs: {
|
|
@@ -5190,7 +5261,7 @@ var prefer_to_be_truthy_default = createEslintRule({
|
|
|
5190
5261
|
|
|
5191
5262
|
//#endregion
|
|
5192
5263
|
//#region src/rules/prefer-to-be.ts
|
|
5193
|
-
const RULE_NAME$
|
|
5264
|
+
const RULE_NAME$16 = "prefer-to-be";
|
|
5194
5265
|
const isNullLiteral = (node) => node.type === AST_NODE_TYPES.Literal && node.value === null;
|
|
5195
5266
|
const isNullEqualityMatcher = (expectFnCall) => isNullLiteral(getFirstMatcherArg(expectFnCall));
|
|
5196
5267
|
const isFirstArgumentIdentifier = (expectFnCall, name) => isIdentifier(getFirstMatcherArg(expectFnCall), name);
|
|
@@ -5215,7 +5286,7 @@ const reportPreferToBe = (context, whatToBe, expectFnCall, func, modifierNode) =
|
|
|
5215
5286
|
});
|
|
5216
5287
|
};
|
|
5217
5288
|
var prefer_to_be_default = createEslintRule({
|
|
5218
|
-
name: RULE_NAME$
|
|
5289
|
+
name: RULE_NAME$16,
|
|
5219
5290
|
meta: {
|
|
5220
5291
|
type: "suggestion",
|
|
5221
5292
|
docs: {
|
|
@@ -5263,10 +5334,10 @@ var prefer_to_be_default = createEslintRule({
|
|
|
5263
5334
|
|
|
5264
5335
|
//#endregion
|
|
5265
5336
|
//#region src/rules/prefer-to-contain.ts
|
|
5266
|
-
const RULE_NAME$
|
|
5337
|
+
const RULE_NAME$15 = "prefer-to-contain";
|
|
5267
5338
|
const isFixableIncludesCallExpression = (node) => node.type === AST_NODE_TYPES.CallExpression && node.callee.type === AST_NODE_TYPES.MemberExpression && isSupportedAccessor(node.callee.property, "includes") && hasOnlyOneArgument(node) && node.arguments[0].type !== AST_NODE_TYPES.SpreadElement;
|
|
5268
5339
|
var prefer_to_contain_default = createEslintRule({
|
|
5269
|
-
name: RULE_NAME$
|
|
5340
|
+
name: RULE_NAME$15,
|
|
5270
5341
|
meta: {
|
|
5271
5342
|
docs: {
|
|
5272
5343
|
description: "enforce using toContain()",
|
|
@@ -5308,9 +5379,9 @@ var prefer_to_contain_default = createEslintRule({
|
|
|
5308
5379
|
|
|
5309
5380
|
//#endregion
|
|
5310
5381
|
//#region src/rules/prefer-to-have-length.ts
|
|
5311
|
-
const RULE_NAME$
|
|
5382
|
+
const RULE_NAME$14 = "prefer-to-have-length";
|
|
5312
5383
|
var prefer_to_have_length_default = createEslintRule({
|
|
5313
|
-
name: RULE_NAME$
|
|
5384
|
+
name: RULE_NAME$14,
|
|
5314
5385
|
meta: {
|
|
5315
5386
|
type: "suggestion",
|
|
5316
5387
|
docs: {
|
|
@@ -5344,7 +5415,7 @@ var prefer_to_have_length_default = createEslintRule({
|
|
|
5344
5415
|
|
|
5345
5416
|
//#endregion
|
|
5346
5417
|
//#region src/rules/prefer-todo.ts
|
|
5347
|
-
const RULE_NAME$
|
|
5418
|
+
const RULE_NAME$13 = "prefer-todo";
|
|
5348
5419
|
const isTargetedTestCase = (vitestFnCall) => {
|
|
5349
5420
|
if (vitestFnCall.members.some((s) => getAccessorValue(s) !== "skip")) return false;
|
|
5350
5421
|
if (vitestFnCall.name.startsWith("x")) return false;
|
|
@@ -5359,7 +5430,7 @@ function createTodoFixer(vitestFnCall, fixer) {
|
|
|
5359
5430
|
return fixer.replaceText(vitestFnCall.head.node, `${vitestFnCall.head.local}.todo`);
|
|
5360
5431
|
}
|
|
5361
5432
|
var prefer_todo_default = createEslintRule({
|
|
5362
|
-
name: RULE_NAME$
|
|
5433
|
+
name: RULE_NAME$13,
|
|
5363
5434
|
meta: {
|
|
5364
5435
|
type: "layout",
|
|
5365
5436
|
docs: {
|
|
@@ -5395,7 +5466,7 @@ var prefer_todo_default = createEslintRule({
|
|
|
5395
5466
|
|
|
5396
5467
|
//#endregion
|
|
5397
5468
|
//#region src/rules/prefer-vi-mocked.ts
|
|
5398
|
-
const RULE_NAME$
|
|
5469
|
+
const RULE_NAME$12 = "prefer-vi-mocked";
|
|
5399
5470
|
const mockTypes = [
|
|
5400
5471
|
"Mock",
|
|
5401
5472
|
"MockedFunction",
|
|
@@ -5403,7 +5474,7 @@ const mockTypes = [
|
|
|
5403
5474
|
"MockedObject"
|
|
5404
5475
|
];
|
|
5405
5476
|
var prefer_vi_mocked_default = createEslintRule({
|
|
5406
|
-
name: RULE_NAME$
|
|
5477
|
+
name: RULE_NAME$12,
|
|
5407
5478
|
meta: {
|
|
5408
5479
|
type: "suggestion",
|
|
5409
5480
|
docs: {
|
|
@@ -5446,9 +5517,9 @@ var prefer_vi_mocked_default = createEslintRule({
|
|
|
5446
5517
|
|
|
5447
5518
|
//#endregion
|
|
5448
5519
|
//#region src/rules/require-awaited-expect-poll.ts
|
|
5449
|
-
const RULE_NAME$
|
|
5520
|
+
const RULE_NAME$11 = "require-awaited-expect-poll";
|
|
5450
5521
|
var require_awaited_expect_poll_default = createEslintRule({
|
|
5451
|
-
name: RULE_NAME$
|
|
5522
|
+
name: RULE_NAME$11,
|
|
5452
5523
|
meta: {
|
|
5453
5524
|
docs: {
|
|
5454
5525
|
requiresTypeChecking: false,
|
|
@@ -5495,7 +5566,7 @@ function skipSequenceExpressions(node) {
|
|
|
5495
5566
|
|
|
5496
5567
|
//#endregion
|
|
5497
5568
|
//#region src/rules/require-hook.ts
|
|
5498
|
-
const RULE_NAME$
|
|
5569
|
+
const RULE_NAME$10 = "require-hook";
|
|
5499
5570
|
const isVitestFnCall = (node, context) => {
|
|
5500
5571
|
if (parseVitestFnCall(node, context)) return true;
|
|
5501
5572
|
return !!getNodeName(node)?.startsWith("vi");
|
|
@@ -5514,7 +5585,7 @@ const shouldBeInHook = (node, context, allowedFunctionCalls = []) => {
|
|
|
5514
5585
|
}
|
|
5515
5586
|
};
|
|
5516
5587
|
var require_hook_default = createEslintRule({
|
|
5517
|
-
name: RULE_NAME$
|
|
5588
|
+
name: RULE_NAME$10,
|
|
5518
5589
|
meta: {
|
|
5519
5590
|
docs: {
|
|
5520
5591
|
description: "require setup and teardown to be within a hook",
|
|
@@ -5553,6 +5624,42 @@ var require_hook_default = createEslintRule({
|
|
|
5553
5624
|
}
|
|
5554
5625
|
});
|
|
5555
5626
|
|
|
5627
|
+
//#endregion
|
|
5628
|
+
//#region src/rules/require-import-vi-mock.ts
|
|
5629
|
+
const RULE_NAME$9 = "require-import-vi-mock";
|
|
5630
|
+
var require_import_vi_mock_default = createEslintRule({
|
|
5631
|
+
name: RULE_NAME$9,
|
|
5632
|
+
meta: {
|
|
5633
|
+
fixable: "code",
|
|
5634
|
+
type: "suggestion",
|
|
5635
|
+
docs: {
|
|
5636
|
+
description: "require usage of import in vi.mock()",
|
|
5637
|
+
requiresTypeChecking: false,
|
|
5638
|
+
recommended: false
|
|
5639
|
+
},
|
|
5640
|
+
messages: { requireImport: "Replace '{{path}}' with import('{{path}}')" },
|
|
5641
|
+
schema: []
|
|
5642
|
+
},
|
|
5643
|
+
defaultOptions: [],
|
|
5644
|
+
create(context) {
|
|
5645
|
+
return { CallExpression(node) {
|
|
5646
|
+
if (node.callee.type !== AST_NODE_TYPES.MemberExpression) return;
|
|
5647
|
+
if (parseVitestFnCall(node, context)?.type !== "vi") return false;
|
|
5648
|
+
const { property } = node.callee;
|
|
5649
|
+
if (property.type !== AST_NODE_TYPES.Identifier || property.name !== "mock") return;
|
|
5650
|
+
const pathArg = node.arguments[0];
|
|
5651
|
+
if (pathArg && pathArg.type === AST_NODE_TYPES.Literal) context.report({
|
|
5652
|
+
messageId: "requireImport",
|
|
5653
|
+
data: { path: pathArg.value },
|
|
5654
|
+
node: pathArg,
|
|
5655
|
+
fix(fixer) {
|
|
5656
|
+
return fixer.replaceText(pathArg, `import('${pathArg.value}')`);
|
|
5657
|
+
}
|
|
5658
|
+
});
|
|
5659
|
+
} };
|
|
5660
|
+
}
|
|
5661
|
+
});
|
|
5662
|
+
|
|
5556
5663
|
//#endregion
|
|
5557
5664
|
//#region src/rules/require-local-test-context-for-concurrent-snapshots.ts
|
|
5558
5665
|
const RULE_NAME$8 = "require-local-test-context-for-concurrent-snapshots";
|
|
@@ -6469,6 +6576,7 @@ var warn_todo_default = createEslintRule({
|
|
|
6469
6576
|
//#endregion
|
|
6470
6577
|
//#region src/rules/index.ts
|
|
6471
6578
|
const rules = {
|
|
6579
|
+
"consistent-each-for": consistent_each_for_default,
|
|
6472
6580
|
"consistent-test-filename": consistent_test_filename_default,
|
|
6473
6581
|
"consistent-test-it": consistent_test_it_default,
|
|
6474
6582
|
"consistent-vitest-vi": consistent_vitest_vi_default,
|
|
@@ -6536,6 +6644,7 @@ const rules = {
|
|
|
6536
6644
|
"prefer-vi-mocked": prefer_vi_mocked_default,
|
|
6537
6645
|
"require-awaited-expect-poll": require_awaited_expect_poll_default,
|
|
6538
6646
|
"require-hook": require_hook_default,
|
|
6647
|
+
"require-import-vi-mock": require_import_vi_mock_default,
|
|
6539
6648
|
"require-local-test-context-for-concurrent-snapshots": require_local_test_context_for_concurrent_snapshots_default,
|
|
6540
6649
|
"require-mock-type-parameters": require_mock_type_parameters_default,
|
|
6541
6650
|
"require-to-throw-message": require_to_throw_message_default,
|
|
@@ -6567,6 +6676,7 @@ const createConfigLegacy = (rules$1) => ({
|
|
|
6567
6676
|
const allRules = {
|
|
6568
6677
|
"consistent-test-filename": "warn",
|
|
6569
6678
|
"consistent-test-it": "warn",
|
|
6679
|
+
"consistent-each-for": "warn",
|
|
6570
6680
|
"consistent-vitest-vi": "warn",
|
|
6571
6681
|
"expect-expect": "warn",
|
|
6572
6682
|
"hoisted-apis-on-top": "warn",
|
|
@@ -6638,7 +6748,8 @@ const allRules = {
|
|
|
6638
6748
|
"valid-expect-in-promise": "warn",
|
|
6639
6749
|
"valid-expect": "warn",
|
|
6640
6750
|
"valid-title": "warn",
|
|
6641
|
-
"require-awaited-expect-poll": "warn"
|
|
6751
|
+
"require-awaited-expect-poll": "warn",
|
|
6752
|
+
"require-import-vi-mock": "warn"
|
|
6642
6753
|
};
|
|
6643
6754
|
const recommendedRules = {
|
|
6644
6755
|
"expect-expect": "error",
|