eslint-plugin-jest 28.14.0 → 29.0.0
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/README.md +1 -1
- package/docs/rules/no-alias-methods.md +2 -4
- package/docs/rules/no-deprecated-functions.md +2 -2
- package/lib/index.js +0 -1
- package/lib/rules/expect-expect.js +2 -2
- package/lib/rules/no-commented-out-tests.js +3 -1
- package/lib/rules/no-conditional-expect.js +1 -1
- package/lib/rules/no-confusing-set-timeout.js +1 -1
- package/lib/rules/no-disabled-tests.js +1 -1
- package/lib/rules/no-done-callback.js +4 -2
- package/lib/rules/no-jasmine-globals.js +1 -1
- package/lib/rules/no-large-snapshots.js +2 -2
- package/lib/rules/no-test-return-statement.js +1 -1
- package/lib/rules/prefer-comparison-matcher.js +3 -1
- package/lib/rules/prefer-equality-matcher.js +3 -1
- package/lib/rules/prefer-importing-jest-globals.js +3 -1
- package/lib/rules/prefer-jest-mocked.js +1 -1
- package/lib/rules/prefer-mock-promise-shorthand.js +3 -1
- package/lib/rules/prefer-spy-on.js +1 -1
- package/lib/rules/prefer-to-contain.js +3 -1
- package/lib/rules/unbound-method.js +1 -8
- package/lib/rules/utils/misc.js +6 -34
- package/lib/rules/utils/padding.js +1 -1
- package/lib/rules/utils/parseJestFnCall.js +1 -5
- package/lib/rules/valid-expect.js +1 -1
- package/package.json +8 -9
package/README.md
CHANGED
|
@@ -329,7 +329,7 @@ Manually fixable by
|
|
|
329
329
|
| [expect-expect](docs/rules/expect-expect.md) | Enforce assertion to be made in a test body | | ✅ | | |
|
|
330
330
|
| [max-expects](docs/rules/max-expects.md) | Enforces a maximum number assertion calls in a test body | | | | |
|
|
331
331
|
| [max-nested-describe](docs/rules/max-nested-describe.md) | Enforces a maximum depth to nested describe calls | | | | |
|
|
332
|
-
| [no-alias-methods](docs/rules/no-alias-methods.md) | Disallow alias methods | ✅ |
|
|
332
|
+
| [no-alias-methods](docs/rules/no-alias-methods.md) | Disallow alias methods | ✅ | | 🔧 | |
|
|
333
333
|
| [no-commented-out-tests](docs/rules/no-commented-out-tests.md) | Disallow commented out tests | | ✅ | | |
|
|
334
334
|
| [no-conditional-expect](docs/rules/no-conditional-expect.md) | Disallow calling `expect` conditionally | ✅ | | | |
|
|
335
335
|
| [no-conditional-in-test](docs/rules/no-conditional-in-test.md) | Disallow conditional logic in tests | | | | |
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
# Disallow alias methods (`no-alias-methods`)
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[config](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).
|
|
5
|
-
This rule _warns_ in the 🎨 `style`
|
|
3
|
+
💼 This rule is enabled in the ✅ `recommended`
|
|
6
4
|
[config](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).
|
|
7
5
|
|
|
8
6
|
🔧 This rule is automatically fixable by the
|
|
@@ -10,7 +8,7 @@ This rule _warns_ in the 🎨 `style`
|
|
|
10
8
|
|
|
11
9
|
<!-- end auto-generated rule header -->
|
|
12
10
|
|
|
13
|
-
> These aliases
|
|
11
|
+
> These aliases have been removed in Jest v30 - see
|
|
14
12
|
> <https://github.com/jestjs/jest/issues/13164> for more
|
|
15
13
|
|
|
16
14
|
Several Jest methods have alias names, such as `toThrow` having the alias of
|
package/lib/index.js
CHANGED
|
@@ -68,7 +68,7 @@ var _default = exports.default = (0, _utils2.createRule)({
|
|
|
68
68
|
for (const node of nodes) {
|
|
69
69
|
const index = node.type === _utils.AST_NODE_TYPES.CallExpression ? unchecked.indexOf(node) : -1;
|
|
70
70
|
if (node.type === _utils.AST_NODE_TYPES.FunctionDeclaration) {
|
|
71
|
-
const declaredVariables =
|
|
71
|
+
const declaredVariables = context.sourceCode.getDeclaredVariables(node);
|
|
72
72
|
const testCallExpressions = (0, _utils2.getTestCallExpressionsFromDeclaredVariables)(declaredVariables, context);
|
|
73
73
|
checkCallExpressionUsed(testCallExpressions);
|
|
74
74
|
}
|
|
@@ -88,7 +88,7 @@ var _default = exports.default = (0, _utils2.createRule)({
|
|
|
88
88
|
unchecked.push(node);
|
|
89
89
|
} else if (matchesAssertFunctionName(name, assertFunctionNames)) {
|
|
90
90
|
// Return early in case of nested `it` statements.
|
|
91
|
-
checkCallExpressionUsed(
|
|
91
|
+
checkCallExpressionUsed(context.sourceCode.getAncestors(node));
|
|
92
92
|
}
|
|
93
93
|
},
|
|
94
94
|
'Program:exit'() {
|
|
@@ -22,7 +22,9 @@ var _default = exports.default = (0, _utils.createRule)({
|
|
|
22
22
|
},
|
|
23
23
|
defaultOptions: [],
|
|
24
24
|
create(context) {
|
|
25
|
-
const
|
|
25
|
+
const {
|
|
26
|
+
sourceCode
|
|
27
|
+
} = context;
|
|
26
28
|
function checkNode(node) {
|
|
27
29
|
if (!hasTests(node)) {
|
|
28
30
|
return;
|
|
@@ -28,7 +28,7 @@ var _default = exports.default = (0, _utils2.createRule)({
|
|
|
28
28
|
const decreaseConditionalDepth = () => inTestCase && conditionalDepth--;
|
|
29
29
|
return {
|
|
30
30
|
FunctionDeclaration(node) {
|
|
31
|
-
const declaredVariables =
|
|
31
|
+
const declaredVariables = context.sourceCode.getDeclaredVariables(node);
|
|
32
32
|
const testCallExpressions = (0, _utils2.getTestCallExpressionsFromDeclaredVariables)(declaredVariables, context);
|
|
33
33
|
if (testCallExpressions.length > 0) {
|
|
34
34
|
inTestCase = true;
|
|
@@ -36,7 +36,7 @@ var _default = exports.default = (0, _utils.createRule)({
|
|
|
36
36
|
shouldEmitOrderSetTimeout = true;
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
|
-
if (!['global', 'module'].includes(
|
|
39
|
+
if (!['global', 'module'].includes(context.sourceCode.getScope(node).type)) {
|
|
40
40
|
context.report({
|
|
41
41
|
messageId: 'globalSetTimeout',
|
|
42
42
|
node
|
|
@@ -44,7 +44,7 @@ var _default = exports.default = (0, _utils.createRule)({
|
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
46
|
'CallExpression[callee.name="pending"]'(node) {
|
|
47
|
-
if ((0, _utils.resolveScope)(
|
|
47
|
+
if ((0, _utils.resolveScope)(context.sourceCode.getScope(node), 'pending')) {
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
50
|
context.report({
|
|
@@ -79,7 +79,9 @@ var _default = exports.default = (0, _utils2.createRule)({
|
|
|
79
79
|
body,
|
|
80
80
|
params
|
|
81
81
|
} = callback;
|
|
82
|
-
const
|
|
82
|
+
const {
|
|
83
|
+
sourceCode
|
|
84
|
+
} = context;
|
|
83
85
|
const firstBodyToken = sourceCode.getFirstToken(body);
|
|
84
86
|
const lastBodyToken = sourceCode.getLastToken(body);
|
|
85
87
|
const [firstParam] = params;
|
|
@@ -92,7 +94,7 @@ var _default = exports.default = (0, _utils2.createRule)({
|
|
|
92
94
|
|
|
93
95
|
/* istanbul ignore if */
|
|
94
96
|
if (!firstBodyToken || !lastBodyToken || !tokenBeforeFirstParam || !tokenAfterLastParam) {
|
|
95
|
-
throw new Error(`Unexpected null when attempting to fix ${
|
|
97
|
+
throw new Error(`Unexpected null when attempting to fix ${context.filename} - please file a github issue at https://github.com/jest-community/eslint-plugin-jest`);
|
|
96
98
|
}
|
|
97
99
|
let argumentFix = fixer.replaceText(firstParam, '()');
|
|
98
100
|
if (tokenBeforeFirstParam.value === '(' && tokenAfterLastParam.value === ')') {
|
|
@@ -35,7 +35,7 @@ var _default = exports.default = (0, _utils2.createRule)({
|
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
37
|
if (calleeName === 'spyOn' || calleeName === 'spyOnProperty' || calleeName === 'fail' || calleeName === 'pending') {
|
|
38
|
-
if ((0, _utils2.resolveScope)(
|
|
38
|
+
if ((0, _utils2.resolveScope)(context.sourceCode.getScope(node), calleeName)) {
|
|
39
39
|
// It's a local variable, not a jasmine global.
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
@@ -20,7 +20,7 @@ const reportOnViolation = (context, node, {
|
|
|
20
20
|
}
|
|
21
21
|
let isAllowed = false;
|
|
22
22
|
if (node.type === _utils.AST_NODE_TYPES.ExpressionStatement && 'left' in node.expression && node.expression.left.type === _utils.AST_NODE_TYPES.MemberExpression && (0, _utils2.isSupportedAccessor)(node.expression.left.property)) {
|
|
23
|
-
const fileName =
|
|
23
|
+
const fileName = context.filename;
|
|
24
24
|
const allowedSnapshotsInFile = allowedSnapshots[fileName];
|
|
25
25
|
if (allowedSnapshotsInFile) {
|
|
26
26
|
const snapshotName = (0, _utils2.getAccessorValue)(node.expression.left.property);
|
|
@@ -75,7 +75,7 @@ var _default = exports.default = (0, _utils2.createRule)({
|
|
|
75
75
|
},
|
|
76
76
|
defaultOptions: [{}],
|
|
77
77
|
create(context, [options]) {
|
|
78
|
-
if (
|
|
78
|
+
if (context.filename.endsWith('.snap')) {
|
|
79
79
|
return {
|
|
80
80
|
ExpressionStatement(node) {
|
|
81
81
|
reportOnViolation(context, node, options);
|
|
@@ -43,7 +43,7 @@ var _default = exports.default = (0, _utils2.createRule)({
|
|
|
43
43
|
});
|
|
44
44
|
},
|
|
45
45
|
FunctionDeclaration(node) {
|
|
46
|
-
const declaredVariables =
|
|
46
|
+
const declaredVariables = context.sourceCode.getDeclaredVariables(node);
|
|
47
47
|
const testCallExpressions = (0, _utils2.getTestCallExpressionsFromDeclaredVariables)(declaredVariables, context);
|
|
48
48
|
if (testCallExpressions.length === 0) {
|
|
49
49
|
return;
|
|
@@ -85,7 +85,9 @@ var _default = exports.default = (0, _utils2.createRule)({
|
|
|
85
85
|
}
|
|
86
86
|
context.report({
|
|
87
87
|
fix(fixer) {
|
|
88
|
-
const
|
|
88
|
+
const {
|
|
89
|
+
sourceCode
|
|
90
|
+
} = context;
|
|
89
91
|
|
|
90
92
|
// preserve the existing modifier if it's not a negation
|
|
91
93
|
const modifierText = modifier && (0, _utils2.getAccessorValue)(modifier) !== 'not' ? `.${(0, _utils2.getAccessorValue)(modifier)}` : '';
|
|
@@ -53,7 +53,9 @@ var _default = exports.default = (0, _utils2.createRule)({
|
|
|
53
53
|
// value is itself negated by the "not" modifier
|
|
54
54
|
const addNotModifier = (comparison.operator === '!==' ? !matcherValue : matcherValue) === hasNot;
|
|
55
55
|
const buildFixer = equalityMatcher => fixer => {
|
|
56
|
-
const
|
|
56
|
+
const {
|
|
57
|
+
sourceCode
|
|
58
|
+
} = context;
|
|
57
59
|
|
|
58
60
|
// preserve the existing modifier if it's not a negation
|
|
59
61
|
let modifierText = modifier && (0, _utils2.getAccessorValue)(modifier) !== 'not' ? `.${(0, _utils2.getAccessorValue)(modifier)}` : '';
|
|
@@ -69,7 +69,9 @@ var _default = exports.default = (0, _utils2.createRule)({
|
|
|
69
69
|
jestFunctions: Array.from(functionsToImport).join(', ')
|
|
70
70
|
},
|
|
71
71
|
fix(fixer) {
|
|
72
|
-
const
|
|
72
|
+
const {
|
|
73
|
+
sourceCode
|
|
74
|
+
} = context;
|
|
73
75
|
const [firstNode] = sourceCode.ast.body;
|
|
74
76
|
|
|
75
77
|
// check if "use strict" directive exists
|
|
@@ -42,7 +42,7 @@ var _default = exports.default = (0, _utils2.createRule)({
|
|
|
42
42
|
if (left.type !== _utils.AST_NODE_TYPES.Identifier || right.type !== _utils.AST_NODE_TYPES.Identifier || left.name !== 'jest' || !mockTypes.includes(right.name)) {
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
|
-
const fnName =
|
|
45
|
+
const fnName = context.sourceCode.text.slice(...(0, _utils2.followTypeAssertionChain)(node.expression).range);
|
|
46
46
|
context.report({
|
|
47
47
|
node,
|
|
48
48
|
messageId: 'useJestMocked',
|
|
@@ -49,7 +49,9 @@ var _default = exports.default = (0, _utils2.createRule)({
|
|
|
49
49
|
replacement
|
|
50
50
|
},
|
|
51
51
|
fix(fixer) {
|
|
52
|
-
const
|
|
52
|
+
const {
|
|
53
|
+
sourceCode
|
|
54
|
+
} = context;
|
|
53
55
|
|
|
54
56
|
// there shouldn't be more than one argument, but if there is don't try
|
|
55
57
|
// fixing since we have no idea what to do with the extra arguments
|
|
@@ -34,7 +34,7 @@ const getAutoFixMockImplementation = (jestFnCall, context) => {
|
|
|
34
34
|
return '';
|
|
35
35
|
}
|
|
36
36
|
const [arg] = jestFnCall.arguments;
|
|
37
|
-
const argSource = arg &&
|
|
37
|
+
const argSource = arg && context.sourceCode.getText(arg);
|
|
38
38
|
return argSource ? `.mockImplementation(${argSource})` : '.mockImplementation()';
|
|
39
39
|
};
|
|
40
40
|
var _default = exports.default = (0, _utils2.createRule)({
|
|
@@ -58,7 +58,9 @@ var _default = exports.default = (0, _utils2.createRule)({
|
|
|
58
58
|
const hasNot = jestFnCall.modifiers.some(nod => (0, _utils2.getAccessorValue)(nod) === 'not');
|
|
59
59
|
context.report({
|
|
60
60
|
fix(fixer) {
|
|
61
|
-
const
|
|
61
|
+
const {
|
|
62
|
+
sourceCode
|
|
63
|
+
} = context;
|
|
62
64
|
|
|
63
65
|
// we need to negate the expectation if the current expected
|
|
64
66
|
// value is itself negated by the "not" modifier
|
|
@@ -21,8 +21,6 @@ const baseRule = (() => {
|
|
|
21
21
|
}
|
|
22
22
|
})();
|
|
23
23
|
const DEFAULT_MESSAGE = 'This rule requires `@typescript-eslint/eslint-plugin`';
|
|
24
|
-
|
|
25
|
-
// todo: remove these along with the actual runtime properties below in new major
|
|
26
24
|
var _default = exports.default = (0, _utils2.createRule)({
|
|
27
25
|
defaultOptions: [{
|
|
28
26
|
ignoreStatic: false
|
|
@@ -39,12 +37,7 @@ var _default = exports.default = (0, _utils2.createRule)({
|
|
|
39
37
|
...baseRule?.meta,
|
|
40
38
|
docs: {
|
|
41
39
|
description: 'Enforce unbound methods are called with their expected scope',
|
|
42
|
-
|
|
43
|
-
requiresTypeChecking: true,
|
|
44
|
-
...baseRule?.meta.docs,
|
|
45
|
-
// mark this as not recommended
|
|
46
|
-
/** @deprecated */
|
|
47
|
-
recommended: undefined
|
|
40
|
+
...baseRule?.meta.docs
|
|
48
41
|
}
|
|
49
42
|
},
|
|
50
43
|
create(context) {
|
package/lib/rules/utils/misc.js
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.getFirstMatcherArg = exports.
|
|
6
|
+
exports.getFirstMatcherArg = exports.findTopMostCallExpression = exports.createRule = exports.TestCaseName = exports.ModifierName = exports.HookName = exports.EqualityMatcher = exports.DescribeAlias = void 0;
|
|
7
7
|
exports.getNodeName = getNodeName;
|
|
8
|
-
exports.replaceAccessorFixer = exports.removeExtraArgumentsFixer = exports.isFunction = exports.isBooleanLiteral = exports.hasOnlyOneArgument = exports.getTestCallExpressionsFromDeclaredVariables =
|
|
8
|
+
exports.replaceAccessorFixer = exports.removeExtraArgumentsFixer = exports.isFunction = exports.isBooleanLiteral = exports.hasOnlyOneArgument = exports.getTestCallExpressionsFromDeclaredVariables = void 0;
|
|
9
9
|
var _path = require("path");
|
|
10
10
|
var _utils = require("@typescript-eslint/utils");
|
|
11
11
|
var _package = require("../../../package.json");
|
|
@@ -120,7 +120,9 @@ exports.replaceAccessorFixer = replaceAccessorFixer;
|
|
|
120
120
|
const removeExtraArgumentsFixer = (fixer, context, func, from) => {
|
|
121
121
|
const firstArg = func.arguments[from];
|
|
122
122
|
const lastArg = func.arguments[func.arguments.length - 1];
|
|
123
|
-
const
|
|
123
|
+
const {
|
|
124
|
+
sourceCode
|
|
125
|
+
} = context;
|
|
124
126
|
let tokenAfterLastParam = sourceCode.getTokenAfter(lastArg);
|
|
125
127
|
if (tokenAfterLastParam.value === ',') {
|
|
126
128
|
tokenAfterLastParam = sourceCode.getTokenAfter(tokenAfterLastParam);
|
|
@@ -156,34 +158,4 @@ const getFirstMatcherArg = expectFnCall => {
|
|
|
156
158
|
}
|
|
157
159
|
return (0, _followTypeAssertionChain.followTypeAssertionChain)(firstArg);
|
|
158
160
|
};
|
|
159
|
-
|
|
160
|
-
/* istanbul ignore next */
|
|
161
|
-
exports.getFirstMatcherArg = getFirstMatcherArg;
|
|
162
|
-
const getFilename = context => {
|
|
163
|
-
return context.filename ?? context.getFilename();
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
/* istanbul ignore next */
|
|
167
|
-
exports.getFilename = getFilename;
|
|
168
|
-
const getSourceCode = context => {
|
|
169
|
-
return context.sourceCode ?? context.getSourceCode();
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
/* istanbul ignore next */
|
|
173
|
-
exports.getSourceCode = getSourceCode;
|
|
174
|
-
const getScope = (context, node) => {
|
|
175
|
-
return getSourceCode(context).getScope?.(node) ?? context.getScope();
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
/* istanbul ignore next */
|
|
179
|
-
exports.getScope = getScope;
|
|
180
|
-
const getAncestors = (context, node) => {
|
|
181
|
-
return getSourceCode(context).getAncestors?.(node) ?? context.getAncestors();
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
/* istanbul ignore next */
|
|
185
|
-
exports.getAncestors = getAncestors;
|
|
186
|
-
const getDeclaredVariables = (context, node) => {
|
|
187
|
-
return getSourceCode(context).getDeclaredVariables?.(node) ?? context.getDeclaredVariables(node);
|
|
188
|
-
};
|
|
189
|
-
exports.getDeclaredVariables = getDeclaredVariables;
|
|
161
|
+
exports.getFirstMatcherArg = getFirstMatcherArg;
|
|
@@ -280,7 +280,7 @@ const createPaddingRule = (name, description, configs, deprecated = false) => {
|
|
|
280
280
|
create(context) {
|
|
281
281
|
const paddingContext = {
|
|
282
282
|
ruleContext: context,
|
|
283
|
-
sourceCode:
|
|
283
|
+
sourceCode: context.sourceCode,
|
|
284
284
|
scopeInfo: createScopeInfo(),
|
|
285
285
|
configs
|
|
286
286
|
};
|
|
@@ -50,10 +50,6 @@ const determineJestFnType = name => {
|
|
|
50
50
|
return 'unknown';
|
|
51
51
|
};
|
|
52
52
|
const ValidJestFnCallChains = ['afterAll', 'afterEach', 'beforeAll', 'beforeEach', 'describe', 'describe.each', 'describe.only', 'describe.only.each', 'describe.skip', 'describe.skip.each', 'fdescribe', 'fdescribe.each', 'xdescribe', 'xdescribe.each', 'it', 'it.concurrent', 'it.concurrent.failing', 'it.concurrent.each', 'it.concurrent.failing.each', 'it.concurrent.failing.only.each', 'it.concurrent.failing.skip.each', 'it.concurrent.only.each', 'it.concurrent.skip.each', 'it.each', 'it.failing', 'it.failing.each', 'it.only', 'it.only.each', 'it.only.failing', 'it.only.failing.each', 'it.skip', 'it.skip.each', 'it.skip.failing', 'it.skip.failing.each', 'it.todo', 'fit', 'fit.each', 'fit.failing', 'fit.failing.each', 'xit', 'xit.each', 'xit.failing', 'xit.failing.each', 'test', 'test.concurrent', 'test.concurrent.failing', 'test.concurrent.each', 'test.concurrent.failing.each', 'test.concurrent.failing.only.each', 'test.concurrent.failing.skip.each', 'test.concurrent.only.each', 'test.concurrent.skip.each', 'test.each', 'test.failing', 'test.failing.each', 'test.only', 'test.only.each', 'test.only.failing', 'test.only.failing.each', 'test.skip', 'test.skip.each', 'test.skip.failing', 'test.skip.failing.each', 'test.todo', 'xtest', 'xtest.each', 'xtest.failing', 'xtest.failing.each'];
|
|
53
|
-
|
|
54
|
-
// todo: switch back to using declaration merging once https://github.com/typescript-eslint/typescript-eslint/pull/8485
|
|
55
|
-
// is landed
|
|
56
|
-
|
|
57
53
|
const resolvePossibleAliasedGlobal = (global, context) => {
|
|
58
54
|
const globalAliases = context.settings.jest?.globalAliases ?? {};
|
|
59
55
|
const alias = Object.entries(globalAliases).find(([, aliases]) => aliases.includes(global));
|
|
@@ -301,7 +297,7 @@ const resolveScope = (scope, identifier) => {
|
|
|
301
297
|
exports.resolveScope = resolveScope;
|
|
302
298
|
const resolveToJestFn = (context, accessor) => {
|
|
303
299
|
const identifier = (0, _utils2.getAccessorValue)(accessor);
|
|
304
|
-
const maybeImport = resolveScope(
|
|
300
|
+
const maybeImport = resolveScope(context.sourceCode.getScope(accessor), identifier);
|
|
305
301
|
|
|
306
302
|
// the identifier was found as a local variable or function declaration
|
|
307
303
|
// meaning it's not a function from jest
|
|
@@ -286,7 +286,7 @@ var _default = exports.default = (0, _utils2.createRule)({
|
|
|
286
286
|
}
|
|
287
287
|
const returnStatement = node.parent?.type === _utils.AST_NODE_TYPES.ReturnStatement ? node.parent : null;
|
|
288
288
|
if (alwaysAwait && returnStatement) {
|
|
289
|
-
const sourceCodeText =
|
|
289
|
+
const sourceCodeText = context.sourceCode.getText(returnStatement);
|
|
290
290
|
const replacedText = sourceCodeText.replace('return', 'await');
|
|
291
291
|
fixes.push(fixer.replaceText(returnStatement, replacedText));
|
|
292
292
|
} else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-jest",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "29.0.0",
|
|
4
4
|
"description": "ESLint rules for Jest",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
]
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@typescript-eslint/utils": "^
|
|
70
|
+
"@typescript-eslint/utils": "^8.0.0"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@babel/cli": "^7.4.4",
|
|
@@ -80,10 +80,10 @@
|
|
|
80
80
|
"@schemastore/package": "^0.0.10",
|
|
81
81
|
"@semantic-release/changelog": "^6.0.0",
|
|
82
82
|
"@semantic-release/git": "^10.0.0",
|
|
83
|
-
"@tsconfig/
|
|
83
|
+
"@tsconfig/node20": "^20.0.0",
|
|
84
84
|
"@types/eslint": "^8.4.6",
|
|
85
85
|
"@types/jest": "^29.0.0",
|
|
86
|
-
"@types/node": "^
|
|
86
|
+
"@types/node": "^20.0.0",
|
|
87
87
|
"@types/semver": "^7.5.8",
|
|
88
88
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
89
89
|
"@typescript-eslint/parser": "^8.0.0",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"babel-jest": "^29.0.0",
|
|
92
92
|
"babel-plugin-replace-ts-export-assignment": "^0.0.2",
|
|
93
93
|
"dedent": "^1.5.0",
|
|
94
|
-
"eslint": "^
|
|
94
|
+
"eslint": "^8.57.0",
|
|
95
95
|
"eslint-config-prettier": "^10.0.0",
|
|
96
96
|
"eslint-doc-generator": "^2.0.0",
|
|
97
97
|
"eslint-plugin-eslint-plugin": "^6.0.0",
|
|
@@ -111,13 +111,12 @@
|
|
|
111
111
|
"rimraf": "^5.0.0",
|
|
112
112
|
"semantic-release": "^24.0.0",
|
|
113
113
|
"semver": "^7.3.5",
|
|
114
|
-
"strip-ansi": "^6.0.0",
|
|
115
114
|
"ts-node": "^10.2.1",
|
|
116
115
|
"typescript": "^5.0.4"
|
|
117
116
|
},
|
|
118
117
|
"peerDependencies": {
|
|
119
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
120
|
-
"eslint": "^
|
|
118
|
+
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
119
|
+
"eslint": "^8.57.0 || ^9.0.0",
|
|
121
120
|
"jest": "*"
|
|
122
121
|
},
|
|
123
122
|
"peerDependenciesMeta": {
|
|
@@ -130,7 +129,7 @@
|
|
|
130
129
|
},
|
|
131
130
|
"packageManager": "yarn@3.8.7",
|
|
132
131
|
"engines": {
|
|
133
|
-
"node": "^
|
|
132
|
+
"node": "^20.12.0 || ^22.0.0 || >=24.0.0"
|
|
134
133
|
},
|
|
135
134
|
"publishConfig": {
|
|
136
135
|
"provenance": true
|