@vitest/eslint-plugin 1.5.2 → 1.5.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 +1 -0
- package/dist/index.cjs +201 -155
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +201 -155
- 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.5.
|
|
7
|
+
var version = "1.5.4";
|
|
8
8
|
|
|
9
9
|
//#endregion
|
|
10
10
|
//#region src/utils/index.ts
|
|
@@ -1778,7 +1778,7 @@ const followTypeAssertionChain$1 = (expression) => isTypeCastExpression$1(expres
|
|
|
1778
1778
|
|
|
1779
1779
|
//#endregion
|
|
1780
1780
|
//#region src/rules/consistent-each-for.ts
|
|
1781
|
-
const RULE_NAME$
|
|
1781
|
+
const RULE_NAME$77 = "consistent-each-for";
|
|
1782
1782
|
const BASE_FN_NAMES = [
|
|
1783
1783
|
"test",
|
|
1784
1784
|
"it",
|
|
@@ -1786,7 +1786,7 @@ const BASE_FN_NAMES = [
|
|
|
1786
1786
|
"suite"
|
|
1787
1787
|
];
|
|
1788
1788
|
var consistent_each_for_default = createEslintRule({
|
|
1789
|
-
name: RULE_NAME$
|
|
1789
|
+
name: RULE_NAME$77,
|
|
1790
1790
|
meta: {
|
|
1791
1791
|
type: "suggestion",
|
|
1792
1792
|
docs: {
|
|
@@ -1846,11 +1846,11 @@ var consistent_each_for_default = createEslintRule({
|
|
|
1846
1846
|
|
|
1847
1847
|
//#endregion
|
|
1848
1848
|
//#region src/rules/consistent-test-filename.ts
|
|
1849
|
-
const RULE_NAME$
|
|
1849
|
+
const RULE_NAME$76 = "consistent-test-filename";
|
|
1850
1850
|
const defaultPattern = /.*\.test\.[tj]sx?$/;
|
|
1851
1851
|
const defaultTestsPattern = /.*\.(test|spec)\.[tj]sx?$/;
|
|
1852
1852
|
var consistent_test_filename_default = createEslintRule({
|
|
1853
|
-
name: RULE_NAME$
|
|
1853
|
+
name: RULE_NAME$76,
|
|
1854
1854
|
meta: {
|
|
1855
1855
|
type: "problem",
|
|
1856
1856
|
docs: {
|
|
@@ -1898,7 +1898,7 @@ var consistent_test_filename_default = createEslintRule({
|
|
|
1898
1898
|
|
|
1899
1899
|
//#endregion
|
|
1900
1900
|
//#region src/rules/consistent-test-it.ts
|
|
1901
|
-
const RULE_NAME$
|
|
1901
|
+
const RULE_NAME$75 = "consistent-test-it";
|
|
1902
1902
|
const buildFixer = (callee, nodeName, preferredTestKeyword) => (fixer) => [fixer.replaceText(callee.type === AST_NODE_TYPES.MemberExpression ? callee.object : callee, getPreferredNodeName(nodeName, preferredTestKeyword))];
|
|
1903
1903
|
function getPreferredNodeName(nodeName, preferredTestKeyword) {
|
|
1904
1904
|
if (nodeName === TestCaseName.fit) return "test.only";
|
|
@@ -1909,7 +1909,7 @@ function getOppositeTestKeyword(test) {
|
|
|
1909
1909
|
return TestCaseName.test;
|
|
1910
1910
|
}
|
|
1911
1911
|
var consistent_test_it_default = createEslintRule({
|
|
1912
|
-
name: RULE_NAME$
|
|
1912
|
+
name: RULE_NAME$75,
|
|
1913
1913
|
meta: {
|
|
1914
1914
|
type: "suggestion",
|
|
1915
1915
|
fixable: "code",
|
|
@@ -2018,10 +2018,10 @@ var consistent_test_it_default = createEslintRule({
|
|
|
2018
2018
|
|
|
2019
2019
|
//#endregion
|
|
2020
2020
|
//#region src/rules/consistent-vitest-vi.ts
|
|
2021
|
-
const RULE_NAME$
|
|
2021
|
+
const RULE_NAME$74 = "consistent-vitest-vi";
|
|
2022
2022
|
const getOppositeVitestUtilKeyword = (util) => util === UtilName.vi ? UtilName.vitest : UtilName.vi;
|
|
2023
2023
|
var consistent_vitest_vi_default = createEslintRule({
|
|
2024
|
-
name: RULE_NAME$
|
|
2024
|
+
name: RULE_NAME$74,
|
|
2025
2025
|
meta: {
|
|
2026
2026
|
type: "suggestion",
|
|
2027
2027
|
fixable: "code",
|
|
@@ -2101,9 +2101,9 @@ function parsePluginSettings(settings) {
|
|
|
2101
2101
|
|
|
2102
2102
|
//#endregion
|
|
2103
2103
|
//#region src/rules/expect-expect.ts
|
|
2104
|
-
const RULE_NAME$
|
|
2104
|
+
const RULE_NAME$73 = "expect-expect";
|
|
2105
2105
|
var expect_expect_default = createEslintRule({
|
|
2106
|
-
name: RULE_NAME$
|
|
2106
|
+
name: RULE_NAME$73,
|
|
2107
2107
|
meta: {
|
|
2108
2108
|
type: "suggestion",
|
|
2109
2109
|
docs: {
|
|
@@ -2179,14 +2179,14 @@ function buildPatternRegexp(pattern) {
|
|
|
2179
2179
|
|
|
2180
2180
|
//#endregion
|
|
2181
2181
|
//#region src/rules/hoisted-apis-on-top.ts
|
|
2182
|
-
const RULE_NAME$
|
|
2182
|
+
const RULE_NAME$72 = "hoisted-apis-on-top";
|
|
2183
2183
|
const hoistedAPIs = [
|
|
2184
2184
|
"mock",
|
|
2185
2185
|
"hoisted",
|
|
2186
2186
|
"unmock"
|
|
2187
2187
|
];
|
|
2188
2188
|
var hoisted_apis_on_top_default = createEslintRule({
|
|
2189
|
-
name: RULE_NAME$
|
|
2189
|
+
name: RULE_NAME$72,
|
|
2190
2190
|
meta: {
|
|
2191
2191
|
hasSuggestions: true,
|
|
2192
2192
|
type: "suggestion",
|
|
@@ -2253,9 +2253,9 @@ var hoisted_apis_on_top_default = createEslintRule({
|
|
|
2253
2253
|
|
|
2254
2254
|
//#endregion
|
|
2255
2255
|
//#region src/rules/max-expects.ts
|
|
2256
|
-
const RULE_NAME$
|
|
2256
|
+
const RULE_NAME$71 = "max-expects";
|
|
2257
2257
|
var max_expects_default = createEslintRule({
|
|
2258
|
-
name: RULE_NAME$
|
|
2258
|
+
name: RULE_NAME$71,
|
|
2259
2259
|
meta: {
|
|
2260
2260
|
docs: {
|
|
2261
2261
|
requiresTypeChecking: false,
|
|
@@ -2300,9 +2300,9 @@ var max_expects_default = createEslintRule({
|
|
|
2300
2300
|
|
|
2301
2301
|
//#endregion
|
|
2302
2302
|
//#region src/rules/max-nested-describe.ts
|
|
2303
|
-
const RULE_NAME$
|
|
2303
|
+
const RULE_NAME$70 = "max-nested-describe";
|
|
2304
2304
|
var max_nested_describe_default = createEslintRule({
|
|
2305
|
-
name: RULE_NAME$
|
|
2305
|
+
name: RULE_NAME$70,
|
|
2306
2306
|
meta: {
|
|
2307
2307
|
type: "problem",
|
|
2308
2308
|
docs: {
|
|
@@ -2344,9 +2344,9 @@ var max_nested_describe_default = createEslintRule({
|
|
|
2344
2344
|
|
|
2345
2345
|
//#endregion
|
|
2346
2346
|
//#region src/rules/no-alias-methods.ts
|
|
2347
|
-
const RULE_NAME$
|
|
2347
|
+
const RULE_NAME$69 = "no-alias-methods";
|
|
2348
2348
|
var no_alias_methods_default = createEslintRule({
|
|
2349
|
-
name: RULE_NAME$
|
|
2349
|
+
name: RULE_NAME$69,
|
|
2350
2350
|
meta: {
|
|
2351
2351
|
docs: {
|
|
2352
2352
|
description: "disallow alias methods",
|
|
@@ -2396,12 +2396,12 @@ var no_alias_methods_default = createEslintRule({
|
|
|
2396
2396
|
|
|
2397
2397
|
//#endregion
|
|
2398
2398
|
//#region src/rules/no-commented-out-tests.ts
|
|
2399
|
-
const RULE_NAME$
|
|
2399
|
+
const RULE_NAME$68 = "no-commented-out-tests";
|
|
2400
2400
|
function hasTests(node) {
|
|
2401
2401
|
return /^\s*[xf]?(test|it|describe)(\.\w+|\[['"]\w+['"]\])?\s*\(/mu.test(node.value);
|
|
2402
2402
|
}
|
|
2403
2403
|
var no_commented_out_tests_default = createEslintRule({
|
|
2404
|
-
name: RULE_NAME$
|
|
2404
|
+
name: RULE_NAME$68,
|
|
2405
2405
|
meta: {
|
|
2406
2406
|
docs: {
|
|
2407
2407
|
description: "disallow commented out tests",
|
|
@@ -2430,10 +2430,10 @@ var no_commented_out_tests_default = createEslintRule({
|
|
|
2430
2430
|
|
|
2431
2431
|
//#endregion
|
|
2432
2432
|
//#region src/rules/no-conditional-expect.ts
|
|
2433
|
-
const RULE_NAME$
|
|
2433
|
+
const RULE_NAME$67 = "no-conditional-expect";
|
|
2434
2434
|
const isCatchCall = (node) => node.callee.type === AST_NODE_TYPES.MemberExpression && isSupportedAccessor(node.callee.property, "catch");
|
|
2435
2435
|
var no_conditional_expect_default = createEslintRule({
|
|
2436
|
-
name: RULE_NAME$
|
|
2436
|
+
name: RULE_NAME$67,
|
|
2437
2437
|
meta: {
|
|
2438
2438
|
type: "problem",
|
|
2439
2439
|
docs: {
|
|
@@ -2488,9 +2488,9 @@ var no_conditional_expect_default = createEslintRule({
|
|
|
2488
2488
|
|
|
2489
2489
|
//#endregion
|
|
2490
2490
|
//#region src/rules/no-conditional-in-test.ts
|
|
2491
|
-
const RULE_NAME$
|
|
2491
|
+
const RULE_NAME$66 = "no-conditional-in-test";
|
|
2492
2492
|
var no_conditional_in_test_default = createEslintRule({
|
|
2493
|
-
name: RULE_NAME$
|
|
2493
|
+
name: RULE_NAME$66,
|
|
2494
2494
|
meta: {
|
|
2495
2495
|
docs: {
|
|
2496
2496
|
description: "disallow conditional tests",
|
|
@@ -2514,9 +2514,9 @@ var no_conditional_in_test_default = createEslintRule({
|
|
|
2514
2514
|
|
|
2515
2515
|
//#endregion
|
|
2516
2516
|
//#region src/rules/no-conditional-tests.ts
|
|
2517
|
-
const RULE_NAME$
|
|
2517
|
+
const RULE_NAME$65 = "no-conditional-tests";
|
|
2518
2518
|
var no_conditional_tests_default = createEslintRule({
|
|
2519
|
-
name: RULE_NAME$
|
|
2519
|
+
name: RULE_NAME$65,
|
|
2520
2520
|
meta: {
|
|
2521
2521
|
type: "problem",
|
|
2522
2522
|
docs: {
|
|
@@ -2545,9 +2545,9 @@ var no_conditional_tests_default = createEslintRule({
|
|
|
2545
2545
|
|
|
2546
2546
|
//#endregion
|
|
2547
2547
|
//#region src/rules/no-disabled-tests.ts
|
|
2548
|
-
const RULE_NAME$
|
|
2548
|
+
const RULE_NAME$64 = "no-disabled-tests";
|
|
2549
2549
|
var no_disabled_tests_default = createEslintRule({
|
|
2550
|
-
name: RULE_NAME$
|
|
2550
|
+
name: RULE_NAME$64,
|
|
2551
2551
|
meta: {
|
|
2552
2552
|
type: "suggestion",
|
|
2553
2553
|
docs: {
|
|
@@ -2613,7 +2613,7 @@ var no_disabled_tests_default = createEslintRule({
|
|
|
2613
2613
|
|
|
2614
2614
|
//#endregion
|
|
2615
2615
|
//#region src/rules/no-done-callback.ts
|
|
2616
|
-
const RULE_NAME$
|
|
2616
|
+
const RULE_NAME$63 = "no-done-callback";
|
|
2617
2617
|
const findCallbackArg = (node, isVitestEach, context) => {
|
|
2618
2618
|
if (isVitestEach) return node.arguments[1];
|
|
2619
2619
|
const vitestFnCall = parseVitestFnCall(node, context);
|
|
@@ -2622,7 +2622,7 @@ const findCallbackArg = (node, isVitestEach, context) => {
|
|
|
2622
2622
|
return null;
|
|
2623
2623
|
};
|
|
2624
2624
|
var no_done_callback_default = createEslintRule({
|
|
2625
|
-
name: RULE_NAME$
|
|
2625
|
+
name: RULE_NAME$63,
|
|
2626
2626
|
meta: {
|
|
2627
2627
|
type: "suggestion",
|
|
2628
2628
|
docs: {
|
|
@@ -2707,9 +2707,9 @@ var no_done_callback_default = createEslintRule({
|
|
|
2707
2707
|
|
|
2708
2708
|
//#endregion
|
|
2709
2709
|
//#region src/rules/no-duplicate-hooks.ts
|
|
2710
|
-
const RULE_NAME$
|
|
2710
|
+
const RULE_NAME$62 = "no-duplicate-hooks";
|
|
2711
2711
|
var no_duplicate_hooks_default = createEslintRule({
|
|
2712
|
-
name: RULE_NAME$
|
|
2712
|
+
name: RULE_NAME$62,
|
|
2713
2713
|
meta: {
|
|
2714
2714
|
docs: {
|
|
2715
2715
|
recommended: false,
|
|
@@ -2746,7 +2746,7 @@ var no_duplicate_hooks_default = createEslintRule({
|
|
|
2746
2746
|
|
|
2747
2747
|
//#endregion
|
|
2748
2748
|
//#region src/rules/no-focused-tests.ts
|
|
2749
|
-
const RULE_NAME$
|
|
2749
|
+
const RULE_NAME$61 = "no-focused-tests";
|
|
2750
2750
|
const isTestOrDescribe = (node) => {
|
|
2751
2751
|
return node.type === "Identifier" && [
|
|
2752
2752
|
"it",
|
|
@@ -2758,7 +2758,7 @@ const isOnly = (node) => {
|
|
|
2758
2758
|
return node.type === "Identifier" && node.name === "only";
|
|
2759
2759
|
};
|
|
2760
2760
|
var no_focused_tests_default = createEslintRule({
|
|
2761
|
-
name: RULE_NAME$
|
|
2761
|
+
name: RULE_NAME$61,
|
|
2762
2762
|
meta: {
|
|
2763
2763
|
type: "problem",
|
|
2764
2764
|
docs: {
|
|
@@ -2818,9 +2818,9 @@ var no_focused_tests_default = createEslintRule({
|
|
|
2818
2818
|
|
|
2819
2819
|
//#endregion
|
|
2820
2820
|
//#region src/rules/no-hooks.ts
|
|
2821
|
-
const RULE_NAME$
|
|
2821
|
+
const RULE_NAME$60 = "no-hooks";
|
|
2822
2822
|
var no_hooks_default = createEslintRule({
|
|
2823
|
-
name: RULE_NAME$
|
|
2823
|
+
name: RULE_NAME$60,
|
|
2824
2824
|
meta: {
|
|
2825
2825
|
type: "suggestion",
|
|
2826
2826
|
docs: {
|
|
@@ -2863,13 +2863,13 @@ var no_hooks_default = createEslintRule({
|
|
|
2863
2863
|
|
|
2864
2864
|
//#endregion
|
|
2865
2865
|
//#region src/rules/no-identical-title.ts
|
|
2866
|
-
const RULE_NAME$
|
|
2866
|
+
const RULE_NAME$59 = "no-identical-title";
|
|
2867
2867
|
const newDescribeContext = () => ({
|
|
2868
2868
|
describeTitles: [],
|
|
2869
2869
|
testTitles: []
|
|
2870
2870
|
});
|
|
2871
2871
|
var no_identical_title_default = createEslintRule({
|
|
2872
|
-
name: RULE_NAME$
|
|
2872
|
+
name: RULE_NAME$59,
|
|
2873
2873
|
meta: {
|
|
2874
2874
|
type: "problem",
|
|
2875
2875
|
docs: {
|
|
@@ -2919,9 +2919,9 @@ var no_identical_title_default = createEslintRule({
|
|
|
2919
2919
|
|
|
2920
2920
|
//#endregion
|
|
2921
2921
|
//#region src/rules/no-import-node-test.ts
|
|
2922
|
-
const RULE_NAME$
|
|
2922
|
+
const RULE_NAME$58 = "no-import-node-test";
|
|
2923
2923
|
var no_import_node_test_default = createEslintRule({
|
|
2924
|
-
name: RULE_NAME$
|
|
2924
|
+
name: RULE_NAME$58,
|
|
2925
2925
|
meta: {
|
|
2926
2926
|
docs: {
|
|
2927
2927
|
description: "disallow importing `node:test`",
|
|
@@ -3018,9 +3018,9 @@ const removeNodeFromArray = (fixer, nodes, target) => {
|
|
|
3018
3018
|
|
|
3019
3019
|
//#endregion
|
|
3020
3020
|
//#region src/rules/no-importing-vitest-globals.ts
|
|
3021
|
-
const RULE_NAME$
|
|
3021
|
+
const RULE_NAME$57 = "no-importing-vitest-globals";
|
|
3022
3022
|
var no_importing_vitest_globals_default = createEslintRule({
|
|
3023
|
-
name: RULE_NAME$
|
|
3023
|
+
name: RULE_NAME$57,
|
|
3024
3024
|
meta: {
|
|
3025
3025
|
type: "suggestion",
|
|
3026
3026
|
docs: {
|
|
@@ -3076,9 +3076,9 @@ var no_importing_vitest_globals_default = createEslintRule({
|
|
|
3076
3076
|
|
|
3077
3077
|
//#endregion
|
|
3078
3078
|
//#region src/rules/no-interpolation-in-snapshots.ts
|
|
3079
|
-
const RULE_NAME$
|
|
3079
|
+
const RULE_NAME$56 = "no-interpolation-in-snapshots";
|
|
3080
3080
|
var no_interpolation_in_snapshots_default = createEslintRule({
|
|
3081
|
-
name: RULE_NAME$
|
|
3081
|
+
name: RULE_NAME$56,
|
|
3082
3082
|
meta: {
|
|
3083
3083
|
type: "problem",
|
|
3084
3084
|
docs: {
|
|
@@ -3106,7 +3106,7 @@ var no_interpolation_in_snapshots_default = createEslintRule({
|
|
|
3106
3106
|
|
|
3107
3107
|
//#endregion
|
|
3108
3108
|
//#region src/rules/no-large-snapshots.ts
|
|
3109
|
-
const RULE_NAME$
|
|
3109
|
+
const RULE_NAME$55 = "no-large-snapshots";
|
|
3110
3110
|
const reportOnViolation = (context, node, { maxSize: lineLimit = 50, allowedSnapshots = {} }) => {
|
|
3111
3111
|
const startLine = node.loc.start.line;
|
|
3112
3112
|
const lineCount = node.loc.end.line - startLine;
|
|
@@ -3132,7 +3132,7 @@ const reportOnViolation = (context, node, { maxSize: lineLimit = 50, allowedSnap
|
|
|
3132
3132
|
});
|
|
3133
3133
|
};
|
|
3134
3134
|
var no_large_snapshots_default = createEslintRule({
|
|
3135
|
-
name: RULE_NAME$
|
|
3135
|
+
name: RULE_NAME$55,
|
|
3136
3136
|
meta: {
|
|
3137
3137
|
docs: {
|
|
3138
3138
|
description: "disallow large snapshots",
|
|
@@ -3177,9 +3177,9 @@ var no_large_snapshots_default = createEslintRule({
|
|
|
3177
3177
|
const mocksDirName = "__mocks__";
|
|
3178
3178
|
const isMockPath = (path) => path.split(posix.sep).includes(mocksDirName);
|
|
3179
3179
|
const isMockImportLiteral = (expression) => isStringNode(expression) && isMockPath(getStringValue(expression));
|
|
3180
|
-
const RULE_NAME$
|
|
3180
|
+
const RULE_NAME$54 = "no-mocks-import";
|
|
3181
3181
|
var no_mocks_import_default = createEslintRule({
|
|
3182
|
-
name: RULE_NAME$
|
|
3182
|
+
name: RULE_NAME$54,
|
|
3183
3183
|
meta: {
|
|
3184
3184
|
type: "problem",
|
|
3185
3185
|
docs: {
|
|
@@ -3211,13 +3211,13 @@ var no_mocks_import_default = createEslintRule({
|
|
|
3211
3211
|
|
|
3212
3212
|
//#endregion
|
|
3213
3213
|
//#region src/rules/no-restricted-matchers.ts
|
|
3214
|
-
const RULE_NAME$
|
|
3214
|
+
const RULE_NAME$53 = "no-restricted-matchers";
|
|
3215
3215
|
const isChainRestricted = (chain, restriction) => {
|
|
3216
3216
|
if (Object.prototype.hasOwnProperty.call(ModifierName, restriction) || restriction.endsWith(".not")) return chain.startsWith(restriction);
|
|
3217
3217
|
return chain === restriction;
|
|
3218
3218
|
};
|
|
3219
3219
|
var no_restricted_matchers_default = createEslintRule({
|
|
3220
|
-
name: RULE_NAME$
|
|
3220
|
+
name: RULE_NAME$53,
|
|
3221
3221
|
meta: {
|
|
3222
3222
|
docs: {
|
|
3223
3223
|
description: "disallow the use of certain matchers",
|
|
@@ -3259,9 +3259,9 @@ var no_restricted_matchers_default = createEslintRule({
|
|
|
3259
3259
|
|
|
3260
3260
|
//#endregion
|
|
3261
3261
|
//#region src/rules/no-restricted-vi-methods.ts
|
|
3262
|
-
const RULE_NAME$
|
|
3262
|
+
const RULE_NAME$52 = "no-restricted-vi-methods";
|
|
3263
3263
|
var no_restricted_vi_methods_default = createEslintRule({
|
|
3264
|
-
name: RULE_NAME$
|
|
3264
|
+
name: RULE_NAME$52,
|
|
3265
3265
|
meta: {
|
|
3266
3266
|
type: "suggestion",
|
|
3267
3267
|
docs: {
|
|
@@ -3303,7 +3303,7 @@ var no_restricted_vi_methods_default = createEslintRule({
|
|
|
3303
3303
|
|
|
3304
3304
|
//#endregion
|
|
3305
3305
|
//#region src/rules/no-standalone-expect.ts
|
|
3306
|
-
const RULE_NAME$
|
|
3306
|
+
const RULE_NAME$51 = "no-standalone-expect";
|
|
3307
3307
|
const getBlockType = (statement, context) => {
|
|
3308
3308
|
const func = statement.parent;
|
|
3309
3309
|
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");
|
|
@@ -3316,7 +3316,7 @@ const getBlockType = (statement, context) => {
|
|
|
3316
3316
|
return null;
|
|
3317
3317
|
};
|
|
3318
3318
|
var no_standalone_expect_default = createEslintRule({
|
|
3319
|
-
name: RULE_NAME$
|
|
3319
|
+
name: RULE_NAME$51,
|
|
3320
3320
|
meta: {
|
|
3321
3321
|
docs: {
|
|
3322
3322
|
description: "disallow using `expect` outside of `it` or `test` blocks",
|
|
@@ -3375,9 +3375,9 @@ var no_standalone_expect_default = createEslintRule({
|
|
|
3375
3375
|
|
|
3376
3376
|
//#endregion
|
|
3377
3377
|
//#region src/rules/no-test-prefixes.ts
|
|
3378
|
-
const RULE_NAME$
|
|
3378
|
+
const RULE_NAME$50 = "no-test-prefixes";
|
|
3379
3379
|
var no_test_prefixes_default = createEslintRule({
|
|
3380
|
-
name: RULE_NAME$
|
|
3380
|
+
name: RULE_NAME$50,
|
|
3381
3381
|
meta: {
|
|
3382
3382
|
docs: {
|
|
3383
3383
|
description: "disallow using the `f` and `x` prefixes in favour of `.only` and `.skip`",
|
|
@@ -3412,14 +3412,14 @@ var no_test_prefixes_default = createEslintRule({
|
|
|
3412
3412
|
|
|
3413
3413
|
//#endregion
|
|
3414
3414
|
//#region src/rules/no-test-return-statement.ts
|
|
3415
|
-
const RULE_NAME$
|
|
3415
|
+
const RULE_NAME$49 = "no-test-return-statement";
|
|
3416
3416
|
const getBody = (args) => {
|
|
3417
3417
|
const [, secondArg] = args;
|
|
3418
3418
|
if (secondArg && isFunction(secondArg) && secondArg.body.type === AST_NODE_TYPES.BlockStatement) return secondArg.body.body;
|
|
3419
3419
|
return [];
|
|
3420
3420
|
};
|
|
3421
3421
|
var no_test_return_statement_default = createEslintRule({
|
|
3422
|
-
name: RULE_NAME$
|
|
3422
|
+
name: RULE_NAME$49,
|
|
3423
3423
|
meta: {
|
|
3424
3424
|
type: "problem",
|
|
3425
3425
|
docs: {
|
|
@@ -3690,7 +3690,7 @@ const createPaddingRule = (name, description, configs, deprecated = false) => {
|
|
|
3690
3690
|
|
|
3691
3691
|
//#endregion
|
|
3692
3692
|
//#region src/rules/padding-around-after-all-blocks.ts
|
|
3693
|
-
const RULE_NAME$
|
|
3693
|
+
const RULE_NAME$48 = "padding-around-after-all-blocks";
|
|
3694
3694
|
const config = [{
|
|
3695
3695
|
paddingType: PaddingType.Always,
|
|
3696
3696
|
prevStatementType: StatementType.Any,
|
|
@@ -3700,11 +3700,11 @@ const config = [{
|
|
|
3700
3700
|
prevStatementType: StatementType.AfterAllToken,
|
|
3701
3701
|
nextStatementType: StatementType.Any
|
|
3702
3702
|
}];
|
|
3703
|
-
var padding_around_after_all_blocks_default = createPaddingRule(RULE_NAME$
|
|
3703
|
+
var padding_around_after_all_blocks_default = createPaddingRule(RULE_NAME$48, "Enforce padding around `afterAll` blocks", config);
|
|
3704
3704
|
|
|
3705
3705
|
//#endregion
|
|
3706
3706
|
//#region src/rules/padding-around-after-each-blocks.ts
|
|
3707
|
-
const RULE_NAME$
|
|
3707
|
+
const RULE_NAME$47 = "padding-around-after-each-blocks";
|
|
3708
3708
|
const config$1 = [{
|
|
3709
3709
|
paddingType: PaddingType.Always,
|
|
3710
3710
|
prevStatementType: StatementType.Any,
|
|
@@ -3714,11 +3714,11 @@ const config$1 = [{
|
|
|
3714
3714
|
prevStatementType: StatementType.AfterEachToken,
|
|
3715
3715
|
nextStatementType: StatementType.Any
|
|
3716
3716
|
}];
|
|
3717
|
-
var padding_around_after_each_blocks_default = createPaddingRule(RULE_NAME$
|
|
3717
|
+
var padding_around_after_each_blocks_default = createPaddingRule(RULE_NAME$47, "Enforce padding around `afterEach` blocks", config$1);
|
|
3718
3718
|
|
|
3719
3719
|
//#endregion
|
|
3720
3720
|
//#region src/rules/padding-around-before-all-blocks.ts
|
|
3721
|
-
const RULE_NAME$
|
|
3721
|
+
const RULE_NAME$46 = "padding-around-before-all-blocks";
|
|
3722
3722
|
const config$2 = [{
|
|
3723
3723
|
paddingType: PaddingType.Always,
|
|
3724
3724
|
prevStatementType: StatementType.Any,
|
|
@@ -3728,11 +3728,11 @@ const config$2 = [{
|
|
|
3728
3728
|
prevStatementType: StatementType.BeforeAllToken,
|
|
3729
3729
|
nextStatementType: StatementType.Any
|
|
3730
3730
|
}];
|
|
3731
|
-
var padding_around_before_all_blocks_default = createPaddingRule(RULE_NAME$
|
|
3731
|
+
var padding_around_before_all_blocks_default = createPaddingRule(RULE_NAME$46, "Enforce padding around `beforeAll` blocks", config$2);
|
|
3732
3732
|
|
|
3733
3733
|
//#endregion
|
|
3734
3734
|
//#region src/rules/padding-around-before-each-blocks.ts
|
|
3735
|
-
const RULE_NAME$
|
|
3735
|
+
const RULE_NAME$45 = "padding-around-before-each-blocks";
|
|
3736
3736
|
const config$3 = [{
|
|
3737
3737
|
paddingType: PaddingType.Always,
|
|
3738
3738
|
prevStatementType: StatementType.Any,
|
|
@@ -3742,11 +3742,11 @@ const config$3 = [{
|
|
|
3742
3742
|
prevStatementType: StatementType.BeforeEachToken,
|
|
3743
3743
|
nextStatementType: StatementType.Any
|
|
3744
3744
|
}];
|
|
3745
|
-
var padding_around_before_each_blocks_default = createPaddingRule(RULE_NAME$
|
|
3745
|
+
var padding_around_before_each_blocks_default = createPaddingRule(RULE_NAME$45, "Enforce padding around `beforeEach` blocks", config$3);
|
|
3746
3746
|
|
|
3747
3747
|
//#endregion
|
|
3748
3748
|
//#region src/rules/padding-around-describe-blocks.ts
|
|
3749
|
-
const RULE_NAME$
|
|
3749
|
+
const RULE_NAME$44 = "padding-around-describe-blocks";
|
|
3750
3750
|
const config$4 = [{
|
|
3751
3751
|
paddingType: PaddingType.Always,
|
|
3752
3752
|
prevStatementType: StatementType.Any,
|
|
@@ -3764,11 +3764,11 @@ const config$4 = [{
|
|
|
3764
3764
|
],
|
|
3765
3765
|
nextStatementType: StatementType.Any
|
|
3766
3766
|
}];
|
|
3767
|
-
var padding_around_describe_blocks_default = createPaddingRule(RULE_NAME$
|
|
3767
|
+
var padding_around_describe_blocks_default = createPaddingRule(RULE_NAME$44, "Enforce padding around `describe` blocks", config$4);
|
|
3768
3768
|
|
|
3769
3769
|
//#endregion
|
|
3770
3770
|
//#region src/rules/padding-around-expect-groups.ts
|
|
3771
|
-
const RULE_NAME$
|
|
3771
|
+
const RULE_NAME$43 = "padding-around-expect-groups";
|
|
3772
3772
|
const config$5 = [
|
|
3773
3773
|
{
|
|
3774
3774
|
paddingType: PaddingType.Always,
|
|
@@ -3801,11 +3801,11 @@ const config$5 = [
|
|
|
3801
3801
|
nextStatementType: StatementType.ExpectTypeOfToken
|
|
3802
3802
|
}
|
|
3803
3803
|
];
|
|
3804
|
-
var padding_around_expect_groups_default = createPaddingRule(RULE_NAME$
|
|
3804
|
+
var padding_around_expect_groups_default = createPaddingRule(RULE_NAME$43, "Enforce padding around `expect` groups", config$5);
|
|
3805
3805
|
|
|
3806
3806
|
//#endregion
|
|
3807
3807
|
//#region src/rules/padding-around-test-blocks.ts
|
|
3808
|
-
const RULE_NAME$
|
|
3808
|
+
const RULE_NAME$42 = "padding-around-test-blocks";
|
|
3809
3809
|
const config$6 = [{
|
|
3810
3810
|
paddingType: PaddingType.Always,
|
|
3811
3811
|
prevStatementType: StatementType.Any,
|
|
@@ -3827,12 +3827,12 @@ const config$6 = [{
|
|
|
3827
3827
|
],
|
|
3828
3828
|
nextStatementType: StatementType.Any
|
|
3829
3829
|
}];
|
|
3830
|
-
var padding_around_test_blocks_default = createPaddingRule(RULE_NAME$
|
|
3830
|
+
var padding_around_test_blocks_default = createPaddingRule(RULE_NAME$42, "Enforce padding around `test` blocks", config$6);
|
|
3831
3831
|
|
|
3832
3832
|
//#endregion
|
|
3833
3833
|
//#region src/rules/padding-around-all.ts
|
|
3834
|
-
const RULE_NAME$
|
|
3835
|
-
var padding_around_all_default = createPaddingRule(RULE_NAME$
|
|
3834
|
+
const RULE_NAME$41 = "padding-around-all";
|
|
3835
|
+
var padding_around_all_default = createPaddingRule(RULE_NAME$41, "Enforce padding around vitest functions", [
|
|
3836
3836
|
...config,
|
|
3837
3837
|
...config$1,
|
|
3838
3838
|
...config$2,
|
|
@@ -3844,7 +3844,7 @@ var padding_around_all_default = createPaddingRule(RULE_NAME$40, "Enforce paddin
|
|
|
3844
3844
|
|
|
3845
3845
|
//#endregion
|
|
3846
3846
|
//#region src/rules/prefer-called-exactly-once-with.ts
|
|
3847
|
-
const RULE_NAME$
|
|
3847
|
+
const RULE_NAME$40 = "prefer-called-exactly-once-with";
|
|
3848
3848
|
const MATCHERS_TO_COMBINE = ["toHaveBeenCalledOnce", "toHaveBeenCalledWith"];
|
|
3849
3849
|
const MOCK_CALL_RESET_METHODS = [
|
|
3850
3850
|
"mockClear",
|
|
@@ -3903,7 +3903,7 @@ const hasMockResetBetween = (body, firstCallExpression, secondCallExpression) =>
|
|
|
3903
3903
|
};
|
|
3904
3904
|
const getMemberProperty = (expression) => expression.callee.type === AST_NODE_TYPES.MemberExpression ? expression.callee.property : null;
|
|
3905
3905
|
var prefer_called_exactly_once_with_default = createEslintRule({
|
|
3906
|
-
name: RULE_NAME$
|
|
3906
|
+
name: RULE_NAME$40,
|
|
3907
3907
|
meta: {
|
|
3908
3908
|
docs: { description: "Prefer `toHaveBeenCalledExactlyOnceWith` over `toHaveBeenCalledOnce` and `toHaveBeenCalledWith`" },
|
|
3909
3909
|
messages: { preferCalledExactlyOnceWith: "Using `toHaveBeenCalledOnce` and `toHaveBeenCalledWith` on the same target; prefer `toHaveBeenCalledExactlyOnceWith` instead." },
|
|
@@ -3971,10 +3971,10 @@ var prefer_called_exactly_once_with_default = createEslintRule({
|
|
|
3971
3971
|
|
|
3972
3972
|
//#endregion
|
|
3973
3973
|
//#region src/rules/prefer-called-once.ts
|
|
3974
|
-
const RULE_NAME$
|
|
3974
|
+
const RULE_NAME$39 = "prefer-called-once";
|
|
3975
3975
|
const isOneLiteral = (node) => node.type === AST_NODE_TYPES.Literal && node.value === 1;
|
|
3976
3976
|
var prefer_called_once_default = createEslintRule({
|
|
3977
|
-
name: RULE_NAME$
|
|
3977
|
+
name: RULE_NAME$39,
|
|
3978
3978
|
meta: {
|
|
3979
3979
|
docs: {
|
|
3980
3980
|
description: "enforce using `toBeCalledOnce()` or `toHaveBeenCalledOnce()`",
|
|
@@ -4007,9 +4007,9 @@ var prefer_called_once_default = createEslintRule({
|
|
|
4007
4007
|
|
|
4008
4008
|
//#endregion
|
|
4009
4009
|
//#region src/rules/prefer-called-times.ts
|
|
4010
|
-
const RULE_NAME$
|
|
4010
|
+
const RULE_NAME$38 = "prefer-called-times";
|
|
4011
4011
|
var prefer_called_times_default = createEslintRule({
|
|
4012
|
-
name: RULE_NAME$
|
|
4012
|
+
name: RULE_NAME$38,
|
|
4013
4013
|
meta: {
|
|
4014
4014
|
docs: {
|
|
4015
4015
|
description: "enforce using `toBeCalledTimes(1)` or `toHaveBeenCalledTimes(1)`",
|
|
@@ -4042,9 +4042,9 @@ var prefer_called_times_default = createEslintRule({
|
|
|
4042
4042
|
|
|
4043
4043
|
//#endregion
|
|
4044
4044
|
//#region src/rules/prefer-called-with.ts
|
|
4045
|
-
const RULE_NAME$
|
|
4045
|
+
const RULE_NAME$37 = "prefer-called-with";
|
|
4046
4046
|
var prefer_called_with_default = createEslintRule({
|
|
4047
|
-
name: RULE_NAME$
|
|
4047
|
+
name: RULE_NAME$37,
|
|
4048
4048
|
meta: {
|
|
4049
4049
|
docs: {
|
|
4050
4050
|
description: "enforce using `toBeCalledWith()` or `toHaveBeenCalledWith()`",
|
|
@@ -4092,7 +4092,7 @@ const hasOnlyOneArgument = (call) => call.arguments.length === 1;
|
|
|
4092
4092
|
|
|
4093
4093
|
//#endregion
|
|
4094
4094
|
//#region src/rules/prefer-comparison-matcher.ts
|
|
4095
|
-
const RULE_NAME$
|
|
4095
|
+
const RULE_NAME$36 = "prefer-comparison-matcher";
|
|
4096
4096
|
const isString = (node) => {
|
|
4097
4097
|
return isStringNode(node) || node?.type === AST_NODE_TYPES.TemplateLiteral;
|
|
4098
4098
|
};
|
|
@@ -4118,7 +4118,7 @@ const determineMatcher = (operator, negated) => {
|
|
|
4118
4118
|
return null;
|
|
4119
4119
|
};
|
|
4120
4120
|
var prefer_comparison_matcher_default = createEslintRule({
|
|
4121
|
-
name: RULE_NAME$
|
|
4121
|
+
name: RULE_NAME$36,
|
|
4122
4122
|
meta: {
|
|
4123
4123
|
type: "suggestion",
|
|
4124
4124
|
docs: {
|
|
@@ -4164,9 +4164,9 @@ var prefer_comparison_matcher_default = createEslintRule({
|
|
|
4164
4164
|
|
|
4165
4165
|
//#endregion
|
|
4166
4166
|
//#region src/rules/prefer-describe-function-title.ts
|
|
4167
|
-
const RULE_NAME$
|
|
4167
|
+
const RULE_NAME$35 = "prefer-describe-function-title";
|
|
4168
4168
|
var prefer_describe_function_title_default = createEslintRule({
|
|
4169
|
-
name: RULE_NAME$
|
|
4169
|
+
name: RULE_NAME$35,
|
|
4170
4170
|
meta: {
|
|
4171
4171
|
type: "problem",
|
|
4172
4172
|
docs: {
|
|
@@ -4216,9 +4216,9 @@ var prefer_describe_function_title_default = createEslintRule({
|
|
|
4216
4216
|
|
|
4217
4217
|
//#endregion
|
|
4218
4218
|
//#region src/rules/prefer-each.ts
|
|
4219
|
-
const RULE_NAME$
|
|
4219
|
+
const RULE_NAME$34 = "prefer-each";
|
|
4220
4220
|
var prefer_each_default = createEslintRule({
|
|
4221
|
-
name: RULE_NAME$
|
|
4221
|
+
name: RULE_NAME$34,
|
|
4222
4222
|
meta: {
|
|
4223
4223
|
type: "suggestion",
|
|
4224
4224
|
docs: {
|
|
@@ -4271,9 +4271,9 @@ var prefer_each_default = createEslintRule({
|
|
|
4271
4271
|
|
|
4272
4272
|
//#endregion
|
|
4273
4273
|
//#region src/rules/prefer-equality-matcher.ts
|
|
4274
|
-
const RULE_NAME$
|
|
4274
|
+
const RULE_NAME$33 = "prefer-equality-matcher";
|
|
4275
4275
|
var prefer_equality_matcher_default = createEslintRule({
|
|
4276
|
-
name: RULE_NAME$
|
|
4276
|
+
name: RULE_NAME$33,
|
|
4277
4277
|
meta: {
|
|
4278
4278
|
type: "suggestion",
|
|
4279
4279
|
docs: {
|
|
@@ -4491,9 +4491,9 @@ var prefer_expect_assertions_default = createEslintRule({
|
|
|
4491
4491
|
|
|
4492
4492
|
//#endregion
|
|
4493
4493
|
//#region src/rules/prefer-expect-resolves.ts
|
|
4494
|
-
const RULE_NAME$
|
|
4494
|
+
const RULE_NAME$32 = "prefer-expect-resolves";
|
|
4495
4495
|
var prefer_expect_resolves_default = createEslintRule({
|
|
4496
|
-
name: RULE_NAME$
|
|
4496
|
+
name: RULE_NAME$32,
|
|
4497
4497
|
meta: {
|
|
4498
4498
|
type: "suggestion",
|
|
4499
4499
|
docs: {
|
|
@@ -4527,7 +4527,7 @@ var prefer_expect_resolves_default = createEslintRule({
|
|
|
4527
4527
|
|
|
4528
4528
|
//#endregion
|
|
4529
4529
|
//#region src/rules/prefer-expect-type-of.ts
|
|
4530
|
-
const RULE_NAME$
|
|
4530
|
+
const RULE_NAME$31 = "prefer-expect-type-of";
|
|
4531
4531
|
const typeMatchers = {
|
|
4532
4532
|
string: "toBeString",
|
|
4533
4533
|
number: "toBeNumber",
|
|
@@ -4539,7 +4539,7 @@ const typeMatchers = {
|
|
|
4539
4539
|
undefined: "toBeUndefined"
|
|
4540
4540
|
};
|
|
4541
4541
|
var prefer_expect_type_of_default = createEslintRule({
|
|
4542
|
-
name: RULE_NAME$
|
|
4542
|
+
name: RULE_NAME$31,
|
|
4543
4543
|
meta: {
|
|
4544
4544
|
type: "suggestion",
|
|
4545
4545
|
docs: {
|
|
@@ -4588,7 +4588,7 @@ var prefer_expect_type_of_default = createEslintRule({
|
|
|
4588
4588
|
|
|
4589
4589
|
//#endregion
|
|
4590
4590
|
//#region src/rules/prefer-hooks-in-order.ts
|
|
4591
|
-
const RULE_NAME$
|
|
4591
|
+
const RULE_NAME$30 = "prefer-hooks-in-order";
|
|
4592
4592
|
const HooksOrder = [
|
|
4593
4593
|
"beforeAll",
|
|
4594
4594
|
"beforeEach",
|
|
@@ -4596,7 +4596,7 @@ const HooksOrder = [
|
|
|
4596
4596
|
"afterAll"
|
|
4597
4597
|
];
|
|
4598
4598
|
var prefer_hooks_in_order_default = createEslintRule({
|
|
4599
|
-
name: RULE_NAME$
|
|
4599
|
+
name: RULE_NAME$30,
|
|
4600
4600
|
meta: {
|
|
4601
4601
|
type: "suggestion",
|
|
4602
4602
|
docs: {
|
|
@@ -4649,9 +4649,9 @@ var prefer_hooks_in_order_default = createEslintRule({
|
|
|
4649
4649
|
|
|
4650
4650
|
//#endregion
|
|
4651
4651
|
//#region src/rules/prefer-hooks-on-top.ts
|
|
4652
|
-
const RULE_NAME$
|
|
4652
|
+
const RULE_NAME$29 = "prefer-hooks-on-top";
|
|
4653
4653
|
var prefer_hooks_on_top_default = createEslintRule({
|
|
4654
|
-
name: RULE_NAME$
|
|
4654
|
+
name: RULE_NAME$29,
|
|
4655
4655
|
meta: {
|
|
4656
4656
|
type: "suggestion",
|
|
4657
4657
|
docs: {
|
|
@@ -4684,9 +4684,9 @@ var prefer_hooks_on_top_default = createEslintRule({
|
|
|
4684
4684
|
|
|
4685
4685
|
//#endregion
|
|
4686
4686
|
//#region src/rules/prefer-import-in-mock.ts
|
|
4687
|
-
const RULE_NAME$
|
|
4687
|
+
const RULE_NAME$28 = "prefer-import-in-mock";
|
|
4688
4688
|
var prefer_import_in_mock_default = createEslintRule({
|
|
4689
|
-
name: RULE_NAME$
|
|
4689
|
+
name: RULE_NAME$28,
|
|
4690
4690
|
meta: {
|
|
4691
4691
|
fixable: "code",
|
|
4692
4692
|
type: "suggestion",
|
|
@@ -4716,9 +4716,9 @@ var prefer_import_in_mock_default = createEslintRule({
|
|
|
4716
4716
|
|
|
4717
4717
|
//#endregion
|
|
4718
4718
|
//#region src/rules/prefer-importing-vitest-globals.ts
|
|
4719
|
-
const RULE_NAME$
|
|
4719
|
+
const RULE_NAME$27 = "prefer-importing-vitest-globals";
|
|
4720
4720
|
var prefer_importing_vitest_globals_default = createEslintRule({
|
|
4721
|
-
name: RULE_NAME$
|
|
4721
|
+
name: RULE_NAME$27,
|
|
4722
4722
|
meta: {
|
|
4723
4723
|
type: "suggestion",
|
|
4724
4724
|
docs: {
|
|
@@ -4791,7 +4791,7 @@ var prefer_importing_vitest_globals_default = createEslintRule({
|
|
|
4791
4791
|
|
|
4792
4792
|
//#endregion
|
|
4793
4793
|
//#region src/rules/prefer-lowercase-title.ts
|
|
4794
|
-
const RULE_NAME$
|
|
4794
|
+
const RULE_NAME$26 = "prefer-lowercase-title";
|
|
4795
4795
|
const hasStringAsFirstArgument = (node) => node.arguments[0] && isStringNode(node.arguments[0]);
|
|
4796
4796
|
const populateIgnores = (ignore) => {
|
|
4797
4797
|
const ignores = [];
|
|
@@ -4801,7 +4801,7 @@ const populateIgnores = (ignore) => {
|
|
|
4801
4801
|
return ignores;
|
|
4802
4802
|
};
|
|
4803
4803
|
var prefer_lowercase_title_default = createEslintRule({
|
|
4804
|
-
name: RULE_NAME$
|
|
4804
|
+
name: RULE_NAME$26,
|
|
4805
4805
|
meta: {
|
|
4806
4806
|
type: "problem",
|
|
4807
4807
|
docs: {
|
|
@@ -4888,7 +4888,7 @@ var prefer_lowercase_title_default = createEslintRule({
|
|
|
4888
4888
|
|
|
4889
4889
|
//#endregion
|
|
4890
4890
|
//#region src/rules/prefer-mock-promise-shorthand.ts
|
|
4891
|
-
const RULE_NAME$
|
|
4891
|
+
const RULE_NAME$25 = "prefer-mock-promise-shorthand";
|
|
4892
4892
|
const withOnce = (name, addOnce) => {
|
|
4893
4893
|
return `${name}${addOnce ? "Once" : ""}`;
|
|
4894
4894
|
};
|
|
@@ -4898,7 +4898,7 @@ const findSingleReturnArgumentNode = (fnNode) => {
|
|
|
4898
4898
|
return null;
|
|
4899
4899
|
};
|
|
4900
4900
|
var prefer_mock_promise_shorthand_default = createEslintRule({
|
|
4901
|
-
name: RULE_NAME$
|
|
4901
|
+
name: RULE_NAME$25,
|
|
4902
4902
|
meta: {
|
|
4903
4903
|
type: "suggestion",
|
|
4904
4904
|
docs: {
|
|
@@ -4943,7 +4943,7 @@ var prefer_mock_promise_shorthand_default = createEslintRule({
|
|
|
4943
4943
|
|
|
4944
4944
|
//#endregion
|
|
4945
4945
|
//#region src/rules/prefer-snapshot-hint.ts
|
|
4946
|
-
const RULE_NAME$
|
|
4946
|
+
const RULE_NAME$24 = "prefer-snapshot-hint";
|
|
4947
4947
|
const snapshotMatcherNames = ["toMatchSnapshot", "toThrowErrorMatchingSnapshot"];
|
|
4948
4948
|
const isSnapshotMatcherWithoutHint = (expectFnCall) => {
|
|
4949
4949
|
if (expectFnCall.args.length === 0) return true;
|
|
@@ -4953,7 +4953,7 @@ const isSnapshotMatcherWithoutHint = (expectFnCall) => {
|
|
|
4953
4953
|
return !isStringNode(arg);
|
|
4954
4954
|
};
|
|
4955
4955
|
var prefer_snapshot_hint_default = createEslintRule({
|
|
4956
|
-
name: RULE_NAME$
|
|
4956
|
+
name: RULE_NAME$24,
|
|
4957
4957
|
meta: {
|
|
4958
4958
|
type: "suggestion",
|
|
4959
4959
|
docs: {
|
|
@@ -5022,7 +5022,7 @@ var prefer_snapshot_hint_default = createEslintRule({
|
|
|
5022
5022
|
|
|
5023
5023
|
//#endregion
|
|
5024
5024
|
//#region src/rules/prefer-spy-on.ts
|
|
5025
|
-
const RULE_NAME$
|
|
5025
|
+
const RULE_NAME$23 = "prefer-spy-on";
|
|
5026
5026
|
const findNodeObject = (node) => {
|
|
5027
5027
|
if ("object" in node) return node.object;
|
|
5028
5028
|
if (node.callee.type === AST_NODE_TYPES.MemberExpression) return node.callee.object;
|
|
@@ -5042,7 +5042,7 @@ const getAutoFixMockImplementation = (vitestFnCall, context) => {
|
|
|
5042
5042
|
return argSource ? `.mockImplementation(${argSource})` : ".mockImplementation()";
|
|
5043
5043
|
};
|
|
5044
5044
|
var prefer_spy_on_default = createEslintRule({
|
|
5045
|
-
name: RULE_NAME$
|
|
5045
|
+
name: RULE_NAME$23,
|
|
5046
5046
|
meta: {
|
|
5047
5047
|
type: "suggestion",
|
|
5048
5048
|
docs: {
|
|
@@ -5079,9 +5079,9 @@ var prefer_spy_on_default = createEslintRule({
|
|
|
5079
5079
|
|
|
5080
5080
|
//#endregion
|
|
5081
5081
|
//#region src/rules/prefer-strict-boolean-matchers.ts
|
|
5082
|
-
const RULE_NAME$
|
|
5082
|
+
const RULE_NAME$22 = "prefer-strict-boolean-matchers";
|
|
5083
5083
|
var prefer_strict_boolean_matchers_default = createEslintRule({
|
|
5084
|
-
name: RULE_NAME$
|
|
5084
|
+
name: RULE_NAME$22,
|
|
5085
5085
|
meta: {
|
|
5086
5086
|
type: "suggestion",
|
|
5087
5087
|
docs: {
|
|
@@ -5117,9 +5117,9 @@ var prefer_strict_boolean_matchers_default = createEslintRule({
|
|
|
5117
5117
|
|
|
5118
5118
|
//#endregion
|
|
5119
5119
|
//#region src/rules/prefer-strict-equal.ts
|
|
5120
|
-
const RULE_NAME$
|
|
5120
|
+
const RULE_NAME$21 = "prefer-strict-equal";
|
|
5121
5121
|
var prefer_strict_equal_default = createEslintRule({
|
|
5122
|
-
name: RULE_NAME$
|
|
5122
|
+
name: RULE_NAME$21,
|
|
5123
5123
|
meta: {
|
|
5124
5124
|
type: "suggestion",
|
|
5125
5125
|
docs: {
|
|
@@ -5153,10 +5153,10 @@ var prefer_strict_equal_default = createEslintRule({
|
|
|
5153
5153
|
|
|
5154
5154
|
//#endregion
|
|
5155
5155
|
//#region src/rules/prefer-to-be-falsy.ts
|
|
5156
|
-
const RULE_NAME$
|
|
5156
|
+
const RULE_NAME$20 = "prefer-to-be-falsy";
|
|
5157
5157
|
const isFalseLiteral = (node) => node.type === AST_NODE_TYPES.Literal && node.value === false;
|
|
5158
5158
|
var prefer_to_be_falsy_default = createEslintRule({
|
|
5159
|
-
name: RULE_NAME$
|
|
5159
|
+
name: RULE_NAME$20,
|
|
5160
5160
|
meta: {
|
|
5161
5161
|
type: "suggestion",
|
|
5162
5162
|
docs: {
|
|
@@ -5183,9 +5183,9 @@ var prefer_to_be_falsy_default = createEslintRule({
|
|
|
5183
5183
|
|
|
5184
5184
|
//#endregion
|
|
5185
5185
|
//#region src/rules/prefer-to-be-object.ts
|
|
5186
|
-
const RULE_NAME$
|
|
5186
|
+
const RULE_NAME$19 = "prefer-to-be-object";
|
|
5187
5187
|
var prefer_to_be_object_default = createEslintRule({
|
|
5188
|
-
name: RULE_NAME$
|
|
5188
|
+
name: RULE_NAME$19,
|
|
5189
5189
|
meta: {
|
|
5190
5190
|
type: "suggestion",
|
|
5191
5191
|
docs: {
|
|
@@ -5237,10 +5237,10 @@ var prefer_to_be_object_default = createEslintRule({
|
|
|
5237
5237
|
|
|
5238
5238
|
//#endregion
|
|
5239
5239
|
//#region src/rules/prefer-to-be-truthy.ts
|
|
5240
|
-
const RULE_NAME$
|
|
5240
|
+
const RULE_NAME$18 = "prefer-to-be-truthy";
|
|
5241
5241
|
const isTrueLiteral = (node) => node.type === AST_NODE_TYPES.Literal && node.value === true;
|
|
5242
5242
|
var prefer_to_be_truthy_default = createEslintRule({
|
|
5243
|
-
name: RULE_NAME$
|
|
5243
|
+
name: RULE_NAME$18,
|
|
5244
5244
|
meta: {
|
|
5245
5245
|
type: "suggestion",
|
|
5246
5246
|
docs: {
|
|
@@ -5267,7 +5267,7 @@ var prefer_to_be_truthy_default = createEslintRule({
|
|
|
5267
5267
|
|
|
5268
5268
|
//#endregion
|
|
5269
5269
|
//#region src/rules/prefer-to-be.ts
|
|
5270
|
-
const RULE_NAME$
|
|
5270
|
+
const RULE_NAME$17 = "prefer-to-be";
|
|
5271
5271
|
const isNullLiteral = (node) => node.type === AST_NODE_TYPES.Literal && node.value === null;
|
|
5272
5272
|
const isNullEqualityMatcher = (expectFnCall) => isNullLiteral(getFirstMatcherArg(expectFnCall));
|
|
5273
5273
|
const isFirstArgumentIdentifier = (expectFnCall, name) => isIdentifier(getFirstMatcherArg(expectFnCall), name);
|
|
@@ -5292,7 +5292,7 @@ const reportPreferToBe = (context, whatToBe, expectFnCall, func, modifierNode) =
|
|
|
5292
5292
|
});
|
|
5293
5293
|
};
|
|
5294
5294
|
var prefer_to_be_default = createEslintRule({
|
|
5295
|
-
name: RULE_NAME$
|
|
5295
|
+
name: RULE_NAME$17,
|
|
5296
5296
|
meta: {
|
|
5297
5297
|
type: "suggestion",
|
|
5298
5298
|
docs: {
|
|
@@ -5340,10 +5340,10 @@ var prefer_to_be_default = createEslintRule({
|
|
|
5340
5340
|
|
|
5341
5341
|
//#endregion
|
|
5342
5342
|
//#region src/rules/prefer-to-contain.ts
|
|
5343
|
-
const RULE_NAME$
|
|
5343
|
+
const RULE_NAME$16 = "prefer-to-contain";
|
|
5344
5344
|
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;
|
|
5345
5345
|
var prefer_to_contain_default = createEslintRule({
|
|
5346
|
-
name: RULE_NAME$
|
|
5346
|
+
name: RULE_NAME$16,
|
|
5347
5347
|
meta: {
|
|
5348
5348
|
docs: {
|
|
5349
5349
|
description: "enforce using toContain()",
|
|
@@ -5385,9 +5385,9 @@ var prefer_to_contain_default = createEslintRule({
|
|
|
5385
5385
|
|
|
5386
5386
|
//#endregion
|
|
5387
5387
|
//#region src/rules/prefer-to-have-length.ts
|
|
5388
|
-
const RULE_NAME$
|
|
5388
|
+
const RULE_NAME$15 = "prefer-to-have-length";
|
|
5389
5389
|
var prefer_to_have_length_default = createEslintRule({
|
|
5390
|
-
name: RULE_NAME$
|
|
5390
|
+
name: RULE_NAME$15,
|
|
5391
5391
|
meta: {
|
|
5392
5392
|
type: "suggestion",
|
|
5393
5393
|
docs: {
|
|
@@ -5421,7 +5421,7 @@ var prefer_to_have_length_default = createEslintRule({
|
|
|
5421
5421
|
|
|
5422
5422
|
//#endregion
|
|
5423
5423
|
//#region src/rules/prefer-todo.ts
|
|
5424
|
-
const RULE_NAME$
|
|
5424
|
+
const RULE_NAME$14 = "prefer-todo";
|
|
5425
5425
|
const isTargetedTestCase = (vitestFnCall) => {
|
|
5426
5426
|
if (vitestFnCall.members.some((s) => getAccessorValue(s) !== "skip")) return false;
|
|
5427
5427
|
if (vitestFnCall.name.startsWith("x")) return false;
|
|
@@ -5436,7 +5436,7 @@ function createTodoFixer(vitestFnCall, fixer) {
|
|
|
5436
5436
|
return fixer.replaceText(vitestFnCall.head.node, `${vitestFnCall.head.local}.todo`);
|
|
5437
5437
|
}
|
|
5438
5438
|
var prefer_todo_default = createEslintRule({
|
|
5439
|
-
name: RULE_NAME$
|
|
5439
|
+
name: RULE_NAME$14,
|
|
5440
5440
|
meta: {
|
|
5441
5441
|
type: "layout",
|
|
5442
5442
|
docs: {
|
|
@@ -5472,7 +5472,7 @@ var prefer_todo_default = createEslintRule({
|
|
|
5472
5472
|
|
|
5473
5473
|
//#endregion
|
|
5474
5474
|
//#region src/rules/prefer-vi-mocked.ts
|
|
5475
|
-
const RULE_NAME$
|
|
5475
|
+
const RULE_NAME$13 = "prefer-vi-mocked";
|
|
5476
5476
|
const mockTypes = [
|
|
5477
5477
|
"Mock",
|
|
5478
5478
|
"MockedFunction",
|
|
@@ -5480,7 +5480,7 @@ const mockTypes = [
|
|
|
5480
5480
|
"MockedObject"
|
|
5481
5481
|
];
|
|
5482
5482
|
var prefer_vi_mocked_default = createEslintRule({
|
|
5483
|
-
name: RULE_NAME$
|
|
5483
|
+
name: RULE_NAME$13,
|
|
5484
5484
|
meta: {
|
|
5485
5485
|
type: "suggestion",
|
|
5486
5486
|
docs: {
|
|
@@ -5523,9 +5523,9 @@ var prefer_vi_mocked_default = createEslintRule({
|
|
|
5523
5523
|
|
|
5524
5524
|
//#endregion
|
|
5525
5525
|
//#region src/rules/require-awaited-expect-poll.ts
|
|
5526
|
-
const RULE_NAME$
|
|
5526
|
+
const RULE_NAME$12 = "require-awaited-expect-poll";
|
|
5527
5527
|
var require_awaited_expect_poll_default = createEslintRule({
|
|
5528
|
-
name: RULE_NAME$
|
|
5528
|
+
name: RULE_NAME$12,
|
|
5529
5529
|
meta: {
|
|
5530
5530
|
docs: {
|
|
5531
5531
|
requiresTypeChecking: false,
|
|
@@ -5572,7 +5572,7 @@ function skipSequenceExpressions(node) {
|
|
|
5572
5572
|
|
|
5573
5573
|
//#endregion
|
|
5574
5574
|
//#region src/rules/require-hook.ts
|
|
5575
|
-
const RULE_NAME$
|
|
5575
|
+
const RULE_NAME$11 = "require-hook";
|
|
5576
5576
|
const isVitestFnCall = (node, context) => {
|
|
5577
5577
|
if (parseVitestFnCall(node, context)) return true;
|
|
5578
5578
|
return !!getNodeName(node)?.startsWith("vi");
|
|
@@ -5591,7 +5591,7 @@ const shouldBeInHook = (node, context, allowedFunctionCalls = []) => {
|
|
|
5591
5591
|
}
|
|
5592
5592
|
};
|
|
5593
5593
|
var require_hook_default = createEslintRule({
|
|
5594
|
-
name: RULE_NAME$
|
|
5594
|
+
name: RULE_NAME$11,
|
|
5595
5595
|
meta: {
|
|
5596
5596
|
docs: {
|
|
5597
5597
|
description: "require setup and teardown to be within a hook",
|
|
@@ -5632,9 +5632,9 @@ var require_hook_default = createEslintRule({
|
|
|
5632
5632
|
|
|
5633
5633
|
//#endregion
|
|
5634
5634
|
//#region src/rules/require-import-vi-mock.ts
|
|
5635
|
-
const RULE_NAME$
|
|
5635
|
+
const RULE_NAME$10 = "require-import-vi-mock";
|
|
5636
5636
|
var require_import_vi_mock_default = createEslintRule({
|
|
5637
|
-
name: RULE_NAME$
|
|
5637
|
+
name: RULE_NAME$10,
|
|
5638
5638
|
meta: {
|
|
5639
5639
|
fixable: "code",
|
|
5640
5640
|
type: "suggestion",
|
|
@@ -5668,9 +5668,9 @@ var require_import_vi_mock_default = createEslintRule({
|
|
|
5668
5668
|
|
|
5669
5669
|
//#endregion
|
|
5670
5670
|
//#region src/rules/require-local-test-context-for-concurrent-snapshots.ts
|
|
5671
|
-
const RULE_NAME$
|
|
5671
|
+
const RULE_NAME$9 = "require-local-test-context-for-concurrent-snapshots";
|
|
5672
5672
|
var require_local_test_context_for_concurrent_snapshots_default = createEslintRule({
|
|
5673
|
-
name: RULE_NAME$
|
|
5673
|
+
name: RULE_NAME$9,
|
|
5674
5674
|
meta: {
|
|
5675
5675
|
docs: {
|
|
5676
5676
|
description: "require local Test Context for concurrent snapshot tests",
|
|
@@ -5711,9 +5711,9 @@ var require_local_test_context_for_concurrent_snapshots_default = createEslintRu
|
|
|
5711
5711
|
|
|
5712
5712
|
//#endregion
|
|
5713
5713
|
//#region src/rules/require-mock-type-parameters.ts
|
|
5714
|
-
const RULE_NAME$
|
|
5714
|
+
const RULE_NAME$8 = "require-mock-type-parameters";
|
|
5715
5715
|
var require_mock_type_parameters_default = createEslintRule({
|
|
5716
|
-
name: RULE_NAME$
|
|
5716
|
+
name: RULE_NAME$8,
|
|
5717
5717
|
meta: {
|
|
5718
5718
|
type: "suggestion",
|
|
5719
5719
|
docs: {
|
|
@@ -5750,9 +5750,9 @@ var require_mock_type_parameters_default = createEslintRule({
|
|
|
5750
5750
|
|
|
5751
5751
|
//#endregion
|
|
5752
5752
|
//#region src/rules/require-to-throw-message.ts
|
|
5753
|
-
const RULE_NAME$
|
|
5753
|
+
const RULE_NAME$7 = "require-to-throw-message";
|
|
5754
5754
|
var require_to_throw_message_default = createEslintRule({
|
|
5755
|
-
name: RULE_NAME$
|
|
5755
|
+
name: RULE_NAME$7,
|
|
5756
5756
|
meta: {
|
|
5757
5757
|
type: "suggestion",
|
|
5758
5758
|
docs: {
|
|
@@ -5780,9 +5780,9 @@ var require_to_throw_message_default = createEslintRule({
|
|
|
5780
5780
|
|
|
5781
5781
|
//#endregion
|
|
5782
5782
|
//#region src/rules/require-top-level-describe.ts
|
|
5783
|
-
const RULE_NAME$
|
|
5783
|
+
const RULE_NAME$6 = "require-top-level-describe";
|
|
5784
5784
|
var require_top_level_describe_default = createEslintRule({
|
|
5785
|
-
name: RULE_NAME$
|
|
5785
|
+
name: RULE_NAME$6,
|
|
5786
5786
|
meta: {
|
|
5787
5787
|
docs: {
|
|
5788
5788
|
description: "enforce that all tests are in a top-level describe",
|
|
@@ -5851,7 +5851,7 @@ var require_top_level_describe_default = createEslintRule({
|
|
|
5851
5851
|
|
|
5852
5852
|
//#endregion
|
|
5853
5853
|
//#region src/rules/valid-describe-callback.ts
|
|
5854
|
-
const RULE_NAME$
|
|
5854
|
+
const RULE_NAME$5 = "valid-describe-callback";
|
|
5855
5855
|
const paramsLocation = (params) => {
|
|
5856
5856
|
const [first] = params;
|
|
5857
5857
|
const last = params[params.length - 1];
|
|
@@ -5873,7 +5873,7 @@ const reportUnexpectedReturnInDescribe = (blockStatement, context) => {
|
|
|
5873
5873
|
});
|
|
5874
5874
|
};
|
|
5875
5875
|
var valid_describe_callback_default = createEslintRule({
|
|
5876
|
-
name: RULE_NAME$
|
|
5876
|
+
name: RULE_NAME$5,
|
|
5877
5877
|
meta: {
|
|
5878
5878
|
type: "problem",
|
|
5879
5879
|
docs: {
|
|
@@ -5940,7 +5940,7 @@ var valid_describe_callback_default = createEslintRule({
|
|
|
5940
5940
|
|
|
5941
5941
|
//#endregion
|
|
5942
5942
|
//#region src/rules/valid-expect-in-promise.ts
|
|
5943
|
-
const RULE_NAME$
|
|
5943
|
+
const RULE_NAME$4 = "valid-expect-in-promise";
|
|
5944
5944
|
const defaultAsyncMatchers$1 = ["toRejectWith", "toResolveWith"];
|
|
5945
5945
|
const isPromiseChainCall = (node) => {
|
|
5946
5946
|
if (node.type === AST_NODE_TYPES.CallExpression && node.callee.type === AST_NODE_TYPES.MemberExpression && isSupportedAccessor(node.callee.property)) {
|
|
@@ -6072,7 +6072,7 @@ const isVariableAwaitedOrReturned = (variable, context) => {
|
|
|
6072
6072
|
return isValueAwaitedOrReturned(variable.id, body, context);
|
|
6073
6073
|
};
|
|
6074
6074
|
var valid_expect_in_promise_default = createEslintRule({
|
|
6075
|
-
name: RULE_NAME$
|
|
6075
|
+
name: RULE_NAME$4,
|
|
6076
6076
|
meta: {
|
|
6077
6077
|
docs: { description: "require promises that have expectations in their chain to be valid" },
|
|
6078
6078
|
messages: { expectInFloatingPromise: "This promise should either be returned or awaited to ensure the expects in its chain are called" },
|
|
@@ -6132,7 +6132,7 @@ var valid_expect_in_promise_default = createEslintRule({
|
|
|
6132
6132
|
|
|
6133
6133
|
//#endregion
|
|
6134
6134
|
//#region src/rules/valid-expect.ts
|
|
6135
|
-
const RULE_NAME$
|
|
6135
|
+
const RULE_NAME$3 = "valid-expect";
|
|
6136
6136
|
const defaultAsyncMatchers = ["toReject", "toResolve"];
|
|
6137
6137
|
/**
|
|
6138
6138
|
* Async assertions might be called in Promise
|
|
@@ -6167,7 +6167,7 @@ const isAcceptableReturnNode = (node, allowReturn) => {
|
|
|
6167
6167
|
return [AST_NODE_TYPES.ArrowFunctionExpression, AST_NODE_TYPES.AwaitExpression].includes(node.type);
|
|
6168
6168
|
};
|
|
6169
6169
|
var valid_expect_default = createEslintRule({
|
|
6170
|
-
name: RULE_NAME$
|
|
6170
|
+
name: RULE_NAME$3,
|
|
6171
6171
|
meta: {
|
|
6172
6172
|
docs: {
|
|
6173
6173
|
description: "enforce valid `expect()` usage",
|
|
@@ -6360,7 +6360,7 @@ var valid_expect_default = createEslintRule({
|
|
|
6360
6360
|
|
|
6361
6361
|
//#endregion
|
|
6362
6362
|
//#region src/rules/valid-title.ts
|
|
6363
|
-
const RULE_NAME$
|
|
6363
|
+
const RULE_NAME$2 = "valid-title";
|
|
6364
6364
|
const trimFXPrefix = (word) => ["f", "x"].includes(word.charAt(0)) ? word.substring(1) : word;
|
|
6365
6365
|
const quoteStringValue = (node) => node.type === AST_NODE_TYPES.TemplateLiteral ? `\`${node.quasis[0].value.raw}\`` : node.raw;
|
|
6366
6366
|
const MatcherAndMessageSchema = {
|
|
@@ -6399,7 +6399,7 @@ const doesBinaryExpressionContainStringNode = (binaryExp) => {
|
|
|
6399
6399
|
return isStringNode(binaryExp.left);
|
|
6400
6400
|
};
|
|
6401
6401
|
var valid_title_default = createEslintRule({
|
|
6402
|
-
name: RULE_NAME$
|
|
6402
|
+
name: RULE_NAME$2,
|
|
6403
6403
|
meta: {
|
|
6404
6404
|
docs: {
|
|
6405
6405
|
description: "enforce valid titles",
|
|
@@ -6552,9 +6552,9 @@ var valid_title_default = createEslintRule({
|
|
|
6552
6552
|
|
|
6553
6553
|
//#endregion
|
|
6554
6554
|
//#region src/rules/warn-todo.ts
|
|
6555
|
-
const RULE_NAME = "warn-todo";
|
|
6555
|
+
const RULE_NAME$1 = "warn-todo";
|
|
6556
6556
|
var warn_todo_default = createEslintRule({
|
|
6557
|
-
name: RULE_NAME,
|
|
6557
|
+
name: RULE_NAME$1,
|
|
6558
6558
|
meta: {
|
|
6559
6559
|
docs: {
|
|
6560
6560
|
description: "disallow `.todo` usage",
|
|
@@ -6579,6 +6579,49 @@ var warn_todo_default = createEslintRule({
|
|
|
6579
6579
|
}
|
|
6580
6580
|
});
|
|
6581
6581
|
|
|
6582
|
+
//#endregion
|
|
6583
|
+
//#region src/rules/no-unneeded-async-expect-function.ts
|
|
6584
|
+
const RULE_NAME = "no-unneeded-async-expect-function";
|
|
6585
|
+
const getAwaitedCallExpression = (expression) => {
|
|
6586
|
+
if (!expression.async) return null;
|
|
6587
|
+
if (expression.type === AST_NODE_TYPES.ArrowFunctionExpression && expression.body.type === AST_NODE_TYPES.AwaitExpression && expression.body.argument.type === AST_NODE_TYPES.CallExpression) return expression.body.argument;
|
|
6588
|
+
if (expression.body.type !== AST_NODE_TYPES.BlockStatement || expression.body.body.length !== 1) return null;
|
|
6589
|
+
const [callback] = expression.body.body;
|
|
6590
|
+
if (callback.type === AST_NODE_TYPES.ExpressionStatement && callback.expression.type === AST_NODE_TYPES.AwaitExpression && callback.expression.argument.type === AST_NODE_TYPES.CallExpression) return callback.expression.argument;
|
|
6591
|
+
return null;
|
|
6592
|
+
};
|
|
6593
|
+
var no_unneeded_async_expect_function_default = createEslintRule({
|
|
6594
|
+
name: RULE_NAME,
|
|
6595
|
+
meta: {
|
|
6596
|
+
docs: { description: "Disallow unnecessary async function wrapper for expected promises" },
|
|
6597
|
+
fixable: "code",
|
|
6598
|
+
messages: { noAsyncWrapperForExpectedPromise: "Unnecessary async function wrapper" },
|
|
6599
|
+
schema: [],
|
|
6600
|
+
type: "suggestion"
|
|
6601
|
+
},
|
|
6602
|
+
defaultOptions: [],
|
|
6603
|
+
create(context) {
|
|
6604
|
+
return { CallExpression(node) {
|
|
6605
|
+
const vitestFnCall = parseVitestFnCall(node, context);
|
|
6606
|
+
if (vitestFnCall?.type !== "expect") return;
|
|
6607
|
+
const { parent } = vitestFnCall.head.node;
|
|
6608
|
+
if (parent?.type !== AST_NODE_TYPES.CallExpression) return;
|
|
6609
|
+
const [awaitNode] = parent.arguments;
|
|
6610
|
+
if (!awaitNode || !isFunction(awaitNode)) return;
|
|
6611
|
+
const innerAsyncFuncCall = getAwaitedCallExpression(awaitNode);
|
|
6612
|
+
if (!innerAsyncFuncCall) return;
|
|
6613
|
+
context.report({
|
|
6614
|
+
node: awaitNode,
|
|
6615
|
+
messageId: "noAsyncWrapperForExpectedPromise",
|
|
6616
|
+
fix(fixer) {
|
|
6617
|
+
const { sourceCode } = context;
|
|
6618
|
+
return [fixer.replaceTextRange(awaitNode.range, sourceCode.getText(innerAsyncFuncCall))];
|
|
6619
|
+
}
|
|
6620
|
+
});
|
|
6621
|
+
} };
|
|
6622
|
+
}
|
|
6623
|
+
});
|
|
6624
|
+
|
|
6582
6625
|
//#endregion
|
|
6583
6626
|
//#region src/rules/index.ts
|
|
6584
6627
|
const rules = {
|
|
@@ -6611,6 +6654,7 @@ const rules = {
|
|
|
6611
6654
|
"no-standalone-expect": no_standalone_expect_default,
|
|
6612
6655
|
"no-test-prefixes": no_test_prefixes_default,
|
|
6613
6656
|
"no-test-return-statement": no_test_return_statement_default,
|
|
6657
|
+
"no-unneeded-async-expect-function": no_unneeded_async_expect_function_default,
|
|
6614
6658
|
"padding-around-after-all-blocks": padding_around_after_all_blocks_default,
|
|
6615
6659
|
"padding-around-after-each-blocks": padding_around_after_each_blocks_default,
|
|
6616
6660
|
"padding-around-all": padding_around_all_default,
|
|
@@ -6708,6 +6752,7 @@ const allRules = {
|
|
|
6708
6752
|
"no-standalone-expect": "warn",
|
|
6709
6753
|
"no-test-prefixes": "warn",
|
|
6710
6754
|
"no-test-return-statement": "warn",
|
|
6755
|
+
"no-unneeded-async-expect-function": "warn",
|
|
6711
6756
|
"padding-around-after-all-blocks": "warn",
|
|
6712
6757
|
"padding-around-after-each-blocks": "warn",
|
|
6713
6758
|
"padding-around-all": "warn",
|
|
@@ -6768,6 +6813,7 @@ const recommendedRules = {
|
|
|
6768
6813
|
"no-interpolation-in-snapshots": "error",
|
|
6769
6814
|
"no-mocks-import": "error",
|
|
6770
6815
|
"no-standalone-expect": "error",
|
|
6816
|
+
"no-unneeded-async-expect-function": "error",
|
|
6771
6817
|
"prefer-called-exactly-once-with": "error",
|
|
6772
6818
|
"require-local-test-context-for-concurrent-snapshots": "error",
|
|
6773
6819
|
"valid-describe-callback": "error",
|