eslint-plugin-jest 28.8.0 → 28.8.2
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.
|
@@ -43,17 +43,9 @@ var _default = exports.default = (0, _utils2.createRule)({
|
|
|
43
43
|
const {
|
|
44
44
|
types = allJestFnTypes
|
|
45
45
|
} = context.options[0] || {};
|
|
46
|
-
const importedFunctionsWithSource = {};
|
|
47
46
|
const functionsToImport = new Set();
|
|
48
47
|
let reportingNode;
|
|
49
48
|
return {
|
|
50
|
-
ImportDeclaration(node) {
|
|
51
|
-
node.specifiers.forEach(specifier => {
|
|
52
|
-
if (specifier.type === _utils.AST_NODE_TYPES.ImportSpecifier) {
|
|
53
|
-
importedFunctionsWithSource[specifier.local.name] = node.source.value;
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
},
|
|
57
49
|
CallExpression(node) {
|
|
58
50
|
const jestFnCall = (0, _utils2.parseJestFnCall)(node, context);
|
|
59
51
|
if (!jestFnCall) {
|
|
@@ -69,7 +61,7 @@ var _default = exports.default = (0, _utils2.createRule)({
|
|
|
69
61
|
if (!reportingNode) {
|
|
70
62
|
return;
|
|
71
63
|
}
|
|
72
|
-
const isModule = context.parserOptions.sourceType === 'module';
|
|
64
|
+
const isModule = context.parserOptions.sourceType === 'module' || context.languageOptions?.sourceType === 'module';
|
|
73
65
|
context.report({
|
|
74
66
|
node: reportingNode,
|
|
75
67
|
messageId: 'preferImportingJestGlobal',
|