@vitest/eslint-plugin 1.0.3 → 1.0.5
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 +8 -8
- package/dist/index.mjs +8 -8
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -24,7 +24,7 @@ function _interopNamespaceCompat(e) {
|
|
|
24
24
|
const path__namespace = /*#__PURE__*/_interopNamespaceCompat(path);
|
|
25
25
|
const ts__default = /*#__PURE__*/_interopDefaultCompat(ts);
|
|
26
26
|
|
|
27
|
-
const version = "1.0.
|
|
27
|
+
const version = "1.0.4";
|
|
28
28
|
|
|
29
29
|
function createEslintRule(rule) {
|
|
30
30
|
const createRule = utils.ESLintUtils.RuleCreator(
|
|
@@ -2478,6 +2478,13 @@ const validExpect = createEslintRule({
|
|
|
2478
2478
|
});
|
|
2479
2479
|
}
|
|
2480
2480
|
if (expect.arguments.length > maxArgs) {
|
|
2481
|
+
if (expect.arguments.length === 2) {
|
|
2482
|
+
const isSecondArgString = expect.arguments[1].type === utils.AST_NODE_TYPES.Literal && typeof expect.arguments[1].value === "string";
|
|
2483
|
+
const isSecondArgTemplateLiteral = expect.arguments[1].type === utils.AST_NODE_TYPES.TemplateLiteral;
|
|
2484
|
+
if (isSecondArgString || isSecondArgTemplateLiteral) {
|
|
2485
|
+
return;
|
|
2486
|
+
}
|
|
2487
|
+
}
|
|
2481
2488
|
const { start } = expect.arguments[maxArgs].loc;
|
|
2482
2489
|
const { end } = expect.arguments[expect.arguments.length - 1].loc;
|
|
2483
2490
|
const loc = {
|
|
@@ -3237,7 +3244,6 @@ const validDescribeCallback = createEslintRule({
|
|
|
3237
3244
|
messages: {
|
|
3238
3245
|
nameAndCallback: "Describe requires a name and callback arguments",
|
|
3239
3246
|
secondArgumentMustBeFunction: "Second argument must be a function",
|
|
3240
|
-
noAsyncDescribeCallback: "Describe callback cannot be async",
|
|
3241
3247
|
unexpectedDescribeArgument: "Unexpected argument in describe callback",
|
|
3242
3248
|
unexpectedReturnInDescribe: "Unexpected return statement in describe callback"
|
|
3243
3249
|
},
|
|
@@ -3273,12 +3279,6 @@ const validDescribeCallback = createEslintRule({
|
|
|
3273
3279
|
});
|
|
3274
3280
|
return;
|
|
3275
3281
|
}
|
|
3276
|
-
if (callback.async) {
|
|
3277
|
-
context.report({
|
|
3278
|
-
messageId: "noAsyncDescribeCallback",
|
|
3279
|
-
node: callback
|
|
3280
|
-
});
|
|
3281
|
-
}
|
|
3282
3282
|
if (vitestFnCall.members.every((s) => getAccessorValue(s) !== "each") && callback.params.length) {
|
|
3283
3283
|
context.report({
|
|
3284
3284
|
messageId: "unexpectedDescribeArgument",
|
package/dist/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import ts from 'typescript';
|
|
|
5
5
|
import { fileURLToPath } from 'node:url';
|
|
6
6
|
import { createRequire } from 'node:module';
|
|
7
7
|
|
|
8
|
-
const version = "1.0.
|
|
8
|
+
const version = "1.0.4";
|
|
9
9
|
|
|
10
10
|
function createEslintRule(rule) {
|
|
11
11
|
const createRule = ESLintUtils.RuleCreator(
|
|
@@ -2459,6 +2459,13 @@ const validExpect = createEslintRule({
|
|
|
2459
2459
|
});
|
|
2460
2460
|
}
|
|
2461
2461
|
if (expect.arguments.length > maxArgs) {
|
|
2462
|
+
if (expect.arguments.length === 2) {
|
|
2463
|
+
const isSecondArgString = expect.arguments[1].type === AST_NODE_TYPES.Literal && typeof expect.arguments[1].value === "string";
|
|
2464
|
+
const isSecondArgTemplateLiteral = expect.arguments[1].type === AST_NODE_TYPES.TemplateLiteral;
|
|
2465
|
+
if (isSecondArgString || isSecondArgTemplateLiteral) {
|
|
2466
|
+
return;
|
|
2467
|
+
}
|
|
2468
|
+
}
|
|
2462
2469
|
const { start } = expect.arguments[maxArgs].loc;
|
|
2463
2470
|
const { end } = expect.arguments[expect.arguments.length - 1].loc;
|
|
2464
2471
|
const loc = {
|
|
@@ -3218,7 +3225,6 @@ const validDescribeCallback = createEslintRule({
|
|
|
3218
3225
|
messages: {
|
|
3219
3226
|
nameAndCallback: "Describe requires a name and callback arguments",
|
|
3220
3227
|
secondArgumentMustBeFunction: "Second argument must be a function",
|
|
3221
|
-
noAsyncDescribeCallback: "Describe callback cannot be async",
|
|
3222
3228
|
unexpectedDescribeArgument: "Unexpected argument in describe callback",
|
|
3223
3229
|
unexpectedReturnInDescribe: "Unexpected return statement in describe callback"
|
|
3224
3230
|
},
|
|
@@ -3254,12 +3260,6 @@ const validDescribeCallback = createEslintRule({
|
|
|
3254
3260
|
});
|
|
3255
3261
|
return;
|
|
3256
3262
|
}
|
|
3257
|
-
if (callback.async) {
|
|
3258
|
-
context.report({
|
|
3259
|
-
messageId: "noAsyncDescribeCallback",
|
|
3260
|
-
node: callback
|
|
3261
|
-
});
|
|
3262
|
-
}
|
|
3263
3263
|
if (vitestFnCall.members.every((s) => getAccessorValue(s) !== "each") && callback.params.length) {
|
|
3264
3264
|
context.report({
|
|
3265
3265
|
messageId: "unexpectedDescribeArgument",
|