eslint-plugin-jest 28.8.1 → 28.8.3

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) {
@@ -98,7 +90,7 @@ var _default = exports.default = (0, _utils2.createRule)({
98
90
  }
99
91
  const requireNode = sourceCode.ast.body.find(node => node.type === _utils.AST_NODE_TYPES.VariableDeclaration && node.declarations.some(declaration => declaration.init?.type === _utils.AST_NODE_TYPES.CallExpression && (0, _utils2.isIdentifier)(declaration.init.callee, 'require') && (0, _utils2.isStringNode)(declaration.init.arguments[0], '@jest/globals') && (declaration.id.type === _utils.AST_NODE_TYPES.Identifier || declaration.id.type === _utils.AST_NODE_TYPES.ObjectPattern)));
100
92
  if (requireNode?.type !== _utils.AST_NODE_TYPES.VariableDeclaration) {
101
- return fixer.insertTextBefore(reportingNode, `${createFixerImports(isModule, functionsToImport)}\n`);
93
+ return fixer.insertTextBefore(firstNode, `${createFixerImports(isModule, functionsToImport)}\n`);
102
94
  }
103
95
  if (requireNode.declarations[0]?.id.type === _utils.AST_NODE_TYPES.ObjectPattern) {
104
96
  for (const property of requireNode.declarations[0].id.properties) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-jest",
3
- "version": "28.8.1",
3
+ "version": "28.8.3",
4
4
  "description": "ESLint rules for Jest",
5
5
  "keywords": [
6
6
  "eslint",