@vitest/eslint-plugin 1.6.12 → 1.6.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -4,7 +4,7 @@ let node_module = require("node:module");
4
4
  let _typescript_eslint_scope_manager = require("@typescript-eslint/scope-manager");
5
5
 
6
6
  //#region package.json
7
- var version = "1.6.12";
7
+ var version = "1.6.13";
8
8
 
9
9
  //#endregion
10
10
  //#region src/utils/index.ts
@@ -1780,7 +1780,7 @@ const followTypeAssertionChain$1 = (expression) => isTypeCastExpression$1(expres
1780
1780
 
1781
1781
  //#endregion
1782
1782
  //#region src/rules/consistent-each-for.ts
1783
- const RULE_NAME$80 = "consistent-each-for";
1783
+ const RULE_NAME$81 = "consistent-each-for";
1784
1784
  const BASE_FN_NAMES = [
1785
1785
  "test",
1786
1786
  "it",
@@ -1788,7 +1788,7 @@ const BASE_FN_NAMES = [
1788
1788
  "suite"
1789
1789
  ];
1790
1790
  var consistent_each_for_default = createEslintRule({
1791
- name: RULE_NAME$80,
1791
+ name: RULE_NAME$81,
1792
1792
  meta: {
1793
1793
  type: "suggestion",
1794
1794
  docs: {
@@ -1851,11 +1851,11 @@ var consistent_each_for_default = createEslintRule({
1851
1851
 
1852
1852
  //#endregion
1853
1853
  //#region src/rules/consistent-test-filename.ts
1854
- const RULE_NAME$79 = "consistent-test-filename";
1854
+ const RULE_NAME$80 = "consistent-test-filename";
1855
1855
  const defaultPattern = /.*\.test\.[tj]sx?$/;
1856
1856
  const defaultTestsPattern = /.*\.(test|spec)\.[tj]sx?$/;
1857
1857
  var consistent_test_filename_default = createEslintRule({
1858
- name: RULE_NAME$79,
1858
+ name: RULE_NAME$80,
1859
1859
  meta: {
1860
1860
  type: "problem",
1861
1861
  docs: {
@@ -1903,7 +1903,7 @@ var consistent_test_filename_default = createEslintRule({
1903
1903
 
1904
1904
  //#endregion
1905
1905
  //#region src/rules/consistent-test-it.ts
1906
- const RULE_NAME$78 = "consistent-test-it";
1906
+ const RULE_NAME$79 = "consistent-test-it";
1907
1907
  const buildFixer = (callee, nodeName, preferredTestKeyword) => (fixer) => [fixer.replaceText(callee.type === _typescript_eslint_utils.AST_NODE_TYPES.MemberExpression ? callee.object : callee, getPreferredNodeName(nodeName, preferredTestKeyword))];
1908
1908
  function getPreferredNodeName(nodeName, preferredTestKeyword) {
1909
1909
  if (nodeName === TestCaseName.fit) return "test.only";
@@ -1914,7 +1914,7 @@ function getOppositeTestKeyword(test) {
1914
1914
  return TestCaseName.test;
1915
1915
  }
1916
1916
  var consistent_test_it_default = createEslintRule({
1917
- name: RULE_NAME$78,
1917
+ name: RULE_NAME$79,
1918
1918
  meta: {
1919
1919
  type: "suggestion",
1920
1920
  fixable: "code",
@@ -2025,10 +2025,10 @@ var consistent_test_it_default = createEslintRule({
2025
2025
 
2026
2026
  //#endregion
2027
2027
  //#region src/rules/consistent-vitest-vi.ts
2028
- const RULE_NAME$77 = "consistent-vitest-vi";
2028
+ const RULE_NAME$78 = "consistent-vitest-vi";
2029
2029
  const getOppositeVitestUtilKeyword = (util) => util === UtilName.vi ? UtilName.vitest : UtilName.vi;
2030
2030
  var consistent_vitest_vi_default = createEslintRule({
2031
- name: RULE_NAME$77,
2031
+ name: RULE_NAME$78,
2032
2032
  meta: {
2033
2033
  type: "suggestion",
2034
2034
  fixable: "code",
@@ -2110,9 +2110,9 @@ function parsePluginSettings(settings) {
2110
2110
 
2111
2111
  //#endregion
2112
2112
  //#region src/rules/expect-expect.ts
2113
- const RULE_NAME$76 = "expect-expect";
2113
+ const RULE_NAME$77 = "expect-expect";
2114
2114
  var expect_expect_default = createEslintRule({
2115
- name: RULE_NAME$76,
2115
+ name: RULE_NAME$77,
2116
2116
  meta: {
2117
2117
  type: "suggestion",
2118
2118
  docs: {
@@ -2190,14 +2190,14 @@ function buildPatternRegexp(pattern) {
2190
2190
 
2191
2191
  //#endregion
2192
2192
  //#region src/rules/hoisted-apis-on-top.ts
2193
- const RULE_NAME$75 = "hoisted-apis-on-top";
2193
+ const RULE_NAME$76 = "hoisted-apis-on-top";
2194
2194
  const hoistedAPIs = [
2195
2195
  "mock",
2196
2196
  "hoisted",
2197
2197
  "unmock"
2198
2198
  ];
2199
2199
  var hoisted_apis_on_top_default = createEslintRule({
2200
- name: RULE_NAME$75,
2200
+ name: RULE_NAME$76,
2201
2201
  meta: {
2202
2202
  hasSuggestions: true,
2203
2203
  type: "suggestion",
@@ -2263,9 +2263,9 @@ var hoisted_apis_on_top_default = createEslintRule({
2263
2263
 
2264
2264
  //#endregion
2265
2265
  //#region src/rules/max-expects.ts
2266
- const RULE_NAME$74 = "max-expects";
2266
+ const RULE_NAME$75 = "max-expects";
2267
2267
  var max_expects_default = createEslintRule({
2268
- name: RULE_NAME$74,
2268
+ name: RULE_NAME$75,
2269
2269
  meta: {
2270
2270
  docs: {
2271
2271
  requiresTypeChecking: false,
@@ -2313,9 +2313,9 @@ var max_expects_default = createEslintRule({
2313
2313
 
2314
2314
  //#endregion
2315
2315
  //#region src/rules/max-nested-describe.ts
2316
- const RULE_NAME$73 = "max-nested-describe";
2316
+ const RULE_NAME$74 = "max-nested-describe";
2317
2317
  var max_nested_describe_default = createEslintRule({
2318
- name: RULE_NAME$73,
2318
+ name: RULE_NAME$74,
2319
2319
  meta: {
2320
2320
  type: "problem",
2321
2321
  docs: {
@@ -2360,9 +2360,9 @@ var max_nested_describe_default = createEslintRule({
2360
2360
 
2361
2361
  //#endregion
2362
2362
  //#region src/rules/no-alias-methods.ts
2363
- const RULE_NAME$72 = "no-alias-methods";
2363
+ const RULE_NAME$73 = "no-alias-methods";
2364
2364
  var no_alias_methods_default = createEslintRule({
2365
- name: RULE_NAME$72,
2365
+ name: RULE_NAME$73,
2366
2366
  meta: {
2367
2367
  docs: {
2368
2368
  description: "disallow alias methods",
@@ -2411,12 +2411,12 @@ var no_alias_methods_default = createEslintRule({
2411
2411
 
2412
2412
  //#endregion
2413
2413
  //#region src/rules/no-commented-out-tests.ts
2414
- const RULE_NAME$71 = "no-commented-out-tests";
2414
+ const RULE_NAME$72 = "no-commented-out-tests";
2415
2415
  function hasTests(node) {
2416
2416
  return /^\s*[xf]?(test|it|describe)(\.\w+|\[['"]\w+['"]\])?\s*\(/mu.test(node.value);
2417
2417
  }
2418
2418
  var no_commented_out_tests_default = createEslintRule({
2419
- name: RULE_NAME$71,
2419
+ name: RULE_NAME$72,
2420
2420
  meta: {
2421
2421
  docs: {
2422
2422
  description: "disallow commented out tests",
@@ -2444,10 +2444,10 @@ var no_commented_out_tests_default = createEslintRule({
2444
2444
 
2445
2445
  //#endregion
2446
2446
  //#region src/rules/no-conditional-expect.ts
2447
- const RULE_NAME$70 = "no-conditional-expect";
2447
+ const RULE_NAME$71 = "no-conditional-expect";
2448
2448
  const isCatchCall = (node) => node.callee.type === _typescript_eslint_utils.AST_NODE_TYPES.MemberExpression && isSupportedAccessor(node.callee.property, "catch");
2449
2449
  var no_conditional_expect_default = createEslintRule({
2450
- name: RULE_NAME$70,
2450
+ name: RULE_NAME$71,
2451
2451
  meta: {
2452
2452
  type: "problem",
2453
2453
  docs: {
@@ -2525,9 +2525,9 @@ var no_conditional_expect_default = createEslintRule({
2525
2525
 
2526
2526
  //#endregion
2527
2527
  //#region src/rules/no-conditional-in-test.ts
2528
- const RULE_NAME$69 = "no-conditional-in-test";
2528
+ const RULE_NAME$70 = "no-conditional-in-test";
2529
2529
  var no_conditional_in_test_default = createEslintRule({
2530
- name: RULE_NAME$69,
2530
+ name: RULE_NAME$70,
2531
2531
  meta: {
2532
2532
  docs: {
2533
2533
  description: "disallow conditional tests",
@@ -2550,9 +2550,9 @@ var no_conditional_in_test_default = createEslintRule({
2550
2550
 
2551
2551
  //#endregion
2552
2552
  //#region src/rules/no-conditional-tests.ts
2553
- const RULE_NAME$68 = "no-conditional-tests";
2553
+ const RULE_NAME$69 = "no-conditional-tests";
2554
2554
  var no_conditional_tests_default = createEslintRule({
2555
- name: RULE_NAME$68,
2555
+ name: RULE_NAME$69,
2556
2556
  meta: {
2557
2557
  type: "problem",
2558
2558
  docs: {
@@ -2580,9 +2580,9 @@ var no_conditional_tests_default = createEslintRule({
2580
2580
 
2581
2581
  //#endregion
2582
2582
  //#region src/rules/no-disabled-tests.ts
2583
- const RULE_NAME$67 = "no-disabled-tests";
2583
+ const RULE_NAME$68 = "no-disabled-tests";
2584
2584
  var no_disabled_tests_default = createEslintRule({
2585
- name: RULE_NAME$67,
2585
+ name: RULE_NAME$68,
2586
2586
  meta: {
2587
2587
  type: "suggestion",
2588
2588
  docs: {
@@ -2647,7 +2647,7 @@ var no_disabled_tests_default = createEslintRule({
2647
2647
 
2648
2648
  //#endregion
2649
2649
  //#region src/rules/no-done-callback.ts
2650
- const RULE_NAME$66 = "no-done-callback";
2650
+ const RULE_NAME$67 = "no-done-callback";
2651
2651
  const findCallbackArg = (node, isVitestEach, context) => {
2652
2652
  if (isVitestEach) return node.arguments[1];
2653
2653
  const vitestFnCall = parseVitestFnCall(node, context);
@@ -2656,7 +2656,7 @@ const findCallbackArg = (node, isVitestEach, context) => {
2656
2656
  return null;
2657
2657
  };
2658
2658
  var no_done_callback_default = createEslintRule({
2659
- name: RULE_NAME$66,
2659
+ name: RULE_NAME$67,
2660
2660
  meta: {
2661
2661
  type: "suggestion",
2662
2662
  docs: {
@@ -2740,9 +2740,9 @@ var no_done_callback_default = createEslintRule({
2740
2740
 
2741
2741
  //#endregion
2742
2742
  //#region src/rules/no-duplicate-hooks.ts
2743
- const RULE_NAME$65 = "no-duplicate-hooks";
2743
+ const RULE_NAME$66 = "no-duplicate-hooks";
2744
2744
  var no_duplicate_hooks_default = createEslintRule({
2745
- name: RULE_NAME$65,
2745
+ name: RULE_NAME$66,
2746
2746
  meta: {
2747
2747
  docs: {
2748
2748
  recommended: false,
@@ -2778,9 +2778,9 @@ var no_duplicate_hooks_default = createEslintRule({
2778
2778
 
2779
2779
  //#endregion
2780
2780
  //#region src/rules/no-focused-tests.ts
2781
- const RULE_NAME$64 = "no-focused-tests";
2781
+ const RULE_NAME$65 = "no-focused-tests";
2782
2782
  var no_focused_tests_default = createEslintRule({
2783
- name: RULE_NAME$64,
2783
+ name: RULE_NAME$65,
2784
2784
  meta: {
2785
2785
  type: "problem",
2786
2786
  docs: {
@@ -2821,9 +2821,9 @@ var no_focused_tests_default = createEslintRule({
2821
2821
 
2822
2822
  //#endregion
2823
2823
  //#region src/rules/no-hooks.ts
2824
- const RULE_NAME$63 = "no-hooks";
2824
+ const RULE_NAME$64 = "no-hooks";
2825
2825
  var no_hooks_default = createEslintRule({
2826
- name: RULE_NAME$63,
2826
+ name: RULE_NAME$64,
2827
2827
  meta: {
2828
2828
  type: "suggestion",
2829
2829
  docs: {
@@ -2866,13 +2866,13 @@ var no_hooks_default = createEslintRule({
2866
2866
 
2867
2867
  //#endregion
2868
2868
  //#region src/rules/no-identical-title.ts
2869
- const RULE_NAME$62 = "no-identical-title";
2869
+ const RULE_NAME$63 = "no-identical-title";
2870
2870
  const newDescribeContext = () => ({
2871
2871
  describeTitles: [],
2872
2872
  testTitles: []
2873
2873
  });
2874
2874
  var no_identical_title_default = createEslintRule({
2875
- name: RULE_NAME$62,
2875
+ name: RULE_NAME$63,
2876
2876
  meta: {
2877
2877
  type: "problem",
2878
2878
  docs: {
@@ -2921,9 +2921,9 @@ var no_identical_title_default = createEslintRule({
2921
2921
 
2922
2922
  //#endregion
2923
2923
  //#region src/rules/no-import-node-test.ts
2924
- const RULE_NAME$61 = "no-import-node-test";
2924
+ const RULE_NAME$62 = "no-import-node-test";
2925
2925
  var no_import_node_test_default = createEslintRule({
2926
- name: RULE_NAME$61,
2926
+ name: RULE_NAME$62,
2927
2927
  meta: {
2928
2928
  docs: {
2929
2929
  description: "disallow importing `node:test`",
@@ -3019,9 +3019,9 @@ const removeNodeFromArray = (fixer, nodes, target) => {
3019
3019
 
3020
3020
  //#endregion
3021
3021
  //#region src/rules/no-importing-vitest-globals.ts
3022
- const RULE_NAME$60 = "no-importing-vitest-globals";
3022
+ const RULE_NAME$61 = "no-importing-vitest-globals";
3023
3023
  var no_importing_vitest_globals_default = createEslintRule({
3024
- name: RULE_NAME$60,
3024
+ name: RULE_NAME$61,
3025
3025
  meta: {
3026
3026
  type: "suggestion",
3027
3027
  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$59 = "no-interpolation-in-snapshots";
3079
+ const RULE_NAME$60 = "no-interpolation-in-snapshots";
3080
3080
  var no_interpolation_in_snapshots_default = createEslintRule({
3081
- name: RULE_NAME$59,
3081
+ name: RULE_NAME$60,
3082
3082
  meta: {
3083
3083
  type: "problem",
3084
3084
  docs: {
@@ -3105,7 +3105,7 @@ var no_interpolation_in_snapshots_default = createEslintRule({
3105
3105
 
3106
3106
  //#endregion
3107
3107
  //#region src/rules/no-large-snapshots.ts
3108
- const RULE_NAME$58 = "no-large-snapshots";
3108
+ const RULE_NAME$59 = "no-large-snapshots";
3109
3109
  const reportOnViolation = (context, node, { maxSize: lineLimit = 50, allowedSnapshots = {} }) => {
3110
3110
  const startLine = node.loc.start.line;
3111
3111
  const lineCount = node.loc.end.line - startLine;
@@ -3131,7 +3131,7 @@ const reportOnViolation = (context, node, { maxSize: lineLimit = 50, allowedSnap
3131
3131
  });
3132
3132
  };
3133
3133
  var no_large_snapshots_default = createEslintRule({
3134
- name: RULE_NAME$58,
3134
+ name: RULE_NAME$59,
3135
3135
  meta: {
3136
3136
  docs: {
3137
3137
  description: "disallow large snapshots",
@@ -3183,9 +3183,9 @@ var no_large_snapshots_default = createEslintRule({
3183
3183
  const mocksDirName = "__mocks__";
3184
3184
  const isMockPath = (path) => path.split(node_path.posix.sep).includes(mocksDirName);
3185
3185
  const isMockImportLiteral = (expression) => isStringNode(expression) && isMockPath(getStringValue(expression));
3186
- const RULE_NAME$57 = "no-mocks-import";
3186
+ const RULE_NAME$58 = "no-mocks-import";
3187
3187
  var no_mocks_import_default = createEslintRule({
3188
- name: RULE_NAME$57,
3188
+ name: RULE_NAME$58,
3189
3189
  meta: {
3190
3190
  type: "problem",
3191
3191
  docs: {
@@ -3216,13 +3216,13 @@ var no_mocks_import_default = createEslintRule({
3216
3216
 
3217
3217
  //#endregion
3218
3218
  //#region src/rules/no-restricted-matchers.ts
3219
- const RULE_NAME$56 = "no-restricted-matchers";
3219
+ const RULE_NAME$57 = "no-restricted-matchers";
3220
3220
  const isChainRestricted = (chain, restriction) => {
3221
3221
  if (Object.prototype.hasOwnProperty.call(ModifierName, restriction) || restriction.endsWith(".not")) return chain.startsWith(restriction);
3222
3222
  return chain === restriction;
3223
3223
  };
3224
3224
  var no_restricted_matchers_default = createEslintRule({
3225
- name: RULE_NAME$56,
3225
+ name: RULE_NAME$57,
3226
3226
  meta: {
3227
3227
  docs: {
3228
3228
  description: "disallow the use of certain matchers",
@@ -3265,9 +3265,9 @@ var no_restricted_matchers_default = createEslintRule({
3265
3265
 
3266
3266
  //#endregion
3267
3267
  //#region src/rules/no-restricted-vi-methods.ts
3268
- const RULE_NAME$55 = "no-restricted-vi-methods";
3268
+ const RULE_NAME$56 = "no-restricted-vi-methods";
3269
3269
  var no_restricted_vi_methods_default = createEslintRule({
3270
- name: RULE_NAME$55,
3270
+ name: RULE_NAME$56,
3271
3271
  meta: {
3272
3272
  type: "suggestion",
3273
3273
  docs: {
@@ -3310,7 +3310,7 @@ var no_restricted_vi_methods_default = createEslintRule({
3310
3310
 
3311
3311
  //#endregion
3312
3312
  //#region src/rules/no-standalone-expect.ts
3313
- const RULE_NAME$54 = "no-standalone-expect";
3313
+ const RULE_NAME$55 = "no-standalone-expect";
3314
3314
  const getBlockType = (statement, context) => {
3315
3315
  const func = statement.parent;
3316
3316
  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");
@@ -3323,7 +3323,7 @@ const getBlockType = (statement, context) => {
3323
3323
  return null;
3324
3324
  };
3325
3325
  var no_standalone_expect_default = createEslintRule({
3326
- name: RULE_NAME$54,
3326
+ name: RULE_NAME$55,
3327
3327
  meta: {
3328
3328
  docs: {
3329
3329
  description: "disallow using `expect` outside of `it` or `test` blocks",
@@ -3383,9 +3383,9 @@ var no_standalone_expect_default = createEslintRule({
3383
3383
 
3384
3384
  //#endregion
3385
3385
  //#region src/rules/no-test-prefixes.ts
3386
- const RULE_NAME$53 = "no-test-prefixes";
3386
+ const RULE_NAME$54 = "no-test-prefixes";
3387
3387
  var no_test_prefixes_default = createEslintRule({
3388
- name: RULE_NAME$53,
3388
+ name: RULE_NAME$54,
3389
3389
  meta: {
3390
3390
  docs: {
3391
3391
  description: "disallow using the `f` and `x` prefixes in favour of `.only` and `.skip`",
@@ -3419,14 +3419,14 @@ var no_test_prefixes_default = createEslintRule({
3419
3419
 
3420
3420
  //#endregion
3421
3421
  //#region src/rules/no-test-return-statement.ts
3422
- const RULE_NAME$52 = "no-test-return-statement";
3422
+ const RULE_NAME$53 = "no-test-return-statement";
3423
3423
  const getBody = (args) => {
3424
3424
  const [, secondArg] = args;
3425
3425
  if (secondArg && isFunction(secondArg) && secondArg.body.type === _typescript_eslint_utils.AST_NODE_TYPES.BlockStatement) return secondArg.body.body;
3426
3426
  return [];
3427
3427
  };
3428
3428
  var no_test_return_statement_default = createEslintRule({
3429
- name: RULE_NAME$52,
3429
+ name: RULE_NAME$53,
3430
3430
  meta: {
3431
3431
  type: "problem",
3432
3432
  docs: {
@@ -3460,6 +3460,48 @@ var no_test_return_statement_default = createEslintRule({
3460
3460
  }
3461
3461
  });
3462
3462
 
3463
+ //#endregion
3464
+ //#region src/rules/no-unneeded-async-expect-function.ts
3465
+ const RULE_NAME$52 = "no-unneeded-async-expect-function";
3466
+ const getAwaitedCallExpression = (expression) => {
3467
+ if (!expression.async) return null;
3468
+ if (expression.type === _typescript_eslint_utils.AST_NODE_TYPES.ArrowFunctionExpression && expression.body.type === _typescript_eslint_utils.AST_NODE_TYPES.AwaitExpression && expression.body.argument.type === _typescript_eslint_utils.AST_NODE_TYPES.CallExpression) return expression.body.argument;
3469
+ if (expression.body.type !== _typescript_eslint_utils.AST_NODE_TYPES.BlockStatement || expression.body.body.length !== 1) return null;
3470
+ const [callback] = expression.body.body;
3471
+ if (callback.type === _typescript_eslint_utils.AST_NODE_TYPES.ExpressionStatement && callback.expression.type === _typescript_eslint_utils.AST_NODE_TYPES.AwaitExpression && callback.expression.argument.type === _typescript_eslint_utils.AST_NODE_TYPES.CallExpression) return callback.expression.argument;
3472
+ return null;
3473
+ };
3474
+ var no_unneeded_async_expect_function_default = createEslintRule({
3475
+ name: RULE_NAME$52,
3476
+ meta: {
3477
+ docs: { description: "Disallow unnecessary async function wrapper for expected promises" },
3478
+ fixable: "code",
3479
+ messages: { noAsyncWrapperForExpectedPromise: "Unnecessary async function wrapper" },
3480
+ schema: [],
3481
+ type: "suggestion"
3482
+ },
3483
+ create(context) {
3484
+ return { CallExpression(node) {
3485
+ const vitestFnCall = parseVitestFnCall(node, context);
3486
+ if (vitestFnCall?.type !== "expect") return;
3487
+ const { parent } = vitestFnCall.head.node;
3488
+ if (parent?.type !== _typescript_eslint_utils.AST_NODE_TYPES.CallExpression) return;
3489
+ const [awaitNode] = parent.arguments;
3490
+ if (!awaitNode || !isFunction(awaitNode)) return;
3491
+ const innerAsyncFuncCall = getAwaitedCallExpression(awaitNode);
3492
+ if (!innerAsyncFuncCall) return;
3493
+ context.report({
3494
+ node: awaitNode,
3495
+ messageId: "noAsyncWrapperForExpectedPromise",
3496
+ fix(fixer) {
3497
+ const { sourceCode } = context;
3498
+ return [fixer.replaceTextRange(awaitNode.range, sourceCode.getText(innerAsyncFuncCall))];
3499
+ }
3500
+ });
3501
+ } };
3502
+ }
3503
+ });
3504
+
3463
3505
  //#endregion
3464
3506
  //#region src/utils/ast-utils.ts
3465
3507
  const eslintRequire = (0, node_module.createRequire)((0, node_module.createRequire)(require("url").pathToFileURL(__filename).href).resolve("eslint"));
@@ -5440,11 +5482,46 @@ var prefer_to_contain_default = createEslintRule({
5440
5482
  }
5441
5483
  });
5442
5484
 
5485
+ //#endregion
5486
+ //#region src/rules/prefer-to-have-been-called-times.ts
5487
+ const RULE_NAME$16 = "prefer-to-have-been-called-times";
5488
+ var prefer_to_have_been_called_times_default = createEslintRule({
5489
+ name: RULE_NAME$16,
5490
+ meta: {
5491
+ fixable: "code",
5492
+ docs: { description: "Suggest using `toHaveBeenCalledTimes()`" },
5493
+ messages: { preferMatcher: "Prefer `toHaveBeenCalledTimes`" },
5494
+ type: "suggestion",
5495
+ schema: []
5496
+ },
5497
+ create(context) {
5498
+ return { CallExpression(node) {
5499
+ const vitestFnCall = parseVitestFnCall(node, context);
5500
+ if (vitestFnCall?.type !== "expect") return;
5501
+ const { parent: expect } = vitestFnCall.head.node;
5502
+ if (expect?.type !== _typescript_eslint_utils.AST_NODE_TYPES.CallExpression) return;
5503
+ const { matcher } = vitestFnCall;
5504
+ if (!isSupportedAccessor(matcher, "toHaveLength")) return;
5505
+ const [argument] = expect.arguments;
5506
+ if (argument?.type !== _typescript_eslint_utils.AST_NODE_TYPES.MemberExpression || !isSupportedAccessor(argument.property, "calls")) return;
5507
+ const { object } = argument;
5508
+ if (object.type !== _typescript_eslint_utils.AST_NODE_TYPES.MemberExpression || !isSupportedAccessor(object.property, "mock")) return;
5509
+ context.report({
5510
+ messageId: "preferMatcher",
5511
+ node: matcher,
5512
+ fix(fixer) {
5513
+ return [fixer.removeRange([object.property.range[0] - 1, argument.range[1]]), fixer.replaceTextRange([matcher.parent.object.range[1], matcher.parent.range[1]], ".toHaveBeenCalledTimes")];
5514
+ }
5515
+ });
5516
+ } };
5517
+ }
5518
+ });
5519
+
5443
5520
  //#endregion
5444
5521
  //#region src/rules/prefer-to-have-length.ts
5445
- const RULE_NAME$16 = "prefer-to-have-length";
5522
+ const RULE_NAME$15 = "prefer-to-have-length";
5446
5523
  var prefer_to_have_length_default = createEslintRule({
5447
- name: RULE_NAME$16,
5524
+ name: RULE_NAME$15,
5448
5525
  meta: {
5449
5526
  type: "suggestion",
5450
5527
  docs: {
@@ -5477,7 +5554,7 @@ var prefer_to_have_length_default = createEslintRule({
5477
5554
 
5478
5555
  //#endregion
5479
5556
  //#region src/rules/prefer-todo.ts
5480
- const RULE_NAME$15 = "prefer-todo";
5557
+ const RULE_NAME$14 = "prefer-todo";
5481
5558
  const isTargetedTestCase = (vitestFnCall) => {
5482
5559
  if (vitestFnCall.members.some((s) => getAccessorValue(s) !== "skip")) return false;
5483
5560
  if (vitestFnCall.name.startsWith("x")) return false;
@@ -5492,7 +5569,7 @@ function createTodoFixer(vitestFnCall, fixer) {
5492
5569
  return fixer.replaceText(vitestFnCall.head.node, `${vitestFnCall.head.local}.todo`);
5493
5570
  }
5494
5571
  var prefer_todo_default = createEslintRule({
5495
- name: RULE_NAME$15,
5572
+ name: RULE_NAME$14,
5496
5573
  meta: {
5497
5574
  type: "layout",
5498
5575
  docs: {
@@ -5527,7 +5604,7 @@ var prefer_todo_default = createEslintRule({
5527
5604
 
5528
5605
  //#endregion
5529
5606
  //#region src/rules/prefer-vi-mocked.ts
5530
- const RULE_NAME$14 = "prefer-vi-mocked";
5607
+ const RULE_NAME$13 = "prefer-vi-mocked";
5531
5608
  const mockTypes = [
5532
5609
  "Mock",
5533
5610
  "MockedFunction",
@@ -5535,7 +5612,7 @@ const mockTypes = [
5535
5612
  "MockedObject"
5536
5613
  ];
5537
5614
  var prefer_vi_mocked_default = createEslintRule({
5538
- name: RULE_NAME$14,
5615
+ name: RULE_NAME$13,
5539
5616
  meta: {
5540
5617
  type: "suggestion",
5541
5618
  docs: {
@@ -5577,9 +5654,9 @@ var prefer_vi_mocked_default = createEslintRule({
5577
5654
 
5578
5655
  //#endregion
5579
5656
  //#region src/rules/require-awaited-expect-poll.ts
5580
- const RULE_NAME$13 = "require-awaited-expect-poll";
5657
+ const RULE_NAME$12 = "require-awaited-expect-poll";
5581
5658
  var require_awaited_expect_poll_default = createEslintRule({
5582
- name: RULE_NAME$13,
5659
+ name: RULE_NAME$12,
5583
5660
  meta: {
5584
5661
  docs: {
5585
5662
  requiresTypeChecking: false,
@@ -5625,7 +5702,7 @@ function skipSequenceExpressions(node) {
5625
5702
 
5626
5703
  //#endregion
5627
5704
  //#region src/rules/require-hook.ts
5628
- const RULE_NAME$12 = "require-hook";
5705
+ const RULE_NAME$11 = "require-hook";
5629
5706
  const isVitestFnCall = (node, context) => {
5630
5707
  if (parseVitestFnCall(node, context)) return true;
5631
5708
  return !!getNodeName(node)?.startsWith("vi");
@@ -5644,7 +5721,7 @@ const shouldBeInHook = (node, context, allowedFunctionCalls = []) => {
5644
5721
  }
5645
5722
  };
5646
5723
  var require_hook_default = createEslintRule({
5647
- name: RULE_NAME$12,
5724
+ name: RULE_NAME$11,
5648
5725
  meta: {
5649
5726
  docs: {
5650
5727
  description: "require setup and teardown to be within a hook",
@@ -5684,11 +5761,95 @@ var require_hook_default = createEslintRule({
5684
5761
  }
5685
5762
  });
5686
5763
 
5764
+ //#endregion
5765
+ //#region src/rules/require-local-test-context-for-concurrent-snapshots.ts
5766
+ const RULE_NAME$10 = "require-local-test-context-for-concurrent-snapshots";
5767
+ var require_local_test_context_for_concurrent_snapshots_default = createEslintRule({
5768
+ name: RULE_NAME$10,
5769
+ meta: {
5770
+ docs: {
5771
+ description: "require local Test Context for concurrent snapshot tests",
5772
+ recommended: false
5773
+ },
5774
+ messages: { requireLocalTestContext: "Use local Test Context instead" },
5775
+ type: "problem",
5776
+ schema: []
5777
+ },
5778
+ create(context) {
5779
+ return { CallExpression(node) {
5780
+ const vitestFnCall = parseVitestFnCall(node, context);
5781
+ if (vitestFnCall === null) return;
5782
+ if (vitestFnCall.type !== "expect") return;
5783
+ if (vitestFnCall.type === "expect" && vitestFnCall.head.type === "testContext") return;
5784
+ if (node.callee.type !== _typescript_eslint_utils.AST_NODE_TYPES.MemberExpression) return;
5785
+ if (node.callee.property.type !== _typescript_eslint_utils.AST_NODE_TYPES.Identifier) return;
5786
+ if (![
5787
+ "toMatchSnapshot",
5788
+ "toMatchInlineSnapshot",
5789
+ "toMatchFileSnapshot",
5790
+ "toThrowErrorMatchingSnapshot",
5791
+ "toThrowErrorMatchingInlineSnapshot"
5792
+ ].includes(node.callee.property.name)) return;
5793
+ if (!context.sourceCode.getAncestors(node).some((ancestor) => {
5794
+ if (ancestor.type !== _typescript_eslint_utils.AST_NODE_TYPES.CallExpression) return false;
5795
+ if (!isTypeOfVitestFnCall(ancestor, context, ["describe", "test"])) return false;
5796
+ return ancestor.callee.type === _typescript_eslint_utils.AST_NODE_TYPES.MemberExpression && isSupportedAccessor(ancestor.callee.property, "concurrent");
5797
+ })) return;
5798
+ context.report({
5799
+ node,
5800
+ messageId: "requireLocalTestContext"
5801
+ });
5802
+ } };
5803
+ }
5804
+ });
5805
+
5806
+ //#endregion
5807
+ //#region src/rules/require-mock-type-parameters.ts
5808
+ const RULE_NAME$9 = "require-mock-type-parameters";
5809
+ var require_mock_type_parameters_default = createEslintRule({
5810
+ name: RULE_NAME$9,
5811
+ meta: {
5812
+ type: "suggestion",
5813
+ docs: {
5814
+ description: "enforce using type parameters with vitest mock functions",
5815
+ recommended: false
5816
+ },
5817
+ messages: { noTypeParameter: "Missing type parameters" },
5818
+ fixable: "code",
5819
+ schema: [{
5820
+ type: "object",
5821
+ properties: { checkImportFunctions: {
5822
+ description: "Also require type parameters for `importActual` and `importMock`.",
5823
+ type: "boolean"
5824
+ } },
5825
+ additionalProperties: false
5826
+ }],
5827
+ defaultOptions: [{ checkImportFunctions: false }]
5828
+ },
5829
+ create(context, [options]) {
5830
+ return { CallExpression(node) {
5831
+ const vitestFnCall = parseVitestFnCall(node, context);
5832
+ if (vitestFnCall?.type !== "vi") return;
5833
+ for (const member of vitestFnCall.members) {
5834
+ if (!("name" in member) || member.parent.parent.typeArguments !== void 0) continue;
5835
+ if (member.name === "fn") context.report({
5836
+ node: member,
5837
+ messageId: "noTypeParameter"
5838
+ });
5839
+ if (options.checkImportFunctions && ["importActual", "importMock"].includes(member.name)) context.report({
5840
+ node: member,
5841
+ messageId: "noTypeParameter"
5842
+ });
5843
+ }
5844
+ } };
5845
+ }
5846
+ });
5847
+
5687
5848
  //#endregion
5688
5849
  //#region src/rules/require-test-timeout.ts
5689
- const RULE_NAME$11 = "require-test-timeout";
5850
+ const RULE_NAME$8 = "require-test-timeout";
5690
5851
  var require_test_timeout_default = createEslintRule({
5691
- name: RULE_NAME$11,
5852
+ name: RULE_NAME$8,
5692
5853
  meta: {
5693
5854
  type: "suggestion",
5694
5855
  docs: {
@@ -5772,95 +5933,11 @@ var require_test_timeout_default = createEslintRule({
5772
5933
  }
5773
5934
  });
5774
5935
 
5775
- //#endregion
5776
- //#region src/rules/require-local-test-context-for-concurrent-snapshots.ts
5777
- const RULE_NAME$10 = "require-local-test-context-for-concurrent-snapshots";
5778
- var require_local_test_context_for_concurrent_snapshots_default = createEslintRule({
5779
- name: RULE_NAME$10,
5780
- meta: {
5781
- docs: {
5782
- description: "require local Test Context for concurrent snapshot tests",
5783
- recommended: false
5784
- },
5785
- messages: { requireLocalTestContext: "Use local Test Context instead" },
5786
- type: "problem",
5787
- schema: []
5788
- },
5789
- create(context) {
5790
- return { CallExpression(node) {
5791
- const vitestFnCall = parseVitestFnCall(node, context);
5792
- if (vitestFnCall === null) return;
5793
- if (vitestFnCall.type !== "expect") return;
5794
- if (vitestFnCall.type === "expect" && vitestFnCall.head.type === "testContext") return;
5795
- if (node.callee.type !== _typescript_eslint_utils.AST_NODE_TYPES.MemberExpression) return;
5796
- if (node.callee.property.type !== _typescript_eslint_utils.AST_NODE_TYPES.Identifier) return;
5797
- if (![
5798
- "toMatchSnapshot",
5799
- "toMatchInlineSnapshot",
5800
- "toMatchFileSnapshot",
5801
- "toThrowErrorMatchingSnapshot",
5802
- "toThrowErrorMatchingInlineSnapshot"
5803
- ].includes(node.callee.property.name)) return;
5804
- if (!context.sourceCode.getAncestors(node).some((ancestor) => {
5805
- if (ancestor.type !== _typescript_eslint_utils.AST_NODE_TYPES.CallExpression) return false;
5806
- if (!isTypeOfVitestFnCall(ancestor, context, ["describe", "test"])) return false;
5807
- return ancestor.callee.type === _typescript_eslint_utils.AST_NODE_TYPES.MemberExpression && isSupportedAccessor(ancestor.callee.property, "concurrent");
5808
- })) return;
5809
- context.report({
5810
- node,
5811
- messageId: "requireLocalTestContext"
5812
- });
5813
- } };
5814
- }
5815
- });
5816
-
5817
- //#endregion
5818
- //#region src/rules/require-mock-type-parameters.ts
5819
- const RULE_NAME$9 = "require-mock-type-parameters";
5820
- var require_mock_type_parameters_default = createEslintRule({
5821
- name: RULE_NAME$9,
5822
- meta: {
5823
- type: "suggestion",
5824
- docs: {
5825
- description: "enforce using type parameters with vitest mock functions",
5826
- recommended: false
5827
- },
5828
- messages: { noTypeParameter: "Missing type parameters" },
5829
- fixable: "code",
5830
- schema: [{
5831
- type: "object",
5832
- properties: { checkImportFunctions: {
5833
- description: "Also require type parameters for `importActual` and `importMock`.",
5834
- type: "boolean"
5835
- } },
5836
- additionalProperties: false
5837
- }],
5838
- defaultOptions: [{ checkImportFunctions: false }]
5839
- },
5840
- create(context, [options]) {
5841
- return { CallExpression(node) {
5842
- const vitestFnCall = parseVitestFnCall(node, context);
5843
- if (vitestFnCall?.type !== "vi") return;
5844
- for (const member of vitestFnCall.members) {
5845
- if (!("name" in member) || member.parent.parent.typeArguments !== void 0) continue;
5846
- if (member.name === "fn") context.report({
5847
- node: member,
5848
- messageId: "noTypeParameter"
5849
- });
5850
- if (options.checkImportFunctions && ["importActual", "importMock"].includes(member.name)) context.report({
5851
- node: member,
5852
- messageId: "noTypeParameter"
5853
- });
5854
- }
5855
- } };
5856
- }
5857
- });
5858
-
5859
5936
  //#endregion
5860
5937
  //#region src/rules/require-to-throw-message.ts
5861
- const RULE_NAME$8 = "require-to-throw-message";
5938
+ const RULE_NAME$7 = "require-to-throw-message";
5862
5939
  var require_to_throw_message_default = createEslintRule({
5863
- name: RULE_NAME$8,
5940
+ name: RULE_NAME$7,
5864
5941
  meta: {
5865
5942
  type: "suggestion",
5866
5943
  docs: {
@@ -5887,9 +5964,9 @@ var require_to_throw_message_default = createEslintRule({
5887
5964
 
5888
5965
  //#endregion
5889
5966
  //#region src/rules/require-top-level-describe.ts
5890
- const RULE_NAME$7 = "require-top-level-describe";
5967
+ const RULE_NAME$6 = "require-top-level-describe";
5891
5968
  var require_top_level_describe_default = createEslintRule({
5892
- name: RULE_NAME$7,
5969
+ name: RULE_NAME$6,
5893
5970
  meta: {
5894
5971
  docs: {
5895
5972
  description: "enforce that all tests are in a top-level describe",
@@ -5956,9 +6033,74 @@ var require_top_level_describe_default = createEslintRule({
5956
6033
  }
5957
6034
  });
5958
6035
 
6036
+ //#endregion
6037
+ //#region src/rules/unbound-method.ts
6038
+ const require$2 = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
6039
+ const RULE_NAME$5 = "unbound-method";
6040
+ const toThrowMatchers = [
6041
+ "toThrow",
6042
+ "toThrowError",
6043
+ "toThrowErrorMatchingSnapshot",
6044
+ "toThrowErrorMatchingInlineSnapshot"
6045
+ ];
6046
+ const DEFAULT_MESSAGE = "This rule requires `@typescript-eslint/eslint-plugin`";
6047
+ const baseRule = (() => {
6048
+ try {
6049
+ return require$2("@typescript-eslint/eslint-plugin").rules["unbound-method"];
6050
+ } catch (error) {
6051
+ const errorCode = typeof error === "object" && error !== null && "code" in error ? error.code : void 0;
6052
+ if (errorCode === "MODULE_NOT_FOUND" || errorCode === "ERR_REQUIRE_ESM") return null;
6053
+ throw error;
6054
+ }
6055
+ })();
6056
+ var unbound_method_default = createEslintRule({
6057
+ name: RULE_NAME$5,
6058
+ meta: {
6059
+ messages: {
6060
+ unbound: DEFAULT_MESSAGE,
6061
+ unboundWithoutThisAnnotation: DEFAULT_MESSAGE
6062
+ },
6063
+ schema: [{
6064
+ type: "object",
6065
+ properties: { ignoreStatic: {
6066
+ description: "Ignore unbound warnings for static methods.",
6067
+ type: "boolean"
6068
+ } },
6069
+ additionalProperties: false
6070
+ }],
6071
+ type: "problem",
6072
+ ...baseRule?.meta,
6073
+ docs: {
6074
+ ...baseRule?.meta.docs,
6075
+ description: "enforce unbound methods are called with their expected scope",
6076
+ recommended: false,
6077
+ requiresTypeChecking: true
6078
+ },
6079
+ defaultOptions: [{ ignoreStatic: false }]
6080
+ },
6081
+ create(context) {
6082
+ const baseSelectors = baseRule?.create(context);
6083
+ if (!baseSelectors) return {};
6084
+ return {
6085
+ ...baseSelectors,
6086
+ MemberExpression(node) {
6087
+ if (node.parent?.type === _typescript_eslint_utils.AST_NODE_TYPES.CallExpression) {
6088
+ const vitestFnCall = parseVitestFnCall(findTopMostCallExpression(node.parent), context);
6089
+ if (vitestFnCall?.type === "vi" && vitestFnCall.members.length >= 1 && isIdentifier(vitestFnCall.members[0], "mocked")) return;
6090
+ if (vitestFnCall?.type === "expect") {
6091
+ const { matcher } = vitestFnCall;
6092
+ if (!toThrowMatchers.includes(getAccessorValue(matcher))) return;
6093
+ }
6094
+ }
6095
+ baseSelectors?.MemberExpression?.(node);
6096
+ }
6097
+ };
6098
+ }
6099
+ });
6100
+
5959
6101
  //#endregion
5960
6102
  //#region src/rules/valid-describe-callback.ts
5961
- const RULE_NAME$6 = "valid-describe-callback";
6103
+ const RULE_NAME$4 = "valid-describe-callback";
5962
6104
  const paramsLocation = (params) => {
5963
6105
  const [first] = params;
5964
6106
  const last = params[params.length - 1];
@@ -5980,7 +6122,7 @@ const reportUnexpectedReturnInDescribe = (blockStatement, context) => {
5980
6122
  });
5981
6123
  };
5982
6124
  var valid_describe_callback_default = createEslintRule({
5983
- name: RULE_NAME$6,
6125
+ name: RULE_NAME$4,
5984
6126
  meta: {
5985
6127
  type: "problem",
5986
6128
  docs: {
@@ -6046,7 +6188,7 @@ var valid_describe_callback_default = createEslintRule({
6046
6188
 
6047
6189
  //#endregion
6048
6190
  //#region src/rules/valid-expect-in-promise.ts
6049
- const RULE_NAME$5 = "valid-expect-in-promise";
6191
+ const RULE_NAME$3 = "valid-expect-in-promise";
6050
6192
  const isPromiseChainCall = (node) => {
6051
6193
  if (node.type === _typescript_eslint_utils.AST_NODE_TYPES.CallExpression && node.callee.type === _typescript_eslint_utils.AST_NODE_TYPES.MemberExpression && isSupportedAccessor(node.callee.property)) {
6052
6194
  if (node.arguments.length === 0) return false;
@@ -6177,7 +6319,7 @@ const isVariableAwaitedOrReturned = (variable, context) => {
6177
6319
  return isValueAwaitedOrReturned(variable.id, body, context);
6178
6320
  };
6179
6321
  var valid_expect_in_promise_default = createEslintRule({
6180
- name: RULE_NAME$5,
6322
+ name: RULE_NAME$3,
6181
6323
  meta: {
6182
6324
  docs: { description: "require promises that have expectations in their chain to be valid" },
6183
6325
  messages: { expectInFloatingPromise: "This promise should either be returned or awaited to ensure the expects in its chain are called" },
@@ -6231,7 +6373,7 @@ var valid_expect_in_promise_default = createEslintRule({
6231
6373
 
6232
6374
  //#endregion
6233
6375
  //#region src/rules/valid-expect.ts
6234
- const RULE_NAME$4 = "valid-expect";
6376
+ const RULE_NAME$2 = "valid-expect";
6235
6377
  const defaultAsyncMatchers = ["toReject", "toResolve"];
6236
6378
  /**
6237
6379
  * Async assertions might be called in Promise
@@ -6266,7 +6408,7 @@ const isAcceptableReturnNode = (node, allowReturn) => {
6266
6408
  return [_typescript_eslint_utils.AST_NODE_TYPES.ArrowFunctionExpression, _typescript_eslint_utils.AST_NODE_TYPES.AwaitExpression].includes(node.type);
6267
6409
  };
6268
6410
  var valid_expect_default = createEslintRule({
6269
- name: RULE_NAME$4,
6411
+ name: RULE_NAME$2,
6270
6412
  meta: {
6271
6413
  docs: {
6272
6414
  description: "enforce valid `expect()` usage",
@@ -6466,7 +6608,7 @@ const require$1 = (0, node_module.createRequire)(require("url").pathToFileURL(__
6466
6608
 
6467
6609
  //#endregion
6468
6610
  //#region src/rules/valid-title.ts
6469
- const RULE_NAME$3 = "valid-title";
6611
+ const RULE_NAME$1 = "valid-title";
6470
6612
  const trimFXPrefix = (word) => ["f", "x"].includes(word.charAt(0)) ? word.substring(1) : word;
6471
6613
  const quoteStringValue = (node) => node.type === _typescript_eslint_utils.AST_NODE_TYPES.TemplateLiteral ? `\`${node.quasis[0].value.raw}\`` : node.raw;
6472
6614
  const MatcherAndMessageSchema = {
@@ -6505,7 +6647,7 @@ const doesBinaryExpressionContainStringNode = (binaryExp) => {
6505
6647
  return isStringNode(binaryExp.left);
6506
6648
  };
6507
6649
  var valid_title_default = createEslintRule({
6508
- name: RULE_NAME$3,
6650
+ name: RULE_NAME$1,
6509
6651
  meta: {
6510
6652
  docs: {
6511
6653
  description: "enforce valid titles",
@@ -6659,9 +6801,9 @@ var valid_title_default = createEslintRule({
6659
6801
 
6660
6802
  //#endregion
6661
6803
  //#region src/rules/warn-todo.ts
6662
- const RULE_NAME$2 = "warn-todo";
6804
+ const RULE_NAME = "warn-todo";
6663
6805
  var warn_todo_default = createEslintRule({
6664
- name: RULE_NAME$2,
6806
+ name: RULE_NAME,
6665
6807
  meta: {
6666
6808
  docs: {
6667
6809
  description: "disallow `.todo` usage",
@@ -6685,83 +6827,6 @@ var warn_todo_default = createEslintRule({
6685
6827
  }
6686
6828
  });
6687
6829
 
6688
- //#endregion
6689
- //#region src/rules/no-unneeded-async-expect-function.ts
6690
- const RULE_NAME$1 = "no-unneeded-async-expect-function";
6691
- const getAwaitedCallExpression = (expression) => {
6692
- if (!expression.async) return null;
6693
- if (expression.type === _typescript_eslint_utils.AST_NODE_TYPES.ArrowFunctionExpression && expression.body.type === _typescript_eslint_utils.AST_NODE_TYPES.AwaitExpression && expression.body.argument.type === _typescript_eslint_utils.AST_NODE_TYPES.CallExpression) return expression.body.argument;
6694
- if (expression.body.type !== _typescript_eslint_utils.AST_NODE_TYPES.BlockStatement || expression.body.body.length !== 1) return null;
6695
- const [callback] = expression.body.body;
6696
- if (callback.type === _typescript_eslint_utils.AST_NODE_TYPES.ExpressionStatement && callback.expression.type === _typescript_eslint_utils.AST_NODE_TYPES.AwaitExpression && callback.expression.argument.type === _typescript_eslint_utils.AST_NODE_TYPES.CallExpression) return callback.expression.argument;
6697
- return null;
6698
- };
6699
- var no_unneeded_async_expect_function_default = createEslintRule({
6700
- name: RULE_NAME$1,
6701
- meta: {
6702
- docs: { description: "Disallow unnecessary async function wrapper for expected promises" },
6703
- fixable: "code",
6704
- messages: { noAsyncWrapperForExpectedPromise: "Unnecessary async function wrapper" },
6705
- schema: [],
6706
- type: "suggestion"
6707
- },
6708
- create(context) {
6709
- return { CallExpression(node) {
6710
- const vitestFnCall = parseVitestFnCall(node, context);
6711
- if (vitestFnCall?.type !== "expect") return;
6712
- const { parent } = vitestFnCall.head.node;
6713
- if (parent?.type !== _typescript_eslint_utils.AST_NODE_TYPES.CallExpression) return;
6714
- const [awaitNode] = parent.arguments;
6715
- if (!awaitNode || !isFunction(awaitNode)) return;
6716
- const innerAsyncFuncCall = getAwaitedCallExpression(awaitNode);
6717
- if (!innerAsyncFuncCall) return;
6718
- context.report({
6719
- node: awaitNode,
6720
- messageId: "noAsyncWrapperForExpectedPromise",
6721
- fix(fixer) {
6722
- const { sourceCode } = context;
6723
- return [fixer.replaceTextRange(awaitNode.range, sourceCode.getText(innerAsyncFuncCall))];
6724
- }
6725
- });
6726
- } };
6727
- }
6728
- });
6729
-
6730
- //#endregion
6731
- //#region src/rules/prefer-to-have-been-called-times.ts
6732
- const RULE_NAME = "prefer-to-have-been-called-times";
6733
- var prefer_to_have_been_called_times_default = createEslintRule({
6734
- name: RULE_NAME,
6735
- meta: {
6736
- fixable: "code",
6737
- docs: { description: "Suggest using `toHaveBeenCalledTimes()`" },
6738
- messages: { preferMatcher: "Prefer `toHaveBeenCalledTimes`" },
6739
- type: "suggestion",
6740
- schema: []
6741
- },
6742
- create(context) {
6743
- return { CallExpression(node) {
6744
- const vitestFnCall = parseVitestFnCall(node, context);
6745
- if (vitestFnCall?.type !== "expect") return;
6746
- const { parent: expect } = vitestFnCall.head.node;
6747
- if (expect?.type !== _typescript_eslint_utils.AST_NODE_TYPES.CallExpression) return;
6748
- const { matcher } = vitestFnCall;
6749
- if (!isSupportedAccessor(matcher, "toHaveLength")) return;
6750
- const [argument] = expect.arguments;
6751
- if (argument?.type !== _typescript_eslint_utils.AST_NODE_TYPES.MemberExpression || !isSupportedAccessor(argument.property, "calls")) return;
6752
- const { object } = argument;
6753
- if (object.type !== _typescript_eslint_utils.AST_NODE_TYPES.MemberExpression || !isSupportedAccessor(object.property, "mock")) return;
6754
- context.report({
6755
- messageId: "preferMatcher",
6756
- node: matcher,
6757
- fix(fixer) {
6758
- return [fixer.removeRange([object.property.range[0] - 1, argument.range[1]]), fixer.replaceTextRange([matcher.parent.object.range[1], matcher.parent.range[1]], ".toHaveBeenCalledTimes")];
6759
- }
6760
- });
6761
- } };
6762
- }
6763
- });
6764
-
6765
6830
  //#endregion
6766
6831
  //#region src/rules/index.ts
6767
6832
  const rules = {
@@ -6836,11 +6901,12 @@ const rules = {
6836
6901
  "prefer-vi-mocked": prefer_vi_mocked_default,
6837
6902
  "require-awaited-expect-poll": require_awaited_expect_poll_default,
6838
6903
  "require-hook": require_hook_default,
6839
- "require-test-timeout": require_test_timeout_default,
6840
6904
  "require-local-test-context-for-concurrent-snapshots": require_local_test_context_for_concurrent_snapshots_default,
6841
6905
  "require-mock-type-parameters": require_mock_type_parameters_default,
6906
+ "require-test-timeout": require_test_timeout_default,
6842
6907
  "require-to-throw-message": require_to_throw_message_default,
6843
6908
  "require-top-level-describe": require_top_level_describe_default,
6909
+ "unbound-method": unbound_method_default,
6844
6910
  "valid-describe-callback": valid_describe_callback_default,
6845
6911
  "valid-expect-in-promise": valid_expect_in_promise_default,
6846
6912
  "valid-expect": valid_expect_default,
@@ -6866,9 +6932,9 @@ const createConfigLegacy = (rules) => ({
6866
6932
  }, {})
6867
6933
  });
6868
6934
  const allRules = {
6935
+ "consistent-each-for": "warn",
6869
6936
  "consistent-test-filename": "warn",
6870
6937
  "consistent-test-it": "warn",
6871
- "consistent-each-for": "warn",
6872
6938
  "consistent-vitest-vi": "warn",
6873
6939
  "expect-expect": "warn",
6874
6940
  "hoisted-apis-on-top": "warn",
@@ -6933,24 +6999,25 @@ const allRules = {
6933
6999
  "prefer-to-have-length": "warn",
6934
7000
  "prefer-todo": "warn",
6935
7001
  "prefer-vi-mocked": "warn",
7002
+ "require-awaited-expect-poll": "warn",
6936
7003
  "require-hook": "warn",
6937
7004
  "require-local-test-context-for-concurrent-snapshots": "warn",
6938
7005
  "require-mock-type-parameters": "warn",
7006
+ "require-test-timeout": "off",
6939
7007
  "require-to-throw-message": "warn",
6940
7008
  "require-top-level-describe": "warn",
7009
+ "unbound-method": "warn",
6941
7010
  "valid-describe-callback": "warn",
6942
7011
  "valid-expect-in-promise": "warn",
6943
7012
  "valid-expect": "warn",
6944
- "valid-title": "warn",
6945
- "require-awaited-expect-poll": "warn",
6946
- "require-test-timeout": "off"
7013
+ "valid-title": "warn"
6947
7014
  };
6948
7015
  const recommendedRules = {
6949
7016
  "expect-expect": "error",
7017
+ "no-commented-out-tests": "error",
6950
7018
  "no-conditional-expect": "error",
6951
7019
  "no-disabled-tests": "warn",
6952
7020
  "no-focused-tests": "error",
6953
- "no-commented-out-tests": "error",
6954
7021
  "no-identical-title": "error",
6955
7022
  "no-import-node-test": "error",
6956
7023
  "no-interpolation-in-snapshots": "error",