@checkdigit/eslint-plugin 7.6.2-PR.108-484c → 7.6.2-PR.108-da5c
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.
|
@@ -33,7 +33,9 @@ var rule = createRule({
|
|
|
33
33
|
const { service, version } = match.groups;
|
|
34
34
|
assert.ok(service !== void 0 && version !== void 0);
|
|
35
35
|
for (const specifier of importDeclaration.specifiers) {
|
|
36
|
-
|
|
36
|
+
if (specifier.type === AST_NODE_TYPES.ImportSpecifier && specifier.imported.type === AST_NODE_TYPES.Identifier) {
|
|
37
|
+
importedServiceTypeMapping.set(specifier.local.name, `${service}.${specifier.imported.name}`);
|
|
38
|
+
}
|
|
37
39
|
}
|
|
38
40
|
const rangeStart = importDeclaration.specifiers[0]?.range[0];
|
|
39
41
|
assert.ok(rangeStart !== void 0);
|
|
@@ -61,14 +63,13 @@ var rule = createRule({
|
|
|
61
63
|
},
|
|
62
64
|
TSTypeReference(typeReference) {
|
|
63
65
|
if (typeReference.typeName.type === AST_NODE_TYPES.Identifier && importedServiceTypeMapping.has(typeReference.typeName.name)) {
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
assert.ok(serviceNamespace !== void 0);
|
|
66
|
+
const renamedTypeName = importedServiceTypeMapping.get(typeReference.typeName.name);
|
|
67
|
+
assert.ok(renamedTypeName !== void 0);
|
|
67
68
|
context.report({
|
|
68
69
|
messageId: "renameServiceTypeReference",
|
|
69
70
|
node: typeReference.typeName,
|
|
70
71
|
fix(fixer) {
|
|
71
|
-
return fixer.replaceText(typeReference.typeName,
|
|
72
|
+
return fixer.replaceText(typeReference.typeName, renamedTypeName);
|
|
72
73
|
}
|
|
73
74
|
});
|
|
74
75
|
}
|
|
@@ -81,4 +82,4 @@ export {
|
|
|
81
82
|
require_fixed_services_import_default as default,
|
|
82
83
|
ruleId
|
|
83
84
|
};
|
|
84
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
85
|
+
//# sourceMappingURL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Y7QUFBQSxNQUVBLGdCQUFnQixlQUF5QztBQUN2RCxZQUNFLGNBQWMsU0FBUyxTQUFTLGVBQWUsY0FDL0MsMkJBQTJCLElBQUksY0FBYyxTQUFTLElBQUksR0FDMUQ7QUFDQSxnQkFBTSxrQkFBa0IsMkJBQTJCLElBQUksY0FBYyxTQUFTLElBQUk7QUFDbEYsaUJBQU8sR0FBRyxvQkFBb0IsTUFBUztBQUN2QyxrQkFBUSxPQUFPO0FBQUEsWUFDYixXQUFXO0FBQUEsWUFDWCxNQUFNLGNBQWM7QUFBQSxZQUNwQixJQUFJLE9BQU87QUFDVCxxQkFBTyxNQUFNLFlBQVksY0FBYyxVQUFVLGVBQWU7QUFBQSxZQUNsRTtBQUFBLFVBQ0YsQ0FBQztBQUFBLFFBQ0g7QUFBQSxNQUNGO0FBQUEsSUFDRjtBQUFBLEVBQ0Y7QUFDRixDQUFDO0FBRUQsSUFBTyx3Q0FBUTsiLAogICJuYW1lcyI6IFtdCn0K
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@checkdigit/eslint-plugin","version":"7.6.2-PR.108-
|
|
1
|
+
{"name":"@checkdigit/eslint-plugin","version":"7.6.2-PR.108-da5c","description":"Check Digit eslint plugins","keywords":["eslint","eslintplugin"],"homepage":"https://github.com/checkdigit/eslint-plugin#readme","bugs":{"url":"https://github.com/checkdigit/eslint-plugin/issues"},"repository":{"type":"git","url":"https://github.com/checkdigit/eslint-plugin"},"license":"MIT","author":"Check Digit, LLC","sideEffects":false,"type":"module","exports":{".":{"types":"./dist-types/index.d.ts","import":"./dist-mjs/index.mjs","default":"./dist-mjs/index.mjs"}},"files":["src","dist-types","dist-mjs","!src/**/test/**","!src/**/*.test.ts","!src/**/*.spec.ts","!dist-types/**/test/**","!dist-types/**/*.test.d.ts","!dist-types/**/*.spec.d.ts","!dist-mjs/**/test/**","!dist-mjs/**/*.test.mjs","!dist-mjs/**/*.spec.mjs","SECURITY.md"],"scripts":{"build:dist-mjs":"rimraf dist-mjs && npx builder --type=module --sourceMap --outDir=dist-mjs && node dist-mjs/index.mjs","build:dist-types":"rimraf dist-types && npx builder --type=types --outDir=dist-types","ci:compile":"tsc --noEmit","ci:coverage":"NODE_OPTIONS=\"--disable-warning ExperimentalWarning --experimental-vm-modules\" jest --coverage=true","ci:lint":"npm run lint","ci:style":"npm run prettier","ci:test":"NODE_OPTIONS=\"--disable-warning ExperimentalWarning --experimental-vm-modules\" jest --coverage=false","lint":"eslint --max-warnings 0 .","lint:fix":"eslint --max-warnings 0 --fix .","prepare":"","prepublishOnly":"npm run build:dist-types && npm run build:dist-mjs","prettier":"prettier --ignore-path .gitignore --list-different .","prettier:fix":"prettier --ignore-path .gitignore --write .","test":"npm run ci:compile && npm run ci:test && npm run ci:lint && npm run ci:style"},"prettier":"@checkdigit/prettier-config","jest":{"preset":"@checkdigit/jest-config"},"dependencies":{"@typescript-eslint/type-utils":"^8.18.0","@typescript-eslint/utils":"^8.18.0","ts-api-utils":"^2.0.0"},"devDependencies":{"@checkdigit/jest-config":"^6.0.2","@checkdigit/prettier-config":"^6.0.0","@checkdigit/typescript-config":"^9.0.0","@eslint/js":"^9.16.0","@types/eslint":"^9.6.1","@types/eslint-config-prettier":"^6.11.3","@typescript-eslint/parser":"^8.18.0","@typescript-eslint/rule-tester":"^8.18.0","eslint":"^9.16.0","eslint-config-prettier":"^9.1.0","eslint-import-resolver-typescript":"^3.7.0","eslint-plugin-eslint-plugin":"^6.3.2","eslint-plugin-import":"^2.31.0","eslint-plugin-no-only-tests":"^3.3.0","eslint-plugin-no-secrets":"^2.1.1","eslint-plugin-node":"^11.1.0","eslint-plugin-sonarjs":"1.0.4","http-status-codes":"^2.3.0","rimraf":"^6.0.1","typescript-eslint":"^8.18.0"},"peerDependencies":{"eslint":">=9 <10"},"engines":{"node":">=20.17"}}
|
|
@@ -53,7 +53,12 @@ const rule: ESLintUtils.RuleModule<
|
|
|
53
53
|
|
|
54
54
|
// remember the type name and the corresponding service, which will be used to rename the references
|
|
55
55
|
for (const specifier of importDeclaration.specifiers) {
|
|
56
|
-
|
|
56
|
+
if (
|
|
57
|
+
specifier.type === AST_NODE_TYPES.ImportSpecifier &&
|
|
58
|
+
specifier.imported.type === AST_NODE_TYPES.Identifier
|
|
59
|
+
) {
|
|
60
|
+
importedServiceTypeMapping.set(specifier.local.name, `${service}.${specifier.imported.name}`);
|
|
61
|
+
}
|
|
57
62
|
}
|
|
58
63
|
|
|
59
64
|
const rangeStart = importDeclaration.specifiers[0]?.range[0];
|
|
@@ -89,14 +94,13 @@ const rule: ESLintUtils.RuleModule<
|
|
|
89
94
|
typeReference.typeName.type === AST_NODE_TYPES.Identifier &&
|
|
90
95
|
importedServiceTypeMapping.has(typeReference.typeName.name)
|
|
91
96
|
) {
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
assert.ok(serviceNamespace !== undefined);
|
|
97
|
+
const renamedTypeName = importedServiceTypeMapping.get(typeReference.typeName.name);
|
|
98
|
+
assert.ok(renamedTypeName !== undefined);
|
|
95
99
|
context.report({
|
|
96
100
|
messageId: 'renameServiceTypeReference',
|
|
97
101
|
node: typeReference.typeName,
|
|
98
102
|
fix(fixer) {
|
|
99
|
-
return fixer.replaceText(typeReference.typeName,
|
|
103
|
+
return fixer.replaceText(typeReference.typeName, renamedTypeName);
|
|
100
104
|
},
|
|
101
105
|
});
|
|
102
106
|
}
|