eslint-plugin-jest 28.13.3 → 28.13.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.
|
@@ -79,12 +79,15 @@ var _default = exports.default = (0, _utils2.createRule)({
|
|
|
79
79
|
const importNode = sourceCode.ast.body.find(node => node.type === _utils.AST_NODE_TYPES.ImportDeclaration && node.source.value === '@jest/globals');
|
|
80
80
|
if (importNode?.type === _utils.AST_NODE_TYPES.ImportDeclaration) {
|
|
81
81
|
for (const specifier of importNode.specifiers) {
|
|
82
|
-
if (specifier.type === _utils.AST_NODE_TYPES.ImportSpecifier
|
|
83
|
-
let importName = specifier.imported.name;
|
|
82
|
+
if (specifier.type === _utils.AST_NODE_TYPES.ImportSpecifier) {
|
|
83
|
+
let importName = specifier.imported.name ?? '';
|
|
84
84
|
const local = (0, _utils2.getAccessorValue)(specifier.local);
|
|
85
85
|
if (local !== importName) {
|
|
86
86
|
importName = `${importName} as ${local}`;
|
|
87
87
|
}
|
|
88
|
+
if ('value' in specifier.imported) {
|
|
89
|
+
importName = `'${specifier.imported.value}'${importName}`;
|
|
90
|
+
}
|
|
88
91
|
functionsToImport.add(importName);
|
|
89
92
|
}
|
|
90
93
|
if (specifier.type === _utils.AST_NODE_TYPES.ImportDefaultSpecifier) {
|
|
@@ -215,9 +215,13 @@ const describeImportDefAsImport = def => {
|
|
|
215
215
|
if (def.parent.importKind === 'type') {
|
|
216
216
|
return null;
|
|
217
217
|
}
|
|
218
|
+
let imported = def.node.imported.name ?? '';
|
|
219
|
+
if ('value' in def.node.imported) {
|
|
220
|
+
imported = def.node.imported.value;
|
|
221
|
+
}
|
|
218
222
|
return {
|
|
219
223
|
source: def.parent.source.value,
|
|
220
|
-
imported
|
|
224
|
+
imported,
|
|
221
225
|
local: def.node.local.name
|
|
222
226
|
};
|
|
223
227
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-jest",
|
|
3
|
-
"version": "28.13.
|
|
3
|
+
"version": "28.13.5",
|
|
4
4
|
"description": "ESLint rules for Jest",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -85,9 +85,9 @@
|
|
|
85
85
|
"@types/jest": "^29.0.0",
|
|
86
86
|
"@types/node": "^16.0.0",
|
|
87
87
|
"@types/semver": "^7.5.8",
|
|
88
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
89
|
-
"@typescript-eslint/parser": "^
|
|
90
|
-
"@typescript-eslint/utils": "^
|
|
88
|
+
"@typescript-eslint/eslint-plugin": "^7.0.0",
|
|
89
|
+
"@typescript-eslint/parser": "^7.0.0",
|
|
90
|
+
"@typescript-eslint/utils": "^7.0.0",
|
|
91
91
|
"babel-jest": "^29.0.0",
|
|
92
92
|
"babel-plugin-replace-ts-export-assignment": "^0.0.2",
|
|
93
93
|
"dedent": "^1.5.0",
|