@vitest/eslint-plugin 1.6.3 → 1.6.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/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.6.3";
7
+ var version = "1.6.4";
8
8
 
9
9
  //#endregion
10
10
  //#region src/utils/index.ts
@@ -1787,7 +1787,7 @@ const followTypeAssertionChain$1 = (expression) => isTypeCastExpression$1(expres
1787
1787
 
1788
1788
  //#endregion
1789
1789
  //#region src/rules/consistent-each-for.ts
1790
- const RULE_NAME$77 = "consistent-each-for";
1790
+ const RULE_NAME$78 = "consistent-each-for";
1791
1791
  const BASE_FN_NAMES = [
1792
1792
  "test",
1793
1793
  "it",
@@ -1795,7 +1795,7 @@ const BASE_FN_NAMES = [
1795
1795
  "suite"
1796
1796
  ];
1797
1797
  var consistent_each_for_default = createEslintRule({
1798
- name: RULE_NAME$77,
1798
+ name: RULE_NAME$78,
1799
1799
  meta: {
1800
1800
  type: "suggestion",
1801
1801
  docs: {
@@ -1855,11 +1855,11 @@ var consistent_each_for_default = createEslintRule({
1855
1855
 
1856
1856
  //#endregion
1857
1857
  //#region src/rules/consistent-test-filename.ts
1858
- const RULE_NAME$76 = "consistent-test-filename";
1858
+ const RULE_NAME$77 = "consistent-test-filename";
1859
1859
  const defaultPattern = /.*\.test\.[tj]sx?$/;
1860
1860
  const defaultTestsPattern = /.*\.(test|spec)\.[tj]sx?$/;
1861
1861
  var consistent_test_filename_default = createEslintRule({
1862
- name: RULE_NAME$76,
1862
+ name: RULE_NAME$77,
1863
1863
  meta: {
1864
1864
  type: "problem",
1865
1865
  docs: {
@@ -1907,7 +1907,7 @@ var consistent_test_filename_default = createEslintRule({
1907
1907
 
1908
1908
  //#endregion
1909
1909
  //#region src/rules/consistent-test-it.ts
1910
- const RULE_NAME$75 = "consistent-test-it";
1910
+ const RULE_NAME$76 = "consistent-test-it";
1911
1911
  const buildFixer = (callee, nodeName, preferredTestKeyword) => (fixer) => [fixer.replaceText(callee.type === AST_NODE_TYPES.MemberExpression ? callee.object : callee, getPreferredNodeName(nodeName, preferredTestKeyword))];
1912
1912
  function getPreferredNodeName(nodeName, preferredTestKeyword) {
1913
1913
  if (nodeName === TestCaseName.fit) return "test.only";
@@ -1918,7 +1918,7 @@ function getOppositeTestKeyword(test) {
1918
1918
  return TestCaseName.test;
1919
1919
  }
1920
1920
  var consistent_test_it_default = createEslintRule({
1921
- name: RULE_NAME$75,
1921
+ name: RULE_NAME$76,
1922
1922
  meta: {
1923
1923
  type: "suggestion",
1924
1924
  fixable: "code",
@@ -2027,10 +2027,10 @@ var consistent_test_it_default = createEslintRule({
2027
2027
 
2028
2028
  //#endregion
2029
2029
  //#region src/rules/consistent-vitest-vi.ts
2030
- const RULE_NAME$74 = "consistent-vitest-vi";
2030
+ const RULE_NAME$75 = "consistent-vitest-vi";
2031
2031
  const getOppositeVitestUtilKeyword = (util) => util === UtilName.vi ? UtilName.vitest : UtilName.vi;
2032
2032
  var consistent_vitest_vi_default = createEslintRule({
2033
- name: RULE_NAME$74,
2033
+ name: RULE_NAME$75,
2034
2034
  meta: {
2035
2035
  type: "suggestion",
2036
2036
  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$73 = "expect-expect";
2113
+ const RULE_NAME$74 = "expect-expect";
2114
2114
  var expect_expect_default = createEslintRule({
2115
- name: RULE_NAME$73,
2115
+ name: RULE_NAME$74,
2116
2116
  meta: {
2117
2117
  type: "suggestion",
2118
2118
  docs: {
@@ -2188,14 +2188,14 @@ function buildPatternRegexp(pattern) {
2188
2188
 
2189
2189
  //#endregion
2190
2190
  //#region src/rules/hoisted-apis-on-top.ts
2191
- const RULE_NAME$72 = "hoisted-apis-on-top";
2191
+ const RULE_NAME$73 = "hoisted-apis-on-top";
2192
2192
  const hoistedAPIs = [
2193
2193
  "mock",
2194
2194
  "hoisted",
2195
2195
  "unmock"
2196
2196
  ];
2197
2197
  var hoisted_apis_on_top_default = createEslintRule({
2198
- name: RULE_NAME$72,
2198
+ name: RULE_NAME$73,
2199
2199
  meta: {
2200
2200
  hasSuggestions: true,
2201
2201
  type: "suggestion",
@@ -2262,9 +2262,9 @@ var hoisted_apis_on_top_default = createEslintRule({
2262
2262
 
2263
2263
  //#endregion
2264
2264
  //#region src/rules/max-expects.ts
2265
- const RULE_NAME$71 = "max-expects";
2265
+ const RULE_NAME$72 = "max-expects";
2266
2266
  var max_expects_default = createEslintRule({
2267
- name: RULE_NAME$71,
2267
+ name: RULE_NAME$72,
2268
2268
  meta: {
2269
2269
  docs: {
2270
2270
  requiresTypeChecking: false,
@@ -2309,9 +2309,9 @@ var max_expects_default = createEslintRule({
2309
2309
 
2310
2310
  //#endregion
2311
2311
  //#region src/rules/max-nested-describe.ts
2312
- const RULE_NAME$70 = "max-nested-describe";
2312
+ const RULE_NAME$71 = "max-nested-describe";
2313
2313
  var max_nested_describe_default = createEslintRule({
2314
- name: RULE_NAME$70,
2314
+ name: RULE_NAME$71,
2315
2315
  meta: {
2316
2316
  type: "problem",
2317
2317
  docs: {
@@ -2353,9 +2353,9 @@ var max_nested_describe_default = createEslintRule({
2353
2353
 
2354
2354
  //#endregion
2355
2355
  //#region src/rules/no-alias-methods.ts
2356
- const RULE_NAME$69 = "no-alias-methods";
2356
+ const RULE_NAME$70 = "no-alias-methods";
2357
2357
  var no_alias_methods_default = createEslintRule({
2358
- name: RULE_NAME$69,
2358
+ name: RULE_NAME$70,
2359
2359
  meta: {
2360
2360
  docs: {
2361
2361
  description: "disallow alias methods",
@@ -2405,12 +2405,12 @@ var no_alias_methods_default = createEslintRule({
2405
2405
 
2406
2406
  //#endregion
2407
2407
  //#region src/rules/no-commented-out-tests.ts
2408
- const RULE_NAME$68 = "no-commented-out-tests";
2408
+ const RULE_NAME$69 = "no-commented-out-tests";
2409
2409
  function hasTests(node) {
2410
2410
  return /^\s*[xf]?(test|it|describe)(\.\w+|\[['"]\w+['"]\])?\s*\(/mu.test(node.value);
2411
2411
  }
2412
2412
  var no_commented_out_tests_default = createEslintRule({
2413
- name: RULE_NAME$68,
2413
+ name: RULE_NAME$69,
2414
2414
  meta: {
2415
2415
  docs: {
2416
2416
  description: "disallow commented out tests",
@@ -2439,10 +2439,10 @@ var no_commented_out_tests_default = createEslintRule({
2439
2439
 
2440
2440
  //#endregion
2441
2441
  //#region src/rules/no-conditional-expect.ts
2442
- const RULE_NAME$67 = "no-conditional-expect";
2442
+ const RULE_NAME$68 = "no-conditional-expect";
2443
2443
  const isCatchCall = (node) => node.callee.type === AST_NODE_TYPES.MemberExpression && isSupportedAccessor(node.callee.property, "catch");
2444
2444
  var no_conditional_expect_default = createEslintRule({
2445
- name: RULE_NAME$67,
2445
+ name: RULE_NAME$68,
2446
2446
  meta: {
2447
2447
  type: "problem",
2448
2448
  docs: {
@@ -2497,9 +2497,9 @@ var no_conditional_expect_default = createEslintRule({
2497
2497
 
2498
2498
  //#endregion
2499
2499
  //#region src/rules/no-conditional-in-test.ts
2500
- const RULE_NAME$66 = "no-conditional-in-test";
2500
+ const RULE_NAME$67 = "no-conditional-in-test";
2501
2501
  var no_conditional_in_test_default = createEslintRule({
2502
- name: RULE_NAME$66,
2502
+ name: RULE_NAME$67,
2503
2503
  meta: {
2504
2504
  docs: {
2505
2505
  description: "disallow conditional tests",
@@ -2523,9 +2523,9 @@ var no_conditional_in_test_default = createEslintRule({
2523
2523
 
2524
2524
  //#endregion
2525
2525
  //#region src/rules/no-conditional-tests.ts
2526
- const RULE_NAME$65 = "no-conditional-tests";
2526
+ const RULE_NAME$66 = "no-conditional-tests";
2527
2527
  var no_conditional_tests_default = createEslintRule({
2528
- name: RULE_NAME$65,
2528
+ name: RULE_NAME$66,
2529
2529
  meta: {
2530
2530
  type: "problem",
2531
2531
  docs: {
@@ -2554,9 +2554,9 @@ var no_conditional_tests_default = createEslintRule({
2554
2554
 
2555
2555
  //#endregion
2556
2556
  //#region src/rules/no-disabled-tests.ts
2557
- const RULE_NAME$64 = "no-disabled-tests";
2557
+ const RULE_NAME$65 = "no-disabled-tests";
2558
2558
  var no_disabled_tests_default = createEslintRule({
2559
- name: RULE_NAME$64,
2559
+ name: RULE_NAME$65,
2560
2560
  meta: {
2561
2561
  type: "suggestion",
2562
2562
  docs: {
@@ -2622,7 +2622,7 @@ var no_disabled_tests_default = createEslintRule({
2622
2622
 
2623
2623
  //#endregion
2624
2624
  //#region src/rules/no-done-callback.ts
2625
- const RULE_NAME$63 = "no-done-callback";
2625
+ const RULE_NAME$64 = "no-done-callback";
2626
2626
  const findCallbackArg = (node, isVitestEach, context) => {
2627
2627
  if (isVitestEach) return node.arguments[1];
2628
2628
  const vitestFnCall = parseVitestFnCall(node, context);
@@ -2631,7 +2631,7 @@ const findCallbackArg = (node, isVitestEach, context) => {
2631
2631
  return null;
2632
2632
  };
2633
2633
  var no_done_callback_default = createEslintRule({
2634
- name: RULE_NAME$63,
2634
+ name: RULE_NAME$64,
2635
2635
  meta: {
2636
2636
  type: "suggestion",
2637
2637
  docs: {
@@ -2716,9 +2716,9 @@ var no_done_callback_default = createEslintRule({
2716
2716
 
2717
2717
  //#endregion
2718
2718
  //#region src/rules/no-duplicate-hooks.ts
2719
- const RULE_NAME$62 = "no-duplicate-hooks";
2719
+ const RULE_NAME$63 = "no-duplicate-hooks";
2720
2720
  var no_duplicate_hooks_default = createEslintRule({
2721
- name: RULE_NAME$62,
2721
+ name: RULE_NAME$63,
2722
2722
  meta: {
2723
2723
  docs: {
2724
2724
  recommended: false,
@@ -2755,7 +2755,7 @@ var no_duplicate_hooks_default = createEslintRule({
2755
2755
 
2756
2756
  //#endregion
2757
2757
  //#region src/rules/no-focused-tests.ts
2758
- const RULE_NAME$61 = "no-focused-tests";
2758
+ const RULE_NAME$62 = "no-focused-tests";
2759
2759
  const isTestOrDescribe = (node) => {
2760
2760
  return node.type === "Identifier" && [
2761
2761
  "it",
@@ -2767,7 +2767,7 @@ const isOnly = (node) => {
2767
2767
  return node.type === "Identifier" && node.name === "only";
2768
2768
  };
2769
2769
  var no_focused_tests_default = createEslintRule({
2770
- name: RULE_NAME$61,
2770
+ name: RULE_NAME$62,
2771
2771
  meta: {
2772
2772
  type: "problem",
2773
2773
  docs: {
@@ -2827,9 +2827,9 @@ var no_focused_tests_default = createEslintRule({
2827
2827
 
2828
2828
  //#endregion
2829
2829
  //#region src/rules/no-hooks.ts
2830
- const RULE_NAME$60 = "no-hooks";
2830
+ const RULE_NAME$61 = "no-hooks";
2831
2831
  var no_hooks_default = createEslintRule({
2832
- name: RULE_NAME$60,
2832
+ name: RULE_NAME$61,
2833
2833
  meta: {
2834
2834
  type: "suggestion",
2835
2835
  docs: {
@@ -2872,13 +2872,13 @@ var no_hooks_default = createEslintRule({
2872
2872
 
2873
2873
  //#endregion
2874
2874
  //#region src/rules/no-identical-title.ts
2875
- const RULE_NAME$59 = "no-identical-title";
2875
+ const RULE_NAME$60 = "no-identical-title";
2876
2876
  const newDescribeContext = () => ({
2877
2877
  describeTitles: [],
2878
2878
  testTitles: []
2879
2879
  });
2880
2880
  var no_identical_title_default = createEslintRule({
2881
- name: RULE_NAME$59,
2881
+ name: RULE_NAME$60,
2882
2882
  meta: {
2883
2883
  type: "problem",
2884
2884
  docs: {
@@ -2928,9 +2928,9 @@ var no_identical_title_default = createEslintRule({
2928
2928
 
2929
2929
  //#endregion
2930
2930
  //#region src/rules/no-import-node-test.ts
2931
- const RULE_NAME$58 = "no-import-node-test";
2931
+ const RULE_NAME$59 = "no-import-node-test";
2932
2932
  var no_import_node_test_default = createEslintRule({
2933
- name: RULE_NAME$58,
2933
+ name: RULE_NAME$59,
2934
2934
  meta: {
2935
2935
  docs: {
2936
2936
  description: "disallow importing `node:test`",
@@ -3027,9 +3027,9 @@ const removeNodeFromArray = (fixer, nodes, target) => {
3027
3027
 
3028
3028
  //#endregion
3029
3029
  //#region src/rules/no-importing-vitest-globals.ts
3030
- const RULE_NAME$57 = "no-importing-vitest-globals";
3030
+ const RULE_NAME$58 = "no-importing-vitest-globals";
3031
3031
  var no_importing_vitest_globals_default = createEslintRule({
3032
- name: RULE_NAME$57,
3032
+ name: RULE_NAME$58,
3033
3033
  meta: {
3034
3034
  type: "suggestion",
3035
3035
  docs: {
@@ -3085,9 +3085,9 @@ var no_importing_vitest_globals_default = createEslintRule({
3085
3085
 
3086
3086
  //#endregion
3087
3087
  //#region src/rules/no-interpolation-in-snapshots.ts
3088
- const RULE_NAME$56 = "no-interpolation-in-snapshots";
3088
+ const RULE_NAME$57 = "no-interpolation-in-snapshots";
3089
3089
  var no_interpolation_in_snapshots_default = createEslintRule({
3090
- name: RULE_NAME$56,
3090
+ name: RULE_NAME$57,
3091
3091
  meta: {
3092
3092
  type: "problem",
3093
3093
  docs: {
@@ -3115,7 +3115,7 @@ var no_interpolation_in_snapshots_default = createEslintRule({
3115
3115
 
3116
3116
  //#endregion
3117
3117
  //#region src/rules/no-large-snapshots.ts
3118
- const RULE_NAME$55 = "no-large-snapshots";
3118
+ const RULE_NAME$56 = "no-large-snapshots";
3119
3119
  const reportOnViolation = (context, node, { maxSize: lineLimit = 50, allowedSnapshots = {} }) => {
3120
3120
  const startLine = node.loc.start.line;
3121
3121
  const lineCount = node.loc.end.line - startLine;
@@ -3141,7 +3141,7 @@ const reportOnViolation = (context, node, { maxSize: lineLimit = 50, allowedSnap
3141
3141
  });
3142
3142
  };
3143
3143
  var no_large_snapshots_default = createEslintRule({
3144
- name: RULE_NAME$55,
3144
+ name: RULE_NAME$56,
3145
3145
  meta: {
3146
3146
  docs: {
3147
3147
  description: "disallow large snapshots",
@@ -3186,9 +3186,9 @@ var no_large_snapshots_default = createEslintRule({
3186
3186
  const mocksDirName = "__mocks__";
3187
3187
  const isMockPath = (path) => path.split(posix.sep).includes(mocksDirName);
3188
3188
  const isMockImportLiteral = (expression) => isStringNode(expression) && isMockPath(getStringValue(expression));
3189
- const RULE_NAME$54 = "no-mocks-import";
3189
+ const RULE_NAME$55 = "no-mocks-import";
3190
3190
  var no_mocks_import_default = createEslintRule({
3191
- name: RULE_NAME$54,
3191
+ name: RULE_NAME$55,
3192
3192
  meta: {
3193
3193
  type: "problem",
3194
3194
  docs: {
@@ -3220,13 +3220,13 @@ var no_mocks_import_default = createEslintRule({
3220
3220
 
3221
3221
  //#endregion
3222
3222
  //#region src/rules/no-restricted-matchers.ts
3223
- const RULE_NAME$53 = "no-restricted-matchers";
3223
+ const RULE_NAME$54 = "no-restricted-matchers";
3224
3224
  const isChainRestricted = (chain, restriction) => {
3225
3225
  if (Object.prototype.hasOwnProperty.call(ModifierName, restriction) || restriction.endsWith(".not")) return chain.startsWith(restriction);
3226
3226
  return chain === restriction;
3227
3227
  };
3228
3228
  var no_restricted_matchers_default = createEslintRule({
3229
- name: RULE_NAME$53,
3229
+ name: RULE_NAME$54,
3230
3230
  meta: {
3231
3231
  docs: {
3232
3232
  description: "disallow the use of certain matchers",
@@ -3268,9 +3268,9 @@ var no_restricted_matchers_default = createEslintRule({
3268
3268
 
3269
3269
  //#endregion
3270
3270
  //#region src/rules/no-restricted-vi-methods.ts
3271
- const RULE_NAME$52 = "no-restricted-vi-methods";
3271
+ const RULE_NAME$53 = "no-restricted-vi-methods";
3272
3272
  var no_restricted_vi_methods_default = createEslintRule({
3273
- name: RULE_NAME$52,
3273
+ name: RULE_NAME$53,
3274
3274
  meta: {
3275
3275
  type: "suggestion",
3276
3276
  docs: {
@@ -3312,7 +3312,7 @@ var no_restricted_vi_methods_default = createEslintRule({
3312
3312
 
3313
3313
  //#endregion
3314
3314
  //#region src/rules/no-standalone-expect.ts
3315
- const RULE_NAME$51 = "no-standalone-expect";
3315
+ const RULE_NAME$52 = "no-standalone-expect";
3316
3316
  const getBlockType = (statement, context) => {
3317
3317
  const func = statement.parent;
3318
3318
  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");
@@ -3325,7 +3325,7 @@ const getBlockType = (statement, context) => {
3325
3325
  return null;
3326
3326
  };
3327
3327
  var no_standalone_expect_default = createEslintRule({
3328
- name: RULE_NAME$51,
3328
+ name: RULE_NAME$52,
3329
3329
  meta: {
3330
3330
  docs: {
3331
3331
  description: "disallow using `expect` outside of `it` or `test` blocks",
@@ -3384,9 +3384,9 @@ var no_standalone_expect_default = createEslintRule({
3384
3384
 
3385
3385
  //#endregion
3386
3386
  //#region src/rules/no-test-prefixes.ts
3387
- const RULE_NAME$50 = "no-test-prefixes";
3387
+ const RULE_NAME$51 = "no-test-prefixes";
3388
3388
  var no_test_prefixes_default = createEslintRule({
3389
- name: RULE_NAME$50,
3389
+ name: RULE_NAME$51,
3390
3390
  meta: {
3391
3391
  docs: {
3392
3392
  description: "disallow using the `f` and `x` prefixes in favour of `.only` and `.skip`",
@@ -3421,14 +3421,14 @@ var no_test_prefixes_default = createEslintRule({
3421
3421
 
3422
3422
  //#endregion
3423
3423
  //#region src/rules/no-test-return-statement.ts
3424
- const RULE_NAME$49 = "no-test-return-statement";
3424
+ const RULE_NAME$50 = "no-test-return-statement";
3425
3425
  const getBody = (args) => {
3426
3426
  const [, secondArg] = args;
3427
3427
  if (secondArg && isFunction(secondArg) && secondArg.body.type === AST_NODE_TYPES.BlockStatement) return secondArg.body.body;
3428
3428
  return [];
3429
3429
  };
3430
3430
  var no_test_return_statement_default = createEslintRule({
3431
- name: RULE_NAME$49,
3431
+ name: RULE_NAME$50,
3432
3432
  meta: {
3433
3433
  type: "problem",
3434
3434
  docs: {
@@ -3699,7 +3699,7 @@ const createPaddingRule = (name, description, configs, deprecated = false) => {
3699
3699
 
3700
3700
  //#endregion
3701
3701
  //#region src/rules/padding-around-after-all-blocks.ts
3702
- const RULE_NAME$48 = "padding-around-after-all-blocks";
3702
+ const RULE_NAME$49 = "padding-around-after-all-blocks";
3703
3703
  const config = [{
3704
3704
  paddingType: PaddingType.Always,
3705
3705
  prevStatementType: StatementType.Any,
@@ -3709,11 +3709,11 @@ const config = [{
3709
3709
  prevStatementType: StatementType.AfterAllToken,
3710
3710
  nextStatementType: StatementType.Any
3711
3711
  }];
3712
- var padding_around_after_all_blocks_default = createPaddingRule(RULE_NAME$48, "Enforce padding around `afterAll` blocks", config);
3712
+ var padding_around_after_all_blocks_default = createPaddingRule(RULE_NAME$49, "Enforce padding around `afterAll` blocks", config);
3713
3713
 
3714
3714
  //#endregion
3715
3715
  //#region src/rules/padding-around-after-each-blocks.ts
3716
- const RULE_NAME$47 = "padding-around-after-each-blocks";
3716
+ const RULE_NAME$48 = "padding-around-after-each-blocks";
3717
3717
  const config$1 = [{
3718
3718
  paddingType: PaddingType.Always,
3719
3719
  prevStatementType: StatementType.Any,
@@ -3723,11 +3723,11 @@ const config$1 = [{
3723
3723
  prevStatementType: StatementType.AfterEachToken,
3724
3724
  nextStatementType: StatementType.Any
3725
3725
  }];
3726
- var padding_around_after_each_blocks_default = createPaddingRule(RULE_NAME$47, "Enforce padding around `afterEach` blocks", config$1);
3726
+ var padding_around_after_each_blocks_default = createPaddingRule(RULE_NAME$48, "Enforce padding around `afterEach` blocks", config$1);
3727
3727
 
3728
3728
  //#endregion
3729
3729
  //#region src/rules/padding-around-before-all-blocks.ts
3730
- const RULE_NAME$46 = "padding-around-before-all-blocks";
3730
+ const RULE_NAME$47 = "padding-around-before-all-blocks";
3731
3731
  const config$2 = [{
3732
3732
  paddingType: PaddingType.Always,
3733
3733
  prevStatementType: StatementType.Any,
@@ -3737,11 +3737,11 @@ const config$2 = [{
3737
3737
  prevStatementType: StatementType.BeforeAllToken,
3738
3738
  nextStatementType: StatementType.Any
3739
3739
  }];
3740
- var padding_around_before_all_blocks_default = createPaddingRule(RULE_NAME$46, "Enforce padding around `beforeAll` blocks", config$2);
3740
+ var padding_around_before_all_blocks_default = createPaddingRule(RULE_NAME$47, "Enforce padding around `beforeAll` blocks", config$2);
3741
3741
 
3742
3742
  //#endregion
3743
3743
  //#region src/rules/padding-around-before-each-blocks.ts
3744
- const RULE_NAME$45 = "padding-around-before-each-blocks";
3744
+ const RULE_NAME$46 = "padding-around-before-each-blocks";
3745
3745
  const config$3 = [{
3746
3746
  paddingType: PaddingType.Always,
3747
3747
  prevStatementType: StatementType.Any,
@@ -3751,11 +3751,11 @@ const config$3 = [{
3751
3751
  prevStatementType: StatementType.BeforeEachToken,
3752
3752
  nextStatementType: StatementType.Any
3753
3753
  }];
3754
- var padding_around_before_each_blocks_default = createPaddingRule(RULE_NAME$45, "Enforce padding around `beforeEach` blocks", config$3);
3754
+ var padding_around_before_each_blocks_default = createPaddingRule(RULE_NAME$46, "Enforce padding around `beforeEach` blocks", config$3);
3755
3755
 
3756
3756
  //#endregion
3757
3757
  //#region src/rules/padding-around-describe-blocks.ts
3758
- const RULE_NAME$44 = "padding-around-describe-blocks";
3758
+ const RULE_NAME$45 = "padding-around-describe-blocks";
3759
3759
  const config$4 = [{
3760
3760
  paddingType: PaddingType.Always,
3761
3761
  prevStatementType: StatementType.Any,
@@ -3773,11 +3773,11 @@ const config$4 = [{
3773
3773
  ],
3774
3774
  nextStatementType: StatementType.Any
3775
3775
  }];
3776
- var padding_around_describe_blocks_default = createPaddingRule(RULE_NAME$44, "Enforce padding around `describe` blocks", config$4);
3776
+ var padding_around_describe_blocks_default = createPaddingRule(RULE_NAME$45, "Enforce padding around `describe` blocks", config$4);
3777
3777
 
3778
3778
  //#endregion
3779
3779
  //#region src/rules/padding-around-expect-groups.ts
3780
- const RULE_NAME$43 = "padding-around-expect-groups";
3780
+ const RULE_NAME$44 = "padding-around-expect-groups";
3781
3781
  const config$5 = [
3782
3782
  {
3783
3783
  paddingType: PaddingType.Always,
@@ -3810,11 +3810,11 @@ const config$5 = [
3810
3810
  nextStatementType: StatementType.ExpectTypeOfToken
3811
3811
  }
3812
3812
  ];
3813
- var padding_around_expect_groups_default = createPaddingRule(RULE_NAME$43, "Enforce padding around `expect` groups", config$5);
3813
+ var padding_around_expect_groups_default = createPaddingRule(RULE_NAME$44, "Enforce padding around `expect` groups", config$5);
3814
3814
 
3815
3815
  //#endregion
3816
3816
  //#region src/rules/padding-around-test-blocks.ts
3817
- const RULE_NAME$42 = "padding-around-test-blocks";
3817
+ const RULE_NAME$43 = "padding-around-test-blocks";
3818
3818
  const config$6 = [{
3819
3819
  paddingType: PaddingType.Always,
3820
3820
  prevStatementType: StatementType.Any,
@@ -3836,12 +3836,12 @@ const config$6 = [{
3836
3836
  ],
3837
3837
  nextStatementType: StatementType.Any
3838
3838
  }];
3839
- var padding_around_test_blocks_default = createPaddingRule(RULE_NAME$42, "Enforce padding around `test` blocks", config$6);
3839
+ var padding_around_test_blocks_default = createPaddingRule(RULE_NAME$43, "Enforce padding around `test` blocks", config$6);
3840
3840
 
3841
3841
  //#endregion
3842
3842
  //#region src/rules/padding-around-all.ts
3843
- const RULE_NAME$41 = "padding-around-all";
3844
- var padding_around_all_default = createPaddingRule(RULE_NAME$41, "Enforce padding around vitest functions", [
3843
+ const RULE_NAME$42 = "padding-around-all";
3844
+ var padding_around_all_default = createPaddingRule(RULE_NAME$42, "Enforce padding around vitest functions", [
3845
3845
  ...config,
3846
3846
  ...config$1,
3847
3847
  ...config$2,
@@ -3853,7 +3853,7 @@ var padding_around_all_default = createPaddingRule(RULE_NAME$41, "Enforce paddin
3853
3853
 
3854
3854
  //#endregion
3855
3855
  //#region src/rules/prefer-called-exactly-once-with.ts
3856
- const RULE_NAME$40 = "prefer-called-exactly-once-with";
3856
+ const RULE_NAME$41 = "prefer-called-exactly-once-with";
3857
3857
  const MATCHERS_TO_COMBINE = ["toHaveBeenCalledOnce", "toHaveBeenCalledWith"];
3858
3858
  const MOCK_CALL_RESET_METHODS = [
3859
3859
  "mockClear",
@@ -3912,7 +3912,7 @@ const hasMockResetBetween = (body, firstCallExpression, secondCallExpression) =>
3912
3912
  };
3913
3913
  const getMemberProperty = (expression) => expression.callee.type === AST_NODE_TYPES.MemberExpression ? expression.callee.property : null;
3914
3914
  var prefer_called_exactly_once_with_default = createEslintRule({
3915
- name: RULE_NAME$40,
3915
+ name: RULE_NAME$41,
3916
3916
  meta: {
3917
3917
  docs: { description: "Prefer `toHaveBeenCalledExactlyOnceWith` over `toHaveBeenCalledOnce` and `toHaveBeenCalledWith`" },
3918
3918
  messages: { preferCalledExactlyOnceWith: "Using `toHaveBeenCalledOnce` and `toHaveBeenCalledWith` on the same target; prefer `toHaveBeenCalledExactlyOnceWith` instead." },
@@ -3980,10 +3980,10 @@ var prefer_called_exactly_once_with_default = createEslintRule({
3980
3980
 
3981
3981
  //#endregion
3982
3982
  //#region src/rules/prefer-called-once.ts
3983
- const RULE_NAME$39 = "prefer-called-once";
3983
+ const RULE_NAME$40 = "prefer-called-once";
3984
3984
  const isOneLiteral = (node) => node.type === AST_NODE_TYPES.Literal && node.value === 1;
3985
3985
  var prefer_called_once_default = createEslintRule({
3986
- name: RULE_NAME$39,
3986
+ name: RULE_NAME$40,
3987
3987
  meta: {
3988
3988
  docs: {
3989
3989
  description: "enforce using `toBeCalledOnce()` or `toHaveBeenCalledOnce()`",
@@ -4016,9 +4016,9 @@ var prefer_called_once_default = createEslintRule({
4016
4016
 
4017
4017
  //#endregion
4018
4018
  //#region src/rules/prefer-called-times.ts
4019
- const RULE_NAME$38 = "prefer-called-times";
4019
+ const RULE_NAME$39 = "prefer-called-times";
4020
4020
  var prefer_called_times_default = createEslintRule({
4021
- name: RULE_NAME$38,
4021
+ name: RULE_NAME$39,
4022
4022
  meta: {
4023
4023
  docs: {
4024
4024
  description: "enforce using `toBeCalledTimes(1)` or `toHaveBeenCalledTimes(1)`",
@@ -4051,9 +4051,9 @@ var prefer_called_times_default = createEslintRule({
4051
4051
 
4052
4052
  //#endregion
4053
4053
  //#region src/rules/prefer-called-with.ts
4054
- const RULE_NAME$37 = "prefer-called-with";
4054
+ const RULE_NAME$38 = "prefer-called-with";
4055
4055
  var prefer_called_with_default = createEslintRule({
4056
- name: RULE_NAME$37,
4056
+ name: RULE_NAME$38,
4057
4057
  meta: {
4058
4058
  docs: {
4059
4059
  description: "enforce using `toBeCalledWith()` or `toHaveBeenCalledWith()`",
@@ -4101,7 +4101,7 @@ const hasOnlyOneArgument = (call) => call.arguments.length === 1;
4101
4101
 
4102
4102
  //#endregion
4103
4103
  //#region src/rules/prefer-comparison-matcher.ts
4104
- const RULE_NAME$36 = "prefer-comparison-matcher";
4104
+ const RULE_NAME$37 = "prefer-comparison-matcher";
4105
4105
  const isString = (node) => {
4106
4106
  return isStringNode(node) || node?.type === AST_NODE_TYPES.TemplateLiteral;
4107
4107
  };
@@ -4127,7 +4127,7 @@ const determineMatcher = (operator, negated) => {
4127
4127
  return null;
4128
4128
  };
4129
4129
  var prefer_comparison_matcher_default = createEslintRule({
4130
- name: RULE_NAME$36,
4130
+ name: RULE_NAME$37,
4131
4131
  meta: {
4132
4132
  type: "suggestion",
4133
4133
  docs: {
@@ -4173,9 +4173,9 @@ var prefer_comparison_matcher_default = createEslintRule({
4173
4173
 
4174
4174
  //#endregion
4175
4175
  //#region src/rules/prefer-describe-function-title.ts
4176
- const RULE_NAME$35 = "prefer-describe-function-title";
4176
+ const RULE_NAME$36 = "prefer-describe-function-title";
4177
4177
  var prefer_describe_function_title_default = createEslintRule({
4178
- name: RULE_NAME$35,
4178
+ name: RULE_NAME$36,
4179
4179
  meta: {
4180
4180
  type: "problem",
4181
4181
  docs: {
@@ -4225,9 +4225,9 @@ var prefer_describe_function_title_default = createEslintRule({
4225
4225
 
4226
4226
  //#endregion
4227
4227
  //#region src/rules/prefer-each.ts
4228
- const RULE_NAME$34 = "prefer-each";
4228
+ const RULE_NAME$35 = "prefer-each";
4229
4229
  var prefer_each_default = createEslintRule({
4230
- name: RULE_NAME$34,
4230
+ name: RULE_NAME$35,
4231
4231
  meta: {
4232
4232
  type: "suggestion",
4233
4233
  docs: {
@@ -4280,9 +4280,9 @@ var prefer_each_default = createEslintRule({
4280
4280
 
4281
4281
  //#endregion
4282
4282
  //#region src/rules/prefer-equality-matcher.ts
4283
- const RULE_NAME$33 = "prefer-equality-matcher";
4283
+ const RULE_NAME$34 = "prefer-equality-matcher";
4284
4284
  var prefer_equality_matcher_default = createEslintRule({
4285
- name: RULE_NAME$33,
4285
+ name: RULE_NAME$34,
4286
4286
  meta: {
4287
4287
  type: "suggestion",
4288
4288
  docs: {
@@ -4500,9 +4500,9 @@ var prefer_expect_assertions_default = createEslintRule({
4500
4500
 
4501
4501
  //#endregion
4502
4502
  //#region src/rules/prefer-expect-resolves.ts
4503
- const RULE_NAME$32 = "prefer-expect-resolves";
4503
+ const RULE_NAME$33 = "prefer-expect-resolves";
4504
4504
  var prefer_expect_resolves_default = createEslintRule({
4505
- name: RULE_NAME$32,
4505
+ name: RULE_NAME$33,
4506
4506
  meta: {
4507
4507
  type: "suggestion",
4508
4508
  docs: {
@@ -4536,7 +4536,7 @@ var prefer_expect_resolves_default = createEslintRule({
4536
4536
 
4537
4537
  //#endregion
4538
4538
  //#region src/rules/prefer-expect-type-of.ts
4539
- const RULE_NAME$31 = "prefer-expect-type-of";
4539
+ const RULE_NAME$32 = "prefer-expect-type-of";
4540
4540
  const typeMatchers = {
4541
4541
  string: "toBeString",
4542
4542
  number: "toBeNumber",
@@ -4548,7 +4548,7 @@ const typeMatchers = {
4548
4548
  undefined: "toBeUndefined"
4549
4549
  };
4550
4550
  var prefer_expect_type_of_default = createEslintRule({
4551
- name: RULE_NAME$31,
4551
+ name: RULE_NAME$32,
4552
4552
  meta: {
4553
4553
  type: "suggestion",
4554
4554
  docs: {
@@ -4597,7 +4597,7 @@ var prefer_expect_type_of_default = createEslintRule({
4597
4597
 
4598
4598
  //#endregion
4599
4599
  //#region src/rules/prefer-hooks-in-order.ts
4600
- const RULE_NAME$30 = "prefer-hooks-in-order";
4600
+ const RULE_NAME$31 = "prefer-hooks-in-order";
4601
4601
  const HooksOrder = [
4602
4602
  "beforeAll",
4603
4603
  "beforeEach",
@@ -4605,7 +4605,7 @@ const HooksOrder = [
4605
4605
  "afterAll"
4606
4606
  ];
4607
4607
  var prefer_hooks_in_order_default = createEslintRule({
4608
- name: RULE_NAME$30,
4608
+ name: RULE_NAME$31,
4609
4609
  meta: {
4610
4610
  type: "suggestion",
4611
4611
  docs: {
@@ -4658,9 +4658,9 @@ var prefer_hooks_in_order_default = createEslintRule({
4658
4658
 
4659
4659
  //#endregion
4660
4660
  //#region src/rules/prefer-hooks-on-top.ts
4661
- const RULE_NAME$29 = "prefer-hooks-on-top";
4661
+ const RULE_NAME$30 = "prefer-hooks-on-top";
4662
4662
  var prefer_hooks_on_top_default = createEslintRule({
4663
- name: RULE_NAME$29,
4663
+ name: RULE_NAME$30,
4664
4664
  meta: {
4665
4665
  type: "suggestion",
4666
4666
  docs: {
@@ -4693,9 +4693,9 @@ var prefer_hooks_on_top_default = createEslintRule({
4693
4693
 
4694
4694
  //#endregion
4695
4695
  //#region src/rules/prefer-import-in-mock.ts
4696
- const RULE_NAME$28 = "prefer-import-in-mock";
4696
+ const RULE_NAME$29 = "prefer-import-in-mock";
4697
4697
  var prefer_import_in_mock_default = createEslintRule({
4698
- name: RULE_NAME$28,
4698
+ name: RULE_NAME$29,
4699
4699
  meta: {
4700
4700
  fixable: "code",
4701
4701
  type: "suggestion",
@@ -4734,9 +4734,9 @@ var prefer_import_in_mock_default = createEslintRule({
4734
4734
 
4735
4735
  //#endregion
4736
4736
  //#region src/rules/prefer-importing-vitest-globals.ts
4737
- const RULE_NAME$27 = "prefer-importing-vitest-globals";
4737
+ const RULE_NAME$28 = "prefer-importing-vitest-globals";
4738
4738
  var prefer_importing_vitest_globals_default = createEslintRule({
4739
- name: RULE_NAME$27,
4739
+ name: RULE_NAME$28,
4740
4740
  meta: {
4741
4741
  type: "suggestion",
4742
4742
  docs: {
@@ -4809,7 +4809,7 @@ var prefer_importing_vitest_globals_default = createEslintRule({
4809
4809
 
4810
4810
  //#endregion
4811
4811
  //#region src/rules/prefer-lowercase-title.ts
4812
- const RULE_NAME$26 = "prefer-lowercase-title";
4812
+ const RULE_NAME$27 = "prefer-lowercase-title";
4813
4813
  const hasStringAsFirstArgument = (node) => node.arguments[0] && isStringNode(node.arguments[0]);
4814
4814
  const populateIgnores = (ignore) => {
4815
4815
  const ignores = [];
@@ -4819,7 +4819,7 @@ const populateIgnores = (ignore) => {
4819
4819
  return ignores;
4820
4820
  };
4821
4821
  var prefer_lowercase_title_default = createEslintRule({
4822
- name: RULE_NAME$26,
4822
+ name: RULE_NAME$27,
4823
4823
  meta: {
4824
4824
  type: "problem",
4825
4825
  docs: {
@@ -4906,17 +4906,17 @@ var prefer_lowercase_title_default = createEslintRule({
4906
4906
 
4907
4907
  //#endregion
4908
4908
  //#region src/rules/prefer-mock-promise-shorthand.ts
4909
- const RULE_NAME$25 = "prefer-mock-promise-shorthand";
4910
- const withOnce = (name, addOnce) => {
4909
+ const RULE_NAME$26 = "prefer-mock-promise-shorthand";
4910
+ const withOnce$1 = (name, addOnce) => {
4911
4911
  return `${name}${addOnce ? "Once" : ""}`;
4912
4912
  };
4913
- const findSingleReturnArgumentNode = (fnNode) => {
4913
+ const findSingleReturnArgumentNode$1 = (fnNode) => {
4914
4914
  if (fnNode.body.type !== AST_NODE_TYPES.BlockStatement) return fnNode.body;
4915
4915
  if (fnNode.body.body[0]?.type === AST_NODE_TYPES.ReturnStatement) return fnNode.body.body[0].argument;
4916
4916
  return null;
4917
4917
  };
4918
4918
  var prefer_mock_promise_shorthand_default = createEslintRule({
4919
- name: RULE_NAME$25,
4919
+ name: RULE_NAME$26,
4920
4920
  meta: {
4921
4921
  type: "suggestion",
4922
4922
  docs: {
@@ -4933,7 +4933,7 @@ var prefer_mock_promise_shorthand_default = createEslintRule({
4933
4933
  if (innerArgNode?.type !== AST_NODE_TYPES.CallExpression) return;
4934
4934
  const argName = getNodeName(innerArgNode);
4935
4935
  if (argName !== "Promise.resolve" && argName !== "Promise.reject") return;
4936
- const replacement = withOnce(argName.endsWith("reject") ? "mockRejectedValue" : "mockResolvedValue", isOnce);
4936
+ const replacement = withOnce$1(argName.endsWith("reject") ? "mockRejectedValue" : "mockResolvedValue", isOnce);
4937
4937
  context.report({
4938
4938
  node: property,
4939
4939
  messageId: "useMockShorthand",
@@ -4949,16 +4949,64 @@ var prefer_mock_promise_shorthand_default = createEslintRule({
4949
4949
  if (node.callee.type !== AST_NODE_TYPES.MemberExpression || !isSupportedAccessor(node.callee.property) || node.arguments.length === 0) return;
4950
4950
  const mockFnName = getAccessorValue(node.callee.property);
4951
4951
  const isOnce = mockFnName.endsWith("Once");
4952
- if (mockFnName === withOnce("mockReturnValue", isOnce)) report(node.callee.property, isOnce, node.arguments[0]);
4953
- else if (mockFnName === withOnce("mockImplementation", isOnce)) {
4952
+ if (mockFnName === withOnce$1("mockReturnValue", isOnce)) report(node.callee.property, isOnce, node.arguments[0]);
4953
+ else if (mockFnName === withOnce$1("mockImplementation", isOnce)) {
4954
4954
  const [arg] = node.arguments;
4955
4955
  if (!isFunction(arg) || arg.params.length !== 0) return;
4956
- report(node.callee.property, isOnce, arg, findSingleReturnArgumentNode(arg));
4956
+ report(node.callee.property, isOnce, arg, findSingleReturnArgumentNode$1(arg));
4957
4957
  }
4958
4958
  } };
4959
4959
  }
4960
4960
  });
4961
4961
 
4962
+ //#endregion
4963
+ //#region src/rules/prefer-mock-return-shorthand.ts
4964
+ const RULE_NAME$25 = "prefer-mock-return-shorthand";
4965
+ const withOnce = (name, addOnce) => {
4966
+ return `${name}${addOnce ? "Once" : ""}`;
4967
+ };
4968
+ const findSingleReturnArgumentNode = (fnNode) => {
4969
+ if (fnNode.body.type !== AST_NODE_TYPES.BlockStatement) return fnNode.body;
4970
+ if (fnNode.body.body[0]?.type === AST_NODE_TYPES.ReturnStatement) return fnNode.body.body[0].argument;
4971
+ return null;
4972
+ };
4973
+ var prefer_mock_return_shorthand_default = createEslintRule({
4974
+ name: RULE_NAME$25,
4975
+ meta: {
4976
+ docs: {
4977
+ description: "Prefer mock return shorthands",
4978
+ recommended: false
4979
+ },
4980
+ messages: { useMockShorthand: "Prefer {{ replacement }}" },
4981
+ schema: [],
4982
+ type: "suggestion",
4983
+ fixable: "code"
4984
+ },
4985
+ defaultOptions: [],
4986
+ create(context) {
4987
+ return { CallExpression(node) {
4988
+ if (node.callee.type !== AST_NODE_TYPES.MemberExpression || !isSupportedAccessor(node.callee.property) || node.arguments.length === 0) return;
4989
+ const { property } = node.callee;
4990
+ const mockFnName = getAccessorValue(property);
4991
+ const isOnce = mockFnName.endsWith("Once");
4992
+ if (mockFnName !== withOnce("mockImplementation", isOnce)) return;
4993
+ const [arg] = node.arguments;
4994
+ if (!isFunction(arg) || arg.params.length !== 0) return;
4995
+ const replacement = withOnce("mockReturnValue", isOnce);
4996
+ const returnNode = findSingleReturnArgumentNode(arg);
4997
+ if (!returnNode) return;
4998
+ context.report({
4999
+ node: property,
5000
+ messageId: "useMockShorthand",
5001
+ data: { replacement },
5002
+ fix(fixer) {
5003
+ return [fixer.replaceText(property, replacement), fixer.replaceText(arg, context.sourceCode.getText(returnNode))];
5004
+ }
5005
+ });
5006
+ } };
5007
+ }
5008
+ });
5009
+
4962
5010
  //#endregion
4963
5011
  //#region src/rules/prefer-snapshot-hint.ts
4964
5012
  const RULE_NAME$24 = "prefer-snapshot-hint";
@@ -6698,6 +6746,7 @@ const rules = {
6698
6746
  "prefer-importing-vitest-globals": prefer_importing_vitest_globals_default,
6699
6747
  "prefer-lowercase-title": prefer_lowercase_title_default,
6700
6748
  "prefer-mock-promise-shorthand": prefer_mock_promise_shorthand_default,
6749
+ "prefer-mock-return-shorthand": prefer_mock_return_shorthand_default,
6701
6750
  "prefer-snapshot-hint": prefer_snapshot_hint_default,
6702
6751
  "prefer-spy-on": prefer_spy_on_default,
6703
6752
  "prefer-strict-boolean-matchers": prefer_strict_boolean_matchers_default,