@vitest/eslint-plugin 1.6.1 → 1.6.3
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 +13 -4
- package/dist/index.js +13 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -31,7 +31,7 @@ let __typescript_eslint_scope_manager = require("@typescript-eslint/scope-manage
|
|
|
31
31
|
__typescript_eslint_scope_manager = __toESM(__typescript_eslint_scope_manager);
|
|
32
32
|
|
|
33
33
|
//#region package.json
|
|
34
|
-
var version = "1.6.
|
|
34
|
+
var version = "1.6.3";
|
|
35
35
|
|
|
36
36
|
//#endregion
|
|
37
37
|
//#region src/utils/index.ts
|
|
@@ -4728,10 +4728,18 @@ var prefer_import_in_mock_default = createEslintRule({
|
|
|
4728
4728
|
type: "suggestion",
|
|
4729
4729
|
docs: { description: "prefer dynamic import in mock" },
|
|
4730
4730
|
messages: { preferImport: "Replace '{{path}}' with import('{{path}}')" },
|
|
4731
|
-
schema: [
|
|
4731
|
+
schema: [{
|
|
4732
|
+
type: "object",
|
|
4733
|
+
properties: { fixable: {
|
|
4734
|
+
type: "boolean",
|
|
4735
|
+
default: true
|
|
4736
|
+
} },
|
|
4737
|
+
additionalProperties: false
|
|
4738
|
+
}]
|
|
4732
4739
|
},
|
|
4733
|
-
defaultOptions: [],
|
|
4734
|
-
create(context) {
|
|
4740
|
+
defaultOptions: [{ fixable: true }],
|
|
4741
|
+
create(context, options) {
|
|
4742
|
+
const fixable = options[0].fixable;
|
|
4735
4743
|
return { CallExpression(node) {
|
|
4736
4744
|
if (node.callee.type !== __typescript_eslint_utils.AST_NODE_TYPES.MemberExpression) return;
|
|
4737
4745
|
if (parseVitestFnCall(node, context)?.type !== "vi") return false;
|
|
@@ -4743,6 +4751,7 @@ var prefer_import_in_mock_default = createEslintRule({
|
|
|
4743
4751
|
data: { path: pathArg.value },
|
|
4744
4752
|
node,
|
|
4745
4753
|
fix(fixer) {
|
|
4754
|
+
if (!fixable) return null;
|
|
4746
4755
|
return fixer.replaceText(pathArg, `import('${pathArg.value}')`);
|
|
4747
4756
|
}
|
|
4748
4757
|
});
|
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.
|
|
7
|
+
var version = "1.6.3";
|
|
8
8
|
|
|
9
9
|
//#endregion
|
|
10
10
|
//#region src/utils/index.ts
|
|
@@ -4701,10 +4701,18 @@ var prefer_import_in_mock_default = createEslintRule({
|
|
|
4701
4701
|
type: "suggestion",
|
|
4702
4702
|
docs: { description: "prefer dynamic import in mock" },
|
|
4703
4703
|
messages: { preferImport: "Replace '{{path}}' with import('{{path}}')" },
|
|
4704
|
-
schema: [
|
|
4704
|
+
schema: [{
|
|
4705
|
+
type: "object",
|
|
4706
|
+
properties: { fixable: {
|
|
4707
|
+
type: "boolean",
|
|
4708
|
+
default: true
|
|
4709
|
+
} },
|
|
4710
|
+
additionalProperties: false
|
|
4711
|
+
}]
|
|
4705
4712
|
},
|
|
4706
|
-
defaultOptions: [],
|
|
4707
|
-
create(context) {
|
|
4713
|
+
defaultOptions: [{ fixable: true }],
|
|
4714
|
+
create(context, options) {
|
|
4715
|
+
const fixable = options[0].fixable;
|
|
4708
4716
|
return { CallExpression(node) {
|
|
4709
4717
|
if (node.callee.type !== AST_NODE_TYPES.MemberExpression) return;
|
|
4710
4718
|
if (parseVitestFnCall(node, context)?.type !== "vi") return false;
|
|
@@ -4716,6 +4724,7 @@ var prefer_import_in_mock_default = createEslintRule({
|
|
|
4716
4724
|
data: { path: pathArg.value },
|
|
4717
4725
|
node,
|
|
4718
4726
|
fix(fixer) {
|
|
4727
|
+
if (!fixable) return null;
|
|
4719
4728
|
return fixer.replaceText(pathArg, `import('${pathArg.value}')`);
|
|
4720
4729
|
}
|
|
4721
4730
|
});
|