@checkdigit/eslint-plugin 7.8.0-PR.97-d090 → 7.8.0-PR.97-a3ad
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.
|
@@ -71,4 +71,4 @@ export {
|
|
|
71
71
|
no_status_code_assert_default as default,
|
|
72
72
|
ruleId
|
|
73
73
|
};
|
|
74
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
74
|
+
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vc3JjL25vLXN0YXR1cy1jb2RlLWFzc2VydC50cyJdLAogICJtYXBwaW5ncyI6ICI7QUFRQSxTQUFTLG1CQUFtQjtBQUU1QixTQUFTLGdCQUFnQixtQkFBdUM7QUFDaEUsT0FBTyx5QkFBeUI7QUFFekIsSUFBTSxTQUFTO0FBQ3RCLElBQU0sd0JBQXdCO0FBRTlCLElBQU0sY0FBYztBQUFBLEVBQ2xCLFlBQVk7QUFBQSxFQUNaLFlBQVk7QUFBQSxFQUNaLFlBQVk7QUFBQSxFQUNaLFlBQVk7QUFBQSxFQUNaLFlBQVk7QUFBQSxFQUNaLFlBQVk7QUFBQSxFQUNaLFlBQVk7QUFBQSxFQUNaLFlBQVk7QUFDZDtBQUVBLElBQU0sYUFBYSxZQUFZLFlBQVksQ0FBQyxTQUFTLG9CQUFvQixJQUFJLENBQUM7QUFHOUUsSUFBTSx1QkFBdUIsQ0FBQyxRQUFnQztBQUM1RCxRQUFNLHNCQUFzQixDQUFDLFVBQTJCLFlBQVksU0FBUyxLQUFLO0FBRWxGLFVBQVEsSUFBSSxNQUFNO0FBQUEsSUFDaEIsS0FBSyxlQUFlO0FBQ2xCLFVBQUksT0FBTyxJQUFJLFVBQVUsVUFBVTtBQUNqQyxlQUFPLG9CQUFvQixJQUFJLEtBQUs7QUFBQSxNQUN0QztBQUNBO0FBQUEsSUFDRixLQUFLLGVBQWUsa0JBQWtCO0FBQ3BDLFl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UFBLE1BQ0wsZUFBZSxNQUErQjtBQUM1QyxjQUFNLFNBQVMsS0FBSztBQUNwQixZQUFJLDJCQUEyQixRQUFRLEtBQUssU0FBUyxHQUFHO0FBQ3RELGtCQUFRLE9BQU87QUFBQSxZQUNiO0FBQUEsWUFDQSxXQUFXO0FBQUEsVUFDYixDQUFDO0FBQUEsUUFDSDtBQUFBLE1BQ0Y7QUFBQSxJQUNGO0FBQUEsRUFDRjtBQUNGLENBQUM7QUFFRCxJQUFPLGdDQUFROyIsCiAgIm5hbWVzIjogW10KfQo=
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@checkdigit/eslint-plugin","version":"7.8.0-PR.97-
|
|
1
|
+
{"name":"@checkdigit/eslint-plugin","version":"7.8.0-PR.97-a3ad","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.1","@typescript-eslint/utils":"^8.18.1","http-status-codes":"^2.3.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.17.0","@types/eslint":"^9.6.1","@types/eslint-config-prettier":"^6.11.3","@typescript-eslint/parser":"^8.18.1","@typescript-eslint/rule-tester":"^8.18.1","eslint":"^9.17.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","rimraf":"^6.0.1","typescript-eslint":"^8.18.1"},"peerDependencies":{"eslint":">=9 <10"},"engines":{"node":">=20.17"}}
|
|
@@ -27,12 +27,7 @@ const statusCodes = [
|
|
|
27
27
|
|
|
28
28
|
const createRule = ESLintUtils.RuleCreator((name) => getDocumentationUrl(name));
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
* Checks if a given AST node contains any status code value.
|
|
32
|
-
*
|
|
33
|
-
* @param arg - The AST node to check.
|
|
34
|
-
* @returns `true` if the node or its sub-nodes contain any status code value, otherwise `false`.
|
|
35
|
-
*/
|
|
30
|
+
// Checks if a given AST node contains any status code value.
|
|
36
31
|
const hasStatusCodeOrValue = (arg: TSESTree.Node): boolean => {
|
|
37
32
|
const isStatusCodeLiteral = (value: number): boolean => statusCodes.includes(value);
|
|
38
33
|
|
|
@@ -60,34 +55,19 @@ const hasStatusCodeOrValue = (arg: TSESTree.Node): boolean => {
|
|
|
60
55
|
return false;
|
|
61
56
|
};
|
|
62
57
|
|
|
63
|
-
|
|
64
|
-
* Checks if a given AST node is an identifier with the name 'assert'.
|
|
65
|
-
*
|
|
66
|
-
* @param node - The AST node to check.
|
|
67
|
-
* @returns `true` if the node is an identifier with the name 'assert', otherwise `false`.
|
|
68
|
-
*/
|
|
58
|
+
// Checks if a given AST node is an identifier with the name 'assert'.
|
|
69
59
|
const isAssertIdentifier = (node: TSESTree.Node): boolean =>
|
|
70
60
|
node.type === AST_NODE_TYPES.Identifier && node.name === 'assert';
|
|
71
61
|
|
|
72
|
-
|
|
73
|
-
* Checks if a given AST node is a member expression with the object named 'assert'.
|
|
74
|
-
*
|
|
75
|
-
* @param node - The AST node to check.
|
|
76
|
-
* @returns `true` if the node is a member expression with the object named 'assert', otherwise `false`.
|
|
77
|
-
*/
|
|
62
|
+
// Checks if a given AST node is a member expression with the object named 'assert'.
|
|
78
63
|
const isAssertMemberExpression = (node: TSESTree.Node): boolean =>
|
|
79
64
|
node.type === AST_NODE_TYPES.MemberExpression &&
|
|
80
65
|
node.object.type === AST_NODE_TYPES.Identifier &&
|
|
81
66
|
node.object.name === 'assert' &&
|
|
82
67
|
node.property.type === AST_NODE_TYPES.Identifier;
|
|
83
68
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
*
|
|
87
|
-
* @returns `true` if the node is an identifier with the name 'assert', otherwise `false`.
|
|
88
|
-
* @param callee
|
|
89
|
-
* @param args
|
|
90
|
-
*/
|
|
69
|
+
//Checks if a given AST node is an identifier with the name 'assert'.
|
|
70
|
+
|
|
91
71
|
const isAssertCallWithStatusCode = (callee: TSESTree.Node, args: TSESTree.Node[]): boolean =>
|
|
92
72
|
(isAssertIdentifier(callee) || isAssertMemberExpression(callee)) &&
|
|
93
73
|
args.some((arg) => hasStatusCodeOrValue(arg) && arg.type !== AST_NODE_TYPES.Identifier);
|