@vitest/eslint-plugin 1.3.24 → 1.3.26
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 +18 -14
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -7
- package/dist/index.js +14 -9
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -23,17 +23,15 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
23
23
|
//#endregion
|
|
24
24
|
let __typescript_eslint_utils = require("@typescript-eslint/utils");
|
|
25
25
|
__typescript_eslint_utils = __toESM(__typescript_eslint_utils);
|
|
26
|
-
let typescript = require("typescript");
|
|
27
|
-
typescript = __toESM(typescript);
|
|
28
|
-
let node_path = require("node:path");
|
|
29
|
-
node_path = __toESM(node_path);
|
|
30
26
|
let node_module = require("node:module");
|
|
31
27
|
node_module = __toESM(node_module);
|
|
28
|
+
let node_path = require("node:path");
|
|
29
|
+
node_path = __toESM(node_path);
|
|
32
30
|
let __typescript_eslint_scope_manager = require("@typescript-eslint/scope-manager");
|
|
33
31
|
__typescript_eslint_scope_manager = __toESM(__typescript_eslint_scope_manager);
|
|
34
32
|
|
|
35
33
|
//#region package.json
|
|
36
|
-
var version = "1.3.
|
|
34
|
+
var version = "1.3.26";
|
|
37
35
|
|
|
38
36
|
//#endregion
|
|
39
37
|
//#region src/utils/index.ts
|
|
@@ -111,6 +109,10 @@ const isParsedInstanceOfMatcherCall = (expectFnCall, classArg) => {
|
|
|
111
109
|
return getAccessorValue(expectFnCall.matcher) === "toBeInstanceOf" && expectFnCall.args.length === 1 && isSupportedAccessor(expectFnCall.args[0], classArg);
|
|
112
110
|
};
|
|
113
111
|
|
|
112
|
+
//#endregion
|
|
113
|
+
//#region src/utils/require.ts
|
|
114
|
+
const require$1 = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
|
|
115
|
+
|
|
114
116
|
//#endregion
|
|
115
117
|
//#region src/utils/types.ts
|
|
116
118
|
let UtilName = /* @__PURE__ */ function(UtilName$1) {
|
|
@@ -165,7 +167,8 @@ let EqualityMatcher = /* @__PURE__ */ function(EqualityMatcher$1) {
|
|
|
165
167
|
}({});
|
|
166
168
|
function isClassOrFunctionType(type) {
|
|
167
169
|
if (type.getCallSignatures().length > 0) return true;
|
|
168
|
-
|
|
170
|
+
const ts = require$1("typescript");
|
|
171
|
+
return type.getSymbol()?.getDeclarations()?.some((declaration) => ts.isArrowFunction(declaration) || ts.isClassDeclaration(declaration) || ts.isClassExpression(declaration) || ts.isFunctionDeclaration(declaration) || ts.isFunctionExpression(declaration) || ts.isMethodDeclaration(declaration) || ts.isFunctionTypeNode(declaration)) ?? false;
|
|
169
172
|
}
|
|
170
173
|
|
|
171
174
|
//#endregion
|
|
@@ -2669,20 +2672,20 @@ var consistent_test_filename_default = createEslintRule({
|
|
|
2669
2672
|
}]
|
|
2670
2673
|
},
|
|
2671
2674
|
defaultOptions: [{
|
|
2672
|
-
pattern: defaultPattern,
|
|
2673
|
-
allTestPattern: defaultTestsPattern
|
|
2675
|
+
pattern: defaultPattern.source,
|
|
2676
|
+
allTestPattern: defaultTestsPattern.source
|
|
2674
2677
|
}],
|
|
2675
2678
|
create: (context, options) => {
|
|
2676
2679
|
const { pattern: patternRaw, allTestPattern: allTestPatternRaw } = options[0];
|
|
2677
|
-
const pattern =
|
|
2678
|
-
const
|
|
2680
|
+
const pattern = new RegExp(patternRaw);
|
|
2681
|
+
const allTestPattern = new RegExp(allTestPatternRaw);
|
|
2679
2682
|
const { filename } = context;
|
|
2680
|
-
if (!
|
|
2683
|
+
if (!allTestPattern.test(filename)) return {};
|
|
2681
2684
|
return { Program: (p) => {
|
|
2682
2685
|
if (!pattern.test(filename)) context.report({
|
|
2683
2686
|
node: p,
|
|
2684
2687
|
messageId: "consistentTestFilename",
|
|
2685
|
-
data: { pattern:
|
|
2688
|
+
data: { pattern: patternRaw }
|
|
2686
2689
|
});
|
|
2687
2690
|
} };
|
|
2688
2691
|
}
|
|
@@ -3235,7 +3238,7 @@ var no_done_callback_default = createEslintRule({
|
|
|
3235
3238
|
defaultOptions: [],
|
|
3236
3239
|
create(context) {
|
|
3237
3240
|
return { CallExpression(node) {
|
|
3238
|
-
const isVitestEach = /\.each$|\.concurrent$/.test(getNodeName(node.callee) ?? "");
|
|
3241
|
+
const isVitestEach = /\.each$|\.for$|\.concurrent$/.test(getNodeName(node.callee) ?? "");
|
|
3239
3242
|
if (isVitestEach && node.callee.type !== __typescript_eslint_utils.AST_NODE_TYPES.TaggedTemplateExpression) return;
|
|
3240
3243
|
if (context.sourceCode.getAncestors(node).some((ancestor) => {
|
|
3241
3244
|
if (ancestor.type !== __typescript_eslint_utils.AST_NODE_TYPES.CallExpression) return false;
|
|
@@ -3724,7 +3727,8 @@ const compileMatcherPattern = (matcherMaybeWithMessage) => {
|
|
|
3724
3727
|
return [new RegExp(matcher, "u"), message];
|
|
3725
3728
|
};
|
|
3726
3729
|
function isStringLikeType(type) {
|
|
3727
|
-
|
|
3730
|
+
const ts = require$1("typescript");
|
|
3731
|
+
return !!(type.flags & ts.TypeFlags.StringLike);
|
|
3728
3732
|
}
|
|
3729
3733
|
const compileMatcherPatterns = (matchers) => {
|
|
3730
3734
|
if (typeof matchers === "string" || Array.isArray(matchers)) {
|
package/dist/index.d.cts
CHANGED
|
@@ -104,8 +104,8 @@ declare const plugin: {
|
|
|
104
104
|
}>], PluginDocs, _typescript_eslint_utils_ts_eslint0.RuleListener>;
|
|
105
105
|
readonly "no-restricted-vi-methods": _typescript_eslint_utils_ts_eslint0.RuleModule<MESSAGE_ID$1, Options$2, PluginDocs, _typescript_eslint_utils_ts_eslint0.RuleListener>;
|
|
106
106
|
readonly "consistent-test-filename": _typescript_eslint_utils_ts_eslint0.RuleModule<"consistentTestFilename", [Partial<{
|
|
107
|
-
pattern:
|
|
108
|
-
allTestPattern:
|
|
107
|
+
pattern: string;
|
|
108
|
+
allTestPattern: string;
|
|
109
109
|
}>], PluginDocs, _typescript_eslint_utils_ts_eslint0.RuleListener>;
|
|
110
110
|
readonly "max-expects": _typescript_eslint_utils_ts_eslint0.RuleModule<"maxExpect", Options$1, PluginDocs, _typescript_eslint_utils_ts_eslint0.RuleListener>;
|
|
111
111
|
readonly "no-alias-methods": _typescript_eslint_utils_ts_eslint0.RuleModule<"noAliasMethods", [], PluginDocs, _typescript_eslint_utils_ts_eslint0.RuleListener>;
|
|
@@ -271,8 +271,8 @@ declare const plugin: {
|
|
|
271
271
|
}>], PluginDocs, _typescript_eslint_utils_ts_eslint0.RuleListener>;
|
|
272
272
|
readonly "no-restricted-vi-methods": _typescript_eslint_utils_ts_eslint0.RuleModule<MESSAGE_ID$1, Options$2, PluginDocs, _typescript_eslint_utils_ts_eslint0.RuleListener>;
|
|
273
273
|
readonly "consistent-test-filename": _typescript_eslint_utils_ts_eslint0.RuleModule<"consistentTestFilename", [Partial<{
|
|
274
|
-
pattern:
|
|
275
|
-
allTestPattern:
|
|
274
|
+
pattern: string;
|
|
275
|
+
allTestPattern: string;
|
|
276
276
|
}>], PluginDocs, _typescript_eslint_utils_ts_eslint0.RuleListener>;
|
|
277
277
|
readonly "max-expects": _typescript_eslint_utils_ts_eslint0.RuleModule<"maxExpect", Options$1, PluginDocs, _typescript_eslint_utils_ts_eslint0.RuleListener>;
|
|
278
278
|
readonly "no-alias-methods": _typescript_eslint_utils_ts_eslint0.RuleModule<"noAliasMethods", [], PluginDocs, _typescript_eslint_utils_ts_eslint0.RuleListener>;
|
|
@@ -576,8 +576,8 @@ declare const plugin: {
|
|
|
576
576
|
}>], PluginDocs, _typescript_eslint_utils_ts_eslint0.RuleListener>;
|
|
577
577
|
readonly "no-restricted-vi-methods": _typescript_eslint_utils_ts_eslint0.RuleModule<MESSAGE_ID$1, Options$2, PluginDocs, _typescript_eslint_utils_ts_eslint0.RuleListener>;
|
|
578
578
|
readonly "consistent-test-filename": _typescript_eslint_utils_ts_eslint0.RuleModule<"consistentTestFilename", [Partial<{
|
|
579
|
-
pattern:
|
|
580
|
-
allTestPattern:
|
|
579
|
+
pattern: string;
|
|
580
|
+
allTestPattern: string;
|
|
581
581
|
}>], PluginDocs, _typescript_eslint_utils_ts_eslint0.RuleListener>;
|
|
582
582
|
readonly "max-expects": _typescript_eslint_utils_ts_eslint0.RuleModule<"maxExpect", Options$1, PluginDocs, _typescript_eslint_utils_ts_eslint0.RuleListener>;
|
|
583
583
|
readonly "no-alias-methods": _typescript_eslint_utils_ts_eslint0.RuleModule<"noAliasMethods", [], PluginDocs, _typescript_eslint_utils_ts_eslint0.RuleListener>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ESLintUtils } from "@typescript-eslint/utils";
|
|
2
|
-
import ts from "typescript";
|
|
3
2
|
import * as _typescript_eslint_utils_ts_eslint0 from "@typescript-eslint/utils/ts-eslint";
|
|
4
3
|
|
|
5
4
|
//#region src/utils/index.d.ts
|
|
@@ -106,8 +105,8 @@ declare const plugin: {
|
|
|
106
105
|
}>], PluginDocs, _typescript_eslint_utils_ts_eslint0.RuleListener>;
|
|
107
106
|
readonly "no-restricted-vi-methods": _typescript_eslint_utils_ts_eslint0.RuleModule<MESSAGE_ID$1, Options$2, PluginDocs, _typescript_eslint_utils_ts_eslint0.RuleListener>;
|
|
108
107
|
readonly "consistent-test-filename": _typescript_eslint_utils_ts_eslint0.RuleModule<"consistentTestFilename", [Partial<{
|
|
109
|
-
pattern:
|
|
110
|
-
allTestPattern:
|
|
108
|
+
pattern: string;
|
|
109
|
+
allTestPattern: string;
|
|
111
110
|
}>], PluginDocs, _typescript_eslint_utils_ts_eslint0.RuleListener>;
|
|
112
111
|
readonly "max-expects": _typescript_eslint_utils_ts_eslint0.RuleModule<"maxExpect", Options$1, PluginDocs, _typescript_eslint_utils_ts_eslint0.RuleListener>;
|
|
113
112
|
readonly "no-alias-methods": _typescript_eslint_utils_ts_eslint0.RuleModule<"noAliasMethods", [], PluginDocs, _typescript_eslint_utils_ts_eslint0.RuleListener>;
|
|
@@ -273,8 +272,8 @@ declare const plugin: {
|
|
|
273
272
|
}>], PluginDocs, _typescript_eslint_utils_ts_eslint0.RuleListener>;
|
|
274
273
|
readonly "no-restricted-vi-methods": _typescript_eslint_utils_ts_eslint0.RuleModule<MESSAGE_ID$1, Options$2, PluginDocs, _typescript_eslint_utils_ts_eslint0.RuleListener>;
|
|
275
274
|
readonly "consistent-test-filename": _typescript_eslint_utils_ts_eslint0.RuleModule<"consistentTestFilename", [Partial<{
|
|
276
|
-
pattern:
|
|
277
|
-
allTestPattern:
|
|
275
|
+
pattern: string;
|
|
276
|
+
allTestPattern: string;
|
|
278
277
|
}>], PluginDocs, _typescript_eslint_utils_ts_eslint0.RuleListener>;
|
|
279
278
|
readonly "max-expects": _typescript_eslint_utils_ts_eslint0.RuleModule<"maxExpect", Options$1, PluginDocs, _typescript_eslint_utils_ts_eslint0.RuleListener>;
|
|
280
279
|
readonly "no-alias-methods": _typescript_eslint_utils_ts_eslint0.RuleModule<"noAliasMethods", [], PluginDocs, _typescript_eslint_utils_ts_eslint0.RuleListener>;
|
|
@@ -578,8 +577,8 @@ declare const plugin: {
|
|
|
578
577
|
}>], PluginDocs, _typescript_eslint_utils_ts_eslint0.RuleListener>;
|
|
579
578
|
readonly "no-restricted-vi-methods": _typescript_eslint_utils_ts_eslint0.RuleModule<MESSAGE_ID$1, Options$2, PluginDocs, _typescript_eslint_utils_ts_eslint0.RuleListener>;
|
|
580
579
|
readonly "consistent-test-filename": _typescript_eslint_utils_ts_eslint0.RuleModule<"consistentTestFilename", [Partial<{
|
|
581
|
-
pattern:
|
|
582
|
-
allTestPattern:
|
|
580
|
+
pattern: string;
|
|
581
|
+
allTestPattern: string;
|
|
583
582
|
}>], PluginDocs, _typescript_eslint_utils_ts_eslint0.RuleListener>;
|
|
584
583
|
readonly "max-expects": _typescript_eslint_utils_ts_eslint0.RuleModule<"maxExpect", Options$1, PluginDocs, _typescript_eslint_utils_ts_eslint0.RuleListener>;
|
|
585
584
|
readonly "no-alias-methods": _typescript_eslint_utils_ts_eslint0.RuleModule<"noAliasMethods", [], PluginDocs, _typescript_eslint_utils_ts_eslint0.RuleListener>;
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import { AST_NODE_TYPES, AST_TOKEN_TYPES, ESLintUtils } from "@typescript-eslint/utils";
|
|
3
|
-
import ts from "typescript";
|
|
4
3
|
import { isAbsolute, posix } from "node:path";
|
|
5
4
|
import { DefinitionType } from "@typescript-eslint/scope-manager";
|
|
6
5
|
|
|
7
6
|
//#region package.json
|
|
8
|
-
var version = "1.3.
|
|
7
|
+
var version = "1.3.26";
|
|
9
8
|
|
|
10
9
|
//#endregion
|
|
11
10
|
//#region src/utils/index.ts
|
|
@@ -83,6 +82,10 @@ const isParsedInstanceOfMatcherCall = (expectFnCall, classArg) => {
|
|
|
83
82
|
return getAccessorValue(expectFnCall.matcher) === "toBeInstanceOf" && expectFnCall.args.length === 1 && isSupportedAccessor(expectFnCall.args[0], classArg);
|
|
84
83
|
};
|
|
85
84
|
|
|
85
|
+
//#endregion
|
|
86
|
+
//#region src/utils/require.ts
|
|
87
|
+
const require = createRequire(import.meta.url);
|
|
88
|
+
|
|
86
89
|
//#endregion
|
|
87
90
|
//#region src/utils/types.ts
|
|
88
91
|
let UtilName = /* @__PURE__ */ function(UtilName$1) {
|
|
@@ -137,6 +140,7 @@ let EqualityMatcher = /* @__PURE__ */ function(EqualityMatcher$1) {
|
|
|
137
140
|
}({});
|
|
138
141
|
function isClassOrFunctionType(type) {
|
|
139
142
|
if (type.getCallSignatures().length > 0) return true;
|
|
143
|
+
const ts = require("typescript");
|
|
140
144
|
return type.getSymbol()?.getDeclarations()?.some((declaration) => ts.isArrowFunction(declaration) || ts.isClassDeclaration(declaration) || ts.isClassExpression(declaration) || ts.isFunctionDeclaration(declaration) || ts.isFunctionExpression(declaration) || ts.isMethodDeclaration(declaration) || ts.isFunctionTypeNode(declaration)) ?? false;
|
|
141
145
|
}
|
|
142
146
|
|
|
@@ -2641,20 +2645,20 @@ var consistent_test_filename_default = createEslintRule({
|
|
|
2641
2645
|
}]
|
|
2642
2646
|
},
|
|
2643
2647
|
defaultOptions: [{
|
|
2644
|
-
pattern: defaultPattern,
|
|
2645
|
-
allTestPattern: defaultTestsPattern
|
|
2648
|
+
pattern: defaultPattern.source,
|
|
2649
|
+
allTestPattern: defaultTestsPattern.source
|
|
2646
2650
|
}],
|
|
2647
2651
|
create: (context, options) => {
|
|
2648
2652
|
const { pattern: patternRaw, allTestPattern: allTestPatternRaw } = options[0];
|
|
2649
|
-
const pattern =
|
|
2650
|
-
const
|
|
2653
|
+
const pattern = new RegExp(patternRaw);
|
|
2654
|
+
const allTestPattern = new RegExp(allTestPatternRaw);
|
|
2651
2655
|
const { filename } = context;
|
|
2652
|
-
if (!
|
|
2656
|
+
if (!allTestPattern.test(filename)) return {};
|
|
2653
2657
|
return { Program: (p) => {
|
|
2654
2658
|
if (!pattern.test(filename)) context.report({
|
|
2655
2659
|
node: p,
|
|
2656
2660
|
messageId: "consistentTestFilename",
|
|
2657
|
-
data: { pattern:
|
|
2661
|
+
data: { pattern: patternRaw }
|
|
2658
2662
|
});
|
|
2659
2663
|
} };
|
|
2660
2664
|
}
|
|
@@ -3207,7 +3211,7 @@ var no_done_callback_default = createEslintRule({
|
|
|
3207
3211
|
defaultOptions: [],
|
|
3208
3212
|
create(context) {
|
|
3209
3213
|
return { CallExpression(node) {
|
|
3210
|
-
const isVitestEach = /\.each$|\.concurrent$/.test(getNodeName(node.callee) ?? "");
|
|
3214
|
+
const isVitestEach = /\.each$|\.for$|\.concurrent$/.test(getNodeName(node.callee) ?? "");
|
|
3211
3215
|
if (isVitestEach && node.callee.type !== AST_NODE_TYPES.TaggedTemplateExpression) return;
|
|
3212
3216
|
if (context.sourceCode.getAncestors(node).some((ancestor) => {
|
|
3213
3217
|
if (ancestor.type !== AST_NODE_TYPES.CallExpression) return false;
|
|
@@ -3696,6 +3700,7 @@ const compileMatcherPattern = (matcherMaybeWithMessage) => {
|
|
|
3696
3700
|
return [new RegExp(matcher, "u"), message];
|
|
3697
3701
|
};
|
|
3698
3702
|
function isStringLikeType(type) {
|
|
3703
|
+
const ts = require("typescript");
|
|
3699
3704
|
return !!(type.flags & ts.TypeFlags.StringLike);
|
|
3700
3705
|
}
|
|
3701
3706
|
const compileMatcherPatterns = (matchers) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitest/eslint-plugin",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.26",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ESLint plugin for Vitest",
|
|
6
6
|
"repository": "vitest-dev/eslint-plugin-vitest",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"eslint-remote-tester-repositories": "^2.0.2",
|
|
49
49
|
"jiti": "^2.6.1",
|
|
50
50
|
"prettier": "^3.6.2",
|
|
51
|
-
"tsdown": "^0.15.
|
|
51
|
+
"tsdown": "^0.15.10",
|
|
52
52
|
"tsx": "^4.20.6",
|
|
53
53
|
"typescript": "^5.9.3",
|
|
54
54
|
"typescript-eslint": "^8.46.1",
|