@checkdigit/eslint-plugin 7.16.0-PR.137-7110 → 7.16.0-PR.137-66f8
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.
|
@@ -8,7 +8,7 @@ function isAwsSdkClientModule(importDeclaration) {
|
|
|
8
8
|
return typeof importDeclaration.source.value === "string" && importDeclaration.source.value.startsWith("@aws-sdk/client-");
|
|
9
9
|
}
|
|
10
10
|
function isAggregatedClient(name) {
|
|
11
|
-
return !name.endsWith("Client") && !name.endsWith("Command");
|
|
11
|
+
return !name.endsWith("Client") && !name.endsWith("Command") && !name.endsWith("Exception") && !name.endsWith("Input") && !name.endsWith("Output");
|
|
12
12
|
}
|
|
13
13
|
var rule = createRule({
|
|
14
14
|
name: ruleId,
|
|
@@ -30,7 +30,9 @@ var rule = createRule({
|
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
32
|
for (const specifier of node.specifiers) {
|
|
33
|
-
|
|
33
|
+
const isTypeImport = specifier.type === AST_NODE_TYPES.ImportSpecifier && specifier.importKind === "type";
|
|
34
|
+
const isException = specifier.local.name.endsWith("Exception");
|
|
35
|
+
if (specifier.type === AST_NODE_TYPES.ImportSpecifier && !isTypeImport && !isException && isAggregatedClient(specifier.local.name)) {
|
|
34
36
|
context.report({
|
|
35
37
|
node: specifier,
|
|
36
38
|
messageId: MESSAGE_ID_AGGREGATED_CLIENT,
|
|
@@ -48,4 +50,4 @@ export {
|
|
|
48
50
|
require_aws_bare_bones_default as default,
|
|
49
51
|
ruleId
|
|
50
52
|
};
|
|
51
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
53
|
+
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vc3JjL3JlcXVpcmUtYXdzLWJhcmUtYm9uZXMudHMiXSwKICAibWFwcGluZ3MiOiAiO0FBRUEsU0FBUyxnQkFBZ0IsbUJBQTZCO0FBQ3RELE9BQU8seUJBQ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QVc7QUFFN0QsY0FDRSxVQUFVLFNBQVMsZUFBZSxtQkFDbEMsQ0FBQyxnQkFDRCxDQUFDLGVBQ0QsbUJBQW1CLFVBQVUsTUFBTSxJQUFJLEdBQ3ZDO0FBQ0Esb0JBQVEsT0FBTztBQUFBLGNBQ2IsTUFBTTtBQUFBLGNBQ04sV0FBVztBQUFBLGNBQ1gsTUFBTSxFQUFFLFlBQVksVUFBVSxNQUFNLEtBQUs7QUFBQSxZQUMzQyxDQUFDO0FBQUEsVUFDSDtBQUFBLFFBQ0Y7QUFBQSxNQUNGO0FBQUEsSUFDRjtBQUFBLEVBQ0Y7QUFDRixDQUFDO0FBRUQsSUFBTyxpQ0FBUTsiLAogICJuYW1lcyI6IFtdCn0K
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@checkdigit/eslint-plugin","version":"7.16.0-PR.137-
|
|
1
|
+
{"name":"@checkdigit/eslint-plugin","version":"7.16.0-PR.137-66f8","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.46.0","@typescript-eslint/utils":"^8.46.0","http-status-codes":"^2.3.0","ts-api-utils":"^2.1.0"},"devDependencies":{"@checkdigit/jest-config":"^6.0.2","@checkdigit/prettier-config":"^6.1.0","@checkdigit/typescript-config":"^9.3.1","@eslint/js":"^9.37.0","@types/eslint":"^9.6.1","@types/eslint-config-prettier":"^6.11.3","@typescript-eslint/parser":"^8.46.0","@typescript-eslint/rule-tester":"^8.46.0","eslint":"^9.37.0","eslint-config-prettier":"^10.1.8","eslint-import-resolver-typescript":"^4.4.4","eslint-plugin-eslint-plugin":"^6.4.0","eslint-plugin-import":"^2.32.0","eslint-plugin-no-only-tests":"^3.3.0","eslint-plugin-no-secrets":"^2.2.1","eslint-plugin-node":"^11.1.0","eslint-plugin-sonarjs":"1.0.4","rimraf":"^6.0.1","typescript-eslint":"^8.46.0"},"peerDependencies":{"eslint":">=9 <10"},"engines":{"node":">=22.18"}}
|
|
@@ -14,8 +14,15 @@ function isAwsSdkClientModule(importDeclaration: TSESTree.ImportDeclaration): bo
|
|
|
14
14
|
);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
// Aggregated clients are higher-level helpers that should not be imported.
|
|
17
18
|
function isAggregatedClient(name: string): boolean {
|
|
18
|
-
return
|
|
19
|
+
return (
|
|
20
|
+
!name.endsWith('Client') &&
|
|
21
|
+
!name.endsWith('Command') &&
|
|
22
|
+
!name.endsWith('Exception') &&
|
|
23
|
+
!name.endsWith('Input') &&
|
|
24
|
+
!name.endsWith('Output')
|
|
25
|
+
);
|
|
19
26
|
}
|
|
20
27
|
|
|
21
28
|
const rule: ESLintUtils.RuleModule<typeof MESSAGE_ID_AGGREGATED_CLIENT> = createRule({
|
|
@@ -41,7 +48,15 @@ const rule: ESLintUtils.RuleModule<typeof MESSAGE_ID_AGGREGATED_CLIENT> = create
|
|
|
41
48
|
}
|
|
42
49
|
|
|
43
50
|
for (const specifier of node.specifiers) {
|
|
44
|
-
|
|
51
|
+
const isTypeImport = specifier.type === AST_NODE_TYPES.ImportSpecifier && specifier.importKind === 'type';
|
|
52
|
+
const isException = specifier.local.name.endsWith('Exception');
|
|
53
|
+
|
|
54
|
+
if (
|
|
55
|
+
specifier.type === AST_NODE_TYPES.ImportSpecifier &&
|
|
56
|
+
!isTypeImport &&
|
|
57
|
+
!isException &&
|
|
58
|
+
isAggregatedClient(specifier.local.name)
|
|
59
|
+
) {
|
|
45
60
|
context.report({
|
|
46
61
|
node: specifier,
|
|
47
62
|
messageId: MESSAGE_ID_AGGREGATED_CLIENT,
|