@vitest/eslint-plugin 1.6.7 → 1.6.9
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 +349 -377
- package/dist/{index.js → index.mjs} +102 -103
- package/package.json +34 -31
- /package/dist/{index.d.ts → index.d.mts} +0 -0
|
@@ -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.9";
|
|
8
8
|
|
|
9
9
|
//#endregion
|
|
10
10
|
//#region src/utils/index.ts
|
|
@@ -88,55 +88,55 @@ const require = createRequire(import.meta.url);
|
|
|
88
88
|
|
|
89
89
|
//#endregion
|
|
90
90
|
//#region src/utils/types.ts
|
|
91
|
-
let UtilName = /* @__PURE__ */ function(UtilName
|
|
92
|
-
UtilName
|
|
93
|
-
UtilName
|
|
94
|
-
return UtilName
|
|
91
|
+
let UtilName = /* @__PURE__ */ function(UtilName) {
|
|
92
|
+
UtilName["vi"] = "vi";
|
|
93
|
+
UtilName["vitest"] = "vitest";
|
|
94
|
+
return UtilName;
|
|
95
95
|
}({});
|
|
96
|
-
let DescribeAlias = /* @__PURE__ */ function(DescribeAlias
|
|
97
|
-
DescribeAlias
|
|
98
|
-
DescribeAlias
|
|
99
|
-
DescribeAlias
|
|
100
|
-
return DescribeAlias
|
|
96
|
+
let DescribeAlias = /* @__PURE__ */ function(DescribeAlias) {
|
|
97
|
+
DescribeAlias["describe"] = "describe";
|
|
98
|
+
DescribeAlias["fdescribe"] = "fdescribe";
|
|
99
|
+
DescribeAlias["xdescribe"] = "xdescribe";
|
|
100
|
+
return DescribeAlias;
|
|
101
101
|
}({});
|
|
102
|
-
let TestCaseName = /* @__PURE__ */ function(TestCaseName
|
|
103
|
-
TestCaseName
|
|
104
|
-
TestCaseName
|
|
105
|
-
TestCaseName
|
|
106
|
-
TestCaseName
|
|
107
|
-
TestCaseName
|
|
108
|
-
TestCaseName
|
|
109
|
-
return TestCaseName
|
|
102
|
+
let TestCaseName = /* @__PURE__ */ function(TestCaseName) {
|
|
103
|
+
TestCaseName["fit"] = "fit";
|
|
104
|
+
TestCaseName["it"] = "it";
|
|
105
|
+
TestCaseName["test"] = "test";
|
|
106
|
+
TestCaseName["xit"] = "xit";
|
|
107
|
+
TestCaseName["xtest"] = "xtest";
|
|
108
|
+
TestCaseName["bench"] = "bench";
|
|
109
|
+
return TestCaseName;
|
|
110
110
|
}({});
|
|
111
|
-
let HookName = /* @__PURE__ */ function(HookName
|
|
112
|
-
HookName
|
|
113
|
-
HookName
|
|
114
|
-
HookName
|
|
115
|
-
HookName
|
|
116
|
-
return HookName
|
|
111
|
+
let HookName = /* @__PURE__ */ function(HookName) {
|
|
112
|
+
HookName["beforeAll"] = "beforeAll";
|
|
113
|
+
HookName["beforeEach"] = "beforeEach";
|
|
114
|
+
HookName["afterAll"] = "afterAll";
|
|
115
|
+
HookName["afterEach"] = "afterEach";
|
|
116
|
+
return HookName;
|
|
117
117
|
}({});
|
|
118
|
-
let ModifierName = /* @__PURE__ */ function(ModifierName
|
|
119
|
-
ModifierName
|
|
120
|
-
ModifierName
|
|
121
|
-
ModifierName
|
|
122
|
-
ModifierName
|
|
123
|
-
ModifierName
|
|
124
|
-
ModifierName
|
|
125
|
-
ModifierName
|
|
126
|
-
ModifierName
|
|
127
|
-
ModifierName
|
|
128
|
-
ModifierName
|
|
129
|
-
ModifierName
|
|
130
|
-
ModifierName
|
|
131
|
-
ModifierName
|
|
132
|
-
ModifierName
|
|
133
|
-
return ModifierName
|
|
118
|
+
let ModifierName = /* @__PURE__ */ function(ModifierName) {
|
|
119
|
+
ModifierName["to"] = "to";
|
|
120
|
+
ModifierName["have"] = "have";
|
|
121
|
+
ModifierName["not"] = "not";
|
|
122
|
+
ModifierName["rejects"] = "rejects";
|
|
123
|
+
ModifierName["resolves"] = "resolves";
|
|
124
|
+
ModifierName["returns"] = "returns";
|
|
125
|
+
ModifierName["branded"] = "branded";
|
|
126
|
+
ModifierName["asserts"] = "asserts";
|
|
127
|
+
ModifierName["constructorParameters"] = "constructorParameters";
|
|
128
|
+
ModifierName["parameters"] = "parameters";
|
|
129
|
+
ModifierName["thisParameter"] = "thisParameter";
|
|
130
|
+
ModifierName["guards"] = "guards";
|
|
131
|
+
ModifierName["instance"] = "instance";
|
|
132
|
+
ModifierName["items"] = "items";
|
|
133
|
+
return ModifierName;
|
|
134
134
|
}({});
|
|
135
|
-
let EqualityMatcher = /* @__PURE__ */ function(EqualityMatcher
|
|
136
|
-
EqualityMatcher
|
|
137
|
-
EqualityMatcher
|
|
138
|
-
EqualityMatcher
|
|
139
|
-
return EqualityMatcher
|
|
135
|
+
let EqualityMatcher = /* @__PURE__ */ function(EqualityMatcher) {
|
|
136
|
+
EqualityMatcher["toBe"] = "toBe";
|
|
137
|
+
EqualityMatcher["toEqual"] = "toEqual";
|
|
138
|
+
EqualityMatcher["toStrictEqual"] = "toStrictEqual";
|
|
139
|
+
return EqualityMatcher;
|
|
140
140
|
}({});
|
|
141
141
|
function isClassOrFunctionType(type) {
|
|
142
142
|
if (type.getCallSignatures().length > 0) return true;
|
|
@@ -1649,7 +1649,7 @@ const parseVitestFnCallWithReasonInner = (node, context) => {
|
|
|
1649
1649
|
}
|
|
1650
1650
|
return result;
|
|
1651
1651
|
}
|
|
1652
|
-
if (chain.slice(0, chain.length - 1).some((node
|
|
1652
|
+
if (chain.slice(0, chain.length - 1).some((node) => node.parent?.type !== AST_NODE_TYPES.MemberExpression)) return null;
|
|
1653
1653
|
if (node.parent?.type === AST_NODE_TYPES.CallExpression || node.parent?.type === AST_NODE_TYPES.MemberExpression) return null;
|
|
1654
1654
|
return {
|
|
1655
1655
|
...parsedVitestFnCall,
|
|
@@ -1706,7 +1706,7 @@ const resolveScope = (scope, identifier) => {
|
|
|
1706
1706
|
const def = ref.defs[ref.defs.length - 1];
|
|
1707
1707
|
const objectParam = isFunction(def.node) ? def.node.params.find((params) => params.type === AST_NODE_TYPES.ObjectPattern) : void 0;
|
|
1708
1708
|
if (objectParam) {
|
|
1709
|
-
const property = objectParam.properties.find((property
|
|
1709
|
+
const property = objectParam.properties.find((property) => property.type === AST_NODE_TYPES.Property);
|
|
1710
1710
|
if ((property?.key.type === AST_NODE_TYPES.Identifier ? property.key : void 0)?.name === identifier) return "testContext";
|
|
1711
1711
|
}
|
|
1712
1712
|
/** if detect test function is created with `.extend()` */
|
|
@@ -3251,7 +3251,7 @@ var no_restricted_matchers_default = createEslintRule({
|
|
|
3251
3251
|
return { CallExpression(node) {
|
|
3252
3252
|
const vitestFnCall = parseVitestFnCall(node, context);
|
|
3253
3253
|
if (vitestFnCall?.type !== "expect") return;
|
|
3254
|
-
const chain = vitestFnCall.members.map((node
|
|
3254
|
+
const chain = vitestFnCall.members.map((node) => getAccessorValue(node)).join(".");
|
|
3255
3255
|
for (const [restriction, message] of Object.entries(restrictedChains)) if (isChainRestricted(chain, restriction)) {
|
|
3256
3256
|
context.report({
|
|
3257
3257
|
messageId: message ? "restrictedChainWithMessage" : "restrictedChain",
|
|
@@ -3511,28 +3511,28 @@ const followTypeAssertionChain = (expression) => isTypeCastExpression(expression
|
|
|
3511
3511
|
|
|
3512
3512
|
//#endregion
|
|
3513
3513
|
//#region src/utils/padding.ts
|
|
3514
|
-
let PaddingType = /* @__PURE__ */ function(PaddingType
|
|
3515
|
-
PaddingType
|
|
3516
|
-
PaddingType
|
|
3517
|
-
return PaddingType
|
|
3514
|
+
let PaddingType = /* @__PURE__ */ function(PaddingType) {
|
|
3515
|
+
PaddingType[PaddingType["Any"] = 0] = "Any";
|
|
3516
|
+
PaddingType[PaddingType["Always"] = 1] = "Always";
|
|
3517
|
+
return PaddingType;
|
|
3518
3518
|
}({});
|
|
3519
|
-
let StatementType = /* @__PURE__ */ function(StatementType
|
|
3520
|
-
StatementType
|
|
3521
|
-
StatementType
|
|
3522
|
-
StatementType
|
|
3523
|
-
StatementType
|
|
3524
|
-
StatementType
|
|
3525
|
-
StatementType
|
|
3526
|
-
StatementType
|
|
3527
|
-
StatementType
|
|
3528
|
-
StatementType
|
|
3529
|
-
StatementType
|
|
3530
|
-
StatementType
|
|
3531
|
-
StatementType
|
|
3532
|
-
StatementType
|
|
3533
|
-
StatementType
|
|
3534
|
-
StatementType
|
|
3535
|
-
return StatementType
|
|
3519
|
+
let StatementType = /* @__PURE__ */ function(StatementType) {
|
|
3520
|
+
StatementType[StatementType["Any"] = 0] = "Any";
|
|
3521
|
+
StatementType[StatementType["AfterAllToken"] = 1] = "AfterAllToken";
|
|
3522
|
+
StatementType[StatementType["AfterEachToken"] = 2] = "AfterEachToken";
|
|
3523
|
+
StatementType[StatementType["BeforeAllToken"] = 3] = "BeforeAllToken";
|
|
3524
|
+
StatementType[StatementType["BeforeEachToken"] = 4] = "BeforeEachToken";
|
|
3525
|
+
StatementType[StatementType["DescribeToken"] = 5] = "DescribeToken";
|
|
3526
|
+
StatementType[StatementType["ExpectToken"] = 6] = "ExpectToken";
|
|
3527
|
+
StatementType[StatementType["ExpectTypeOfToken"] = 7] = "ExpectTypeOfToken";
|
|
3528
|
+
StatementType[StatementType["FdescribeToken"] = 8] = "FdescribeToken";
|
|
3529
|
+
StatementType[StatementType["FitToken"] = 9] = "FitToken";
|
|
3530
|
+
StatementType[StatementType["ItToken"] = 10] = "ItToken";
|
|
3531
|
+
StatementType[StatementType["TestToken"] = 11] = "TestToken";
|
|
3532
|
+
StatementType[StatementType["XdescribeToken"] = 12] = "XdescribeToken";
|
|
3533
|
+
StatementType[StatementType["XitToken"] = 13] = "XitToken";
|
|
3534
|
+
StatementType[StatementType["XtestToken"] = 14] = "XtestToken";
|
|
3535
|
+
return StatementType;
|
|
3536
3536
|
}({});
|
|
3537
3537
|
const paddingAlwaysTester = (prevNode, nextNode, paddingContext) => {
|
|
3538
3538
|
const { sourceCode, ruleContext } = paddingContext;
|
|
@@ -3702,7 +3702,7 @@ const createPaddingRule = (name, description, configs, deprecated = false) => {
|
|
|
3702
3702
|
//#endregion
|
|
3703
3703
|
//#region src/rules/padding-around-after-all-blocks.ts
|
|
3704
3704
|
const RULE_NAME$51 = "padding-around-after-all-blocks";
|
|
3705
|
-
const config = [{
|
|
3705
|
+
const config$6 = [{
|
|
3706
3706
|
paddingType: PaddingType.Always,
|
|
3707
3707
|
prevStatementType: StatementType.Any,
|
|
3708
3708
|
nextStatementType: StatementType.AfterAllToken
|
|
@@ -3711,12 +3711,12 @@ const config = [{
|
|
|
3711
3711
|
prevStatementType: StatementType.AfterAllToken,
|
|
3712
3712
|
nextStatementType: StatementType.Any
|
|
3713
3713
|
}];
|
|
3714
|
-
var padding_around_after_all_blocks_default = createPaddingRule(RULE_NAME$51, "Enforce padding around `afterAll` blocks", config);
|
|
3714
|
+
var padding_around_after_all_blocks_default = createPaddingRule(RULE_NAME$51, "Enforce padding around `afterAll` blocks", config$6);
|
|
3715
3715
|
|
|
3716
3716
|
//#endregion
|
|
3717
3717
|
//#region src/rules/padding-around-after-each-blocks.ts
|
|
3718
3718
|
const RULE_NAME$50 = "padding-around-after-each-blocks";
|
|
3719
|
-
const config$
|
|
3719
|
+
const config$5 = [{
|
|
3720
3720
|
paddingType: PaddingType.Always,
|
|
3721
3721
|
prevStatementType: StatementType.Any,
|
|
3722
3722
|
nextStatementType: StatementType.AfterEachToken
|
|
@@ -3725,12 +3725,12 @@ const config$1 = [{
|
|
|
3725
3725
|
prevStatementType: StatementType.AfterEachToken,
|
|
3726
3726
|
nextStatementType: StatementType.Any
|
|
3727
3727
|
}];
|
|
3728
|
-
var padding_around_after_each_blocks_default = createPaddingRule(RULE_NAME$50, "Enforce padding around `afterEach` blocks", config$
|
|
3728
|
+
var padding_around_after_each_blocks_default = createPaddingRule(RULE_NAME$50, "Enforce padding around `afterEach` blocks", config$5);
|
|
3729
3729
|
|
|
3730
3730
|
//#endregion
|
|
3731
3731
|
//#region src/rules/padding-around-before-all-blocks.ts
|
|
3732
3732
|
const RULE_NAME$49 = "padding-around-before-all-blocks";
|
|
3733
|
-
const config$
|
|
3733
|
+
const config$4 = [{
|
|
3734
3734
|
paddingType: PaddingType.Always,
|
|
3735
3735
|
prevStatementType: StatementType.Any,
|
|
3736
3736
|
nextStatementType: StatementType.BeforeAllToken
|
|
@@ -3739,7 +3739,7 @@ const config$2 = [{
|
|
|
3739
3739
|
prevStatementType: StatementType.BeforeAllToken,
|
|
3740
3740
|
nextStatementType: StatementType.Any
|
|
3741
3741
|
}];
|
|
3742
|
-
var padding_around_before_all_blocks_default = createPaddingRule(RULE_NAME$49, "Enforce padding around `beforeAll` blocks", config$
|
|
3742
|
+
var padding_around_before_all_blocks_default = createPaddingRule(RULE_NAME$49, "Enforce padding around `beforeAll` blocks", config$4);
|
|
3743
3743
|
|
|
3744
3744
|
//#endregion
|
|
3745
3745
|
//#region src/rules/padding-around-before-each-blocks.ts
|
|
@@ -3758,7 +3758,7 @@ var padding_around_before_each_blocks_default = createPaddingRule(RULE_NAME$48,
|
|
|
3758
3758
|
//#endregion
|
|
3759
3759
|
//#region src/rules/padding-around-describe-blocks.ts
|
|
3760
3760
|
const RULE_NAME$47 = "padding-around-describe-blocks";
|
|
3761
|
-
const config$
|
|
3761
|
+
const config$2 = [{
|
|
3762
3762
|
paddingType: PaddingType.Always,
|
|
3763
3763
|
prevStatementType: StatementType.Any,
|
|
3764
3764
|
nextStatementType: [
|
|
@@ -3775,12 +3775,12 @@ const config$4 = [{
|
|
|
3775
3775
|
],
|
|
3776
3776
|
nextStatementType: StatementType.Any
|
|
3777
3777
|
}];
|
|
3778
|
-
var padding_around_describe_blocks_default = createPaddingRule(RULE_NAME$47, "Enforce padding around `describe` blocks", config$
|
|
3778
|
+
var padding_around_describe_blocks_default = createPaddingRule(RULE_NAME$47, "Enforce padding around `describe` blocks", config$2);
|
|
3779
3779
|
|
|
3780
3780
|
//#endregion
|
|
3781
3781
|
//#region src/rules/padding-around-expect-groups.ts
|
|
3782
3782
|
const RULE_NAME$46 = "padding-around-expect-groups";
|
|
3783
|
-
const config$
|
|
3783
|
+
const config$1 = [
|
|
3784
3784
|
{
|
|
3785
3785
|
paddingType: PaddingType.Always,
|
|
3786
3786
|
prevStatementType: StatementType.Any,
|
|
@@ -3812,12 +3812,12 @@ const config$5 = [
|
|
|
3812
3812
|
nextStatementType: StatementType.ExpectTypeOfToken
|
|
3813
3813
|
}
|
|
3814
3814
|
];
|
|
3815
|
-
var padding_around_expect_groups_default = createPaddingRule(RULE_NAME$46, "Enforce padding around `expect` groups", config$
|
|
3815
|
+
var padding_around_expect_groups_default = createPaddingRule(RULE_NAME$46, "Enforce padding around `expect` groups", config$1);
|
|
3816
3816
|
|
|
3817
3817
|
//#endregion
|
|
3818
3818
|
//#region src/rules/padding-around-test-blocks.ts
|
|
3819
3819
|
const RULE_NAME$45 = "padding-around-test-blocks";
|
|
3820
|
-
const config
|
|
3820
|
+
const config = [{
|
|
3821
3821
|
paddingType: PaddingType.Always,
|
|
3822
3822
|
prevStatementType: StatementType.Any,
|
|
3823
3823
|
nextStatementType: [
|
|
@@ -3838,19 +3838,19 @@ const config$6 = [{
|
|
|
3838
3838
|
],
|
|
3839
3839
|
nextStatementType: StatementType.Any
|
|
3840
3840
|
}];
|
|
3841
|
-
var padding_around_test_blocks_default = createPaddingRule(RULE_NAME$45, "Enforce padding around `test` blocks", config
|
|
3841
|
+
var padding_around_test_blocks_default = createPaddingRule(RULE_NAME$45, "Enforce padding around `test` blocks", config);
|
|
3842
3842
|
|
|
3843
3843
|
//#endregion
|
|
3844
3844
|
//#region src/rules/padding-around-all.ts
|
|
3845
3845
|
const RULE_NAME$44 = "padding-around-all";
|
|
3846
3846
|
var padding_around_all_default = createPaddingRule(RULE_NAME$44, "Enforce padding around vitest functions", [
|
|
3847
|
-
...config,
|
|
3848
|
-
...config$1,
|
|
3849
|
-
...config$2,
|
|
3850
|
-
...config$3,
|
|
3851
|
-
...config$4,
|
|
3847
|
+
...config$6,
|
|
3852
3848
|
...config$5,
|
|
3853
|
-
...config$
|
|
3849
|
+
...config$4,
|
|
3850
|
+
...config$3,
|
|
3851
|
+
...config$2,
|
|
3852
|
+
...config$1,
|
|
3853
|
+
...config
|
|
3854
3854
|
]);
|
|
3855
3855
|
|
|
3856
3856
|
//#endregion
|
|
@@ -4067,7 +4067,7 @@ var prefer_called_with_default = createEslintRule({
|
|
|
4067
4067
|
return { CallExpression(node) {
|
|
4068
4068
|
const vitestFnCall = parseVitestFnCall(node, context);
|
|
4069
4069
|
if (vitestFnCall?.type !== "expect") return;
|
|
4070
|
-
if (vitestFnCall.modifiers.some((node
|
|
4070
|
+
if (vitestFnCall.modifiers.some((node) => getAccessorValue(node) === "not")) return;
|
|
4071
4071
|
const { matcher } = vitestFnCall;
|
|
4072
4072
|
const matcherName = getAccessorValue(matcher);
|
|
4073
4073
|
if (["toBeCalled", "toHaveBeenCalled"].includes(matcherName)) context.report({
|
|
@@ -4305,7 +4305,7 @@ var prefer_equality_matcher_default = createEslintRule({
|
|
|
4305
4305
|
const [modifier] = vitestFnCall.modifiers;
|
|
4306
4306
|
const hasNot = vitestFnCall.modifiers.some((nod) => getAccessorValue(nod) === "not");
|
|
4307
4307
|
const addNotModifier = (comparison.operator === "!==" ? !matcherValue : matcherValue) === hasNot;
|
|
4308
|
-
const buildFixer
|
|
4308
|
+
const buildFixer = (equalityMatcher) => (fixer) => {
|
|
4309
4309
|
const { sourceCode } = context;
|
|
4310
4310
|
let modifierText = modifier && getAccessorValue(modifier) !== "not" ? `.${getAccessorValue(modifier)}` : "";
|
|
4311
4311
|
if (addNotModifier) modifierText += `.${ModifierName.not}`;
|
|
@@ -4324,7 +4324,7 @@ var prefer_equality_matcher_default = createEslintRule({
|
|
|
4324
4324
|
].map((equalityMatcher) => ({
|
|
4325
4325
|
messageId: "suggestEqualityMatcher",
|
|
4326
4326
|
data: { equalityMatcher },
|
|
4327
|
-
fix: buildFixer
|
|
4327
|
+
fix: buildFixer(equalityMatcher)
|
|
4328
4328
|
})),
|
|
4329
4329
|
node: matcher
|
|
4330
4330
|
});
|
|
@@ -4871,9 +4871,9 @@ var prefer_lowercase_title_default = createEslintRule({
|
|
|
4871
4871
|
node: node.arguments[0],
|
|
4872
4872
|
data: { method: vitestFnCall.name },
|
|
4873
4873
|
fix: (fixer) => {
|
|
4874
|
-
const description
|
|
4874
|
+
const description = getStringValue(firstArgument);
|
|
4875
4875
|
const rangeIgnoreQuotes = [firstArgument.range[0] + 1, firstArgument.range[1] - 1];
|
|
4876
|
-
const newDescription = lowercaseFirstCharacterOnly ? description
|
|
4876
|
+
const newDescription = lowercaseFirstCharacterOnly ? description.substring(0, 1).toLowerCase() + description.substring(1) : description.toLowerCase();
|
|
4877
4877
|
return [fixer.replaceTextRange(rangeIgnoreQuotes, newDescription)];
|
|
4878
4878
|
}
|
|
4879
4879
|
});
|
|
@@ -5268,7 +5268,7 @@ var prefer_to_be_object_default = createEslintRule({
|
|
|
5268
5268
|
invertCondition = matcherArg.type === AST_NODE_TYPES.Literal && followTypeAssertionChain$1(matcherArg).value === false;
|
|
5269
5269
|
}
|
|
5270
5270
|
if (invertCondition) {
|
|
5271
|
-
const notModifier = vitestFnCall.modifiers.find((node
|
|
5271
|
+
const notModifier = vitestFnCall.modifiers.find((node) => getAccessorValue(node) === "not");
|
|
5272
5272
|
fixes.push(notModifier ? fixer.removeRange([notModifier.range[0] - 1, notModifier.range[1]]) : fixer.insertTextBefore(vitestFnCall.matcher, "not."));
|
|
5273
5273
|
}
|
|
5274
5274
|
return fixes;
|
|
@@ -5356,7 +5356,7 @@ var prefer_to_be_default = createEslintRule({
|
|
|
5356
5356
|
const vitestFnCall = parseVitestFnCall(node, context);
|
|
5357
5357
|
if (vitestFnCall?.type !== "expect") return;
|
|
5358
5358
|
const matcherName = getAccessorValue(vitestFnCall.matcher);
|
|
5359
|
-
const notModifier = vitestFnCall.modifiers.find((node
|
|
5359
|
+
const notModifier = vitestFnCall.modifiers.find((node) => getAccessorValue(node) === "not");
|
|
5360
5360
|
if (notModifier && ["toBeUndefined", "toBeDefined"].includes(matcherName)) {
|
|
5361
5361
|
reportPreferToBe(context, matcherName === "toBeDefined" ? "Undefined" : "Defined", vitestFnCall, node, notModifier);
|
|
5362
5362
|
return;
|
|
@@ -6535,11 +6535,11 @@ var valid_title_default = createEslintRule({
|
|
|
6535
6535
|
const vitestFnCall = parseVitestFnCall(node, context);
|
|
6536
6536
|
if (vitestFnCall?.type !== "describe" && vitestFnCall?.type !== "test" && vitestFnCall?.type !== "it") return;
|
|
6537
6537
|
if (vitestFnCall.members.some((member) => ["extend", "scoped"].includes(getAccessorValue(member)))) return;
|
|
6538
|
-
const reportEmptyTitle = (node
|
|
6538
|
+
const reportEmptyTitle = (node) => {
|
|
6539
6539
|
context.report({
|
|
6540
6540
|
messageId: "emptyTitle",
|
|
6541
6541
|
data: { functionName: vitestFnCall.type === "describe" ? DescribeAlias.describe : TestCaseName.test },
|
|
6542
|
-
node
|
|
6542
|
+
node
|
|
6543
6543
|
});
|
|
6544
6544
|
};
|
|
6545
6545
|
const [argument] = node.arguments;
|
|
@@ -6811,18 +6811,18 @@ const rules = {
|
|
|
6811
6811
|
|
|
6812
6812
|
//#endregion
|
|
6813
6813
|
//#region src/index.ts
|
|
6814
|
-
const createConfig = (rules
|
|
6814
|
+
const createConfig = (rules) => Object.keys(rules).reduce((acc, ruleName) => {
|
|
6815
6815
|
return {
|
|
6816
6816
|
...acc,
|
|
6817
|
-
[`vitest/${ruleName}`]: rules
|
|
6817
|
+
[`vitest/${ruleName}`]: rules[ruleName]
|
|
6818
6818
|
};
|
|
6819
6819
|
}, {});
|
|
6820
|
-
const createConfigLegacy = (rules
|
|
6820
|
+
const createConfigLegacy = (rules) => ({
|
|
6821
6821
|
plugins: ["@vitest"],
|
|
6822
|
-
rules: Object.keys(rules
|
|
6822
|
+
rules: Object.keys(rules).reduce((acc, ruleName) => {
|
|
6823
6823
|
return {
|
|
6824
6824
|
...acc,
|
|
6825
|
-
[`@vitest/${ruleName}`]: rules
|
|
6825
|
+
[`@vitest/${ruleName}`]: rules[ruleName]
|
|
6826
6826
|
};
|
|
6827
6827
|
}, {})
|
|
6828
6828
|
});
|
|
@@ -6991,7 +6991,6 @@ const plugin = {
|
|
|
6991
6991
|
}
|
|
6992
6992
|
}
|
|
6993
6993
|
};
|
|
6994
|
-
var src_default = plugin;
|
|
6995
6994
|
|
|
6996
6995
|
//#endregion
|
|
6997
|
-
export {
|
|
6996
|
+
export { plugin as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitest/eslint-plugin",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.9",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ESLint plugin for Vitest",
|
|
6
6
|
"repository": "vitest-dev/eslint-plugin-vitest",
|
|
@@ -15,11 +15,15 @@
|
|
|
15
15
|
"author": "Verite Mugabo <https://veritemugabo.com/>",
|
|
16
16
|
"type": "module",
|
|
17
17
|
"main": "./dist/index.cjs",
|
|
18
|
-
"module": "./dist/index.
|
|
19
|
-
"types": "./dist/index.d.
|
|
18
|
+
"module": "./dist/index.mjs",
|
|
19
|
+
"types": "./dist/index.d.mts",
|
|
20
20
|
"exports": {
|
|
21
21
|
".": {
|
|
22
|
-
"
|
|
22
|
+
"types": {
|
|
23
|
+
"import": "./dist/index.d.mts",
|
|
24
|
+
"require": "./dist/index.d.cts"
|
|
25
|
+
},
|
|
26
|
+
"import": "./dist/index.mjs",
|
|
23
27
|
"require": "./dist/index.cjs"
|
|
24
28
|
},
|
|
25
29
|
"./package.json": "./package.json"
|
|
@@ -27,45 +31,32 @@
|
|
|
27
31
|
"files": [
|
|
28
32
|
"dist"
|
|
29
33
|
],
|
|
30
|
-
"scripts": {
|
|
31
|
-
"build": "tsdown --format esm --format cjs",
|
|
32
|
-
"typecheck": "tsc --noEmit",
|
|
33
|
-
"lint": "concurrently --prefixColors auto \"pnpm:lint:*\"",
|
|
34
|
-
"lint:eslint-docs": "pnpm build && eslint-doc-generator --check",
|
|
35
|
-
"lint:js": "eslint",
|
|
36
|
-
"release": "bumpp && pnpm build && pnpm publish",
|
|
37
|
-
"format": "prettier --check .",
|
|
38
|
-
"test": "vitest",
|
|
39
|
-
"update:chains": "node scripts/chain-permutations.ts",
|
|
40
|
-
"update:rules": "node scripts/export-rules.ts",
|
|
41
|
-
"update:eslint-docs": "pnpm build && eslint-doc-generator"
|
|
42
|
-
},
|
|
43
34
|
"dependencies": {
|
|
44
35
|
"@typescript-eslint/scope-manager": "^8.55.0",
|
|
45
36
|
"@typescript-eslint/utils": "^8.55.0"
|
|
46
37
|
},
|
|
47
38
|
"devDependencies": {
|
|
48
|
-
"@eslint/js": "^
|
|
39
|
+
"@eslint/js": "^10.0.1",
|
|
49
40
|
"@types/eslint": "^9.6.1",
|
|
50
|
-
"@types/node": "^
|
|
41
|
+
"@types/node": "^25.2.3",
|
|
51
42
|
"@typescript-eslint/parser": "^8.55.0",
|
|
52
43
|
"@typescript-eslint/rule-tester": "^8.55.0",
|
|
53
|
-
"bumpp": "^10.
|
|
44
|
+
"bumpp": "^10.4.1",
|
|
54
45
|
"concurrently": "^9.2.1",
|
|
55
|
-
"eslint": "^
|
|
46
|
+
"eslint": "^10.0.0",
|
|
56
47
|
"eslint-config-flat-gitignore": "^2.1.0",
|
|
57
48
|
"eslint-config-prettier": "^10.1.8",
|
|
58
|
-
"eslint-doc-generator": "^3.0.
|
|
59
|
-
"eslint-plugin-eslint-plugin": "^7.
|
|
60
|
-
"eslint-remote-tester": "^4.0.
|
|
49
|
+
"eslint-doc-generator": "^3.0.2",
|
|
50
|
+
"eslint-plugin-eslint-plugin": "^7.3.1",
|
|
51
|
+
"eslint-remote-tester": "^4.0.4",
|
|
61
52
|
"eslint-remote-tester-repositories": "^2.0.2",
|
|
62
53
|
"jiti": "^2.6.1",
|
|
63
|
-
"prettier": "^3.
|
|
64
|
-
"tsdown": "^0.
|
|
65
|
-
"tsx": "^4.
|
|
54
|
+
"prettier": "^3.8.1",
|
|
55
|
+
"tsdown": "^0.20.3",
|
|
56
|
+
"tsx": "^4.21.0",
|
|
66
57
|
"typescript": "^5.9.3",
|
|
67
|
-
"typescript-eslint": "^8.
|
|
68
|
-
"vitest": "^
|
|
58
|
+
"typescript-eslint": "^8.55.0",
|
|
59
|
+
"vitest": "^4.0.18"
|
|
69
60
|
},
|
|
70
61
|
"peerDependencies": {
|
|
71
62
|
"eslint": ">=8.57.0",
|
|
@@ -80,7 +71,6 @@
|
|
|
80
71
|
"optional": true
|
|
81
72
|
}
|
|
82
73
|
},
|
|
83
|
-
"packageManager": "pnpm@10.18.3+sha512.bbd16e6d7286fd7e01f6b3c0b3c932cda2965c06a908328f74663f10a9aea51f1129eea615134bf992831b009eabe167ecb7008b597f40ff9bc75946aadfb08d",
|
|
84
74
|
"engines": {
|
|
85
75
|
"node": ">=18"
|
|
86
76
|
},
|
|
@@ -88,5 +78,18 @@
|
|
|
88
78
|
"semi": false,
|
|
89
79
|
"singleQuote": true,
|
|
90
80
|
"endOfLine": "auto"
|
|
81
|
+
},
|
|
82
|
+
"scripts": {
|
|
83
|
+
"build": "tsdown --format esm --format cjs",
|
|
84
|
+
"typecheck": "tsc --noEmit",
|
|
85
|
+
"lint": "concurrently --prefixColors auto \"pnpm:lint:*\"",
|
|
86
|
+
"lint:eslint-docs": "pnpm build && eslint-doc-generator --check",
|
|
87
|
+
"lint:js": "eslint",
|
|
88
|
+
"release": "bumpp && pnpm build && pnpm publish",
|
|
89
|
+
"format": "prettier --check .",
|
|
90
|
+
"test": "vitest",
|
|
91
|
+
"update:chains": "node scripts/chain-permutations.ts",
|
|
92
|
+
"update:rules": "node scripts/export-rules.ts",
|
|
93
|
+
"update:eslint-docs": "pnpm build && eslint-doc-generator"
|
|
91
94
|
}
|
|
92
|
-
}
|
|
95
|
+
}
|
|
File without changes
|