@checkdigit/eslint-plugin 7.2.0-PR.89-33fa → 7.2.0-PR.91-31da
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.
- package/README.md +0 -1
- package/dist-mjs/agent/no-serve-runtime.mjs +37 -0
- package/dist-mjs/index.mjs +6 -7
- package/dist-types/agent/no-serve-runtime.d.ts +4 -0
- package/package.json +1 -1
- package/src/agent/no-serve-runtime.ts +43 -0
- package/src/index.ts +3 -4
- package/dist-mjs/no-random-v4-uuid.mjs +0 -67
- package/dist-types/no-random-v4-uuid.d.ts +0 -5
- package/src/no-random-v4-uuid.ts +0 -92
package/README.md
CHANGED
|
@@ -6,7 +6,6 @@ Copyright (c) 2021-2024 [Check Digit, LLC](https://checkdigit.com)
|
|
|
6
6
|
|
|
7
7
|
- `@checkdigit/no-card-numbers`
|
|
8
8
|
- `@checkdigit/file-path-comment`
|
|
9
|
-
- `@checkdigit/no-random-v4-uuid`
|
|
10
9
|
- `@checkdigit/no-uuid`
|
|
11
10
|
- `@checkdigit/require-strict-assert`
|
|
12
11
|
- `@checkdigit/no-wallaby-comment`
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// src/agent/no-serve-runtime.ts
|
|
2
|
+
import { ESLintUtils } from "@typescript-eslint/utils";
|
|
3
|
+
import getDocumentationUrl from "../get-documentation-url.mjs";
|
|
4
|
+
var ruleId = "no-serve-runtime";
|
|
5
|
+
var createRule = ESLintUtils.RuleCreator((name) => getDocumentationUrl(name));
|
|
6
|
+
var rule = createRule({
|
|
7
|
+
name: ruleId,
|
|
8
|
+
meta: {
|
|
9
|
+
type: "problem",
|
|
10
|
+
docs: {
|
|
11
|
+
description: "@checkdigit/serve-runtime should not be used."
|
|
12
|
+
},
|
|
13
|
+
messages: {
|
|
14
|
+
noServeRuntime: "Please remove the usage of @checkdigit/serve-runtime."
|
|
15
|
+
},
|
|
16
|
+
schema: []
|
|
17
|
+
},
|
|
18
|
+
defaultOptions: [],
|
|
19
|
+
create(context) {
|
|
20
|
+
return {
|
|
21
|
+
ImportDeclaration: (importDeclaration) => {
|
|
22
|
+
if (importDeclaration.source.value === "@checkdigit/serve-runtime") {
|
|
23
|
+
context.report({
|
|
24
|
+
messageId: "noServeRuntime",
|
|
25
|
+
node: importDeclaration
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
var no_serve_runtime_default = rule;
|
|
33
|
+
export {
|
|
34
|
+
no_serve_runtime_default as default,
|
|
35
|
+
ruleId
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vc3JjL2FnZW50L25vLXNlcnZlLXJ1bnRpbWUudHMiXSwKICAibWFwcGluZ3MiOiAiO0FBUUEsU0FBUyxtQkFBNkI7QUFDdEMsT0FBTyx5QkFBeUI7QUFFekIsSUFBTSxTQUFTO0FBRXRCLElBQU0sYUFBYSxZQUFZLFlBQVksQ0FBQyxTQUFTLG9CQUFvQixJQUFJLENBQUM7QUFFOUUsSUFBTSxPQUFpRCxXQUFXO0FBQUEsRUFDaEUsTUFBTTtBQUFBLEVBQ04sTUFBTTtBQUFBLElBQ0osTUFBTTtBQUFBLElBQ04sTUFBTTtBQUFBLE1BQ0osYUFBYTtBQUFBLElBQ2Y7QUFBQSxJQUNBLFVBQVU7QUFBQSxNQUNSLGdCQUFnQjtBQUFBLElBQ2xCO0FBQUEsSUFDQSxRQUFRLENBQUM7QUFBQSxFQUNYO0FBQUEsRUFDQSxnQkFBZ0IsQ0FBQztBQUFBLEVBQ2pCLE9BQU8sU0FBUztBQUNkLFdBQU87QUFBQSxNQUNMLG1CQUFtQixDQUFDLHNCQUFrRDtBQUNwRSxZQUFJLGtCQUFrQixPQUFPLFVBQVUsNkJBQTZCO0FBQ2xFLGtCQUFRLE9BQU87QUFBQSxZQUNiLFdBQVc7QUFBQSxZQUNYLE1BQU07QUFBQSxVQUNSLENBQUM7QUFBQSxRQUNIO0FBQUEsTUFDRjtBQUFBLElBQ0Y7QUFBQSxFQUNGO0FBQ0YsQ0FBQztBQUVELElBQU8sMkJBQVE7IiwKICAibmFtZXMiOiBbXQp9Cg==
|
package/dist-mjs/index.mjs
CHANGED
|
@@ -12,9 +12,9 @@ import requireResolveFullResponse, {
|
|
|
12
12
|
import requireTypeOutOfTypeOnlyImports, {
|
|
13
13
|
ruleId as requireTypeOutOfTypeOnlyImportsRuleId
|
|
14
14
|
} from "./require-type-out-of-type-only-imports.mjs";
|
|
15
|
+
import noServeRuntime, { ruleId as noServeRuntimeRuleId } from "./agent/no-serve-runtime.mjs";
|
|
15
16
|
import filePathComment from "./file-path-comment.mjs";
|
|
16
17
|
import noCardNumbers from "./no-card-numbers.mjs";
|
|
17
|
-
import noRandomV4UUID from "./no-random-v4-uuid.mjs";
|
|
18
18
|
import noTestImport from "./no-test-import.mjs";
|
|
19
19
|
import noUuid from "./no-uuid.mjs";
|
|
20
20
|
import noWallabyComment from "./no-wallaby-comment.mjs";
|
|
@@ -25,7 +25,6 @@ import requireStrictAssert from "./require-strict-assert.mjs";
|
|
|
25
25
|
var rules = {
|
|
26
26
|
"file-path-comment": filePathComment,
|
|
27
27
|
"no-card-numbers": noCardNumbers,
|
|
28
|
-
"no-random-v4-uuid": noRandomV4UUID,
|
|
29
28
|
"no-uuid": noUuid,
|
|
30
29
|
"require-strict-assert": requireStrictAssert,
|
|
31
30
|
"no-test-import": noTestImport,
|
|
@@ -39,7 +38,8 @@ var rules = {
|
|
|
39
38
|
[requireResolveFullResponseRuleId]: requireResolveFullResponse,
|
|
40
39
|
[requireTypeOutOfTypeOnlyImportsRuleId]: requireTypeOutOfTypeOnlyImports,
|
|
41
40
|
[noDuplicatedImportsRuleId]: noDuplicatedImports,
|
|
42
|
-
[requireFixedServicesImportRuleId]: requireFixedServicesImport
|
|
41
|
+
[requireFixedServicesImportRuleId]: requireFixedServicesImport,
|
|
42
|
+
[noServeRuntimeRuleId]: noServeRuntime
|
|
43
43
|
};
|
|
44
44
|
var plugin = {
|
|
45
45
|
rules
|
|
@@ -52,7 +52,6 @@ var configs = {
|
|
|
52
52
|
rules: {
|
|
53
53
|
"@checkdigit/no-card-numbers": "error",
|
|
54
54
|
"@checkdigit/file-path-comment": "error",
|
|
55
|
-
"@checkdigit/no-random-v4-uuid": "error",
|
|
56
55
|
"@checkdigit/no-uuid": "error",
|
|
57
56
|
"@checkdigit/require-strict-assert": "error",
|
|
58
57
|
"@checkdigit/no-wallaby-comment": "error",
|
|
@@ -66,7 +65,8 @@ var configs = {
|
|
|
66
65
|
[`@checkdigit/${requireResolveFullResponseRuleId}`]: "error",
|
|
67
66
|
[`@checkdigit/${requireTypeOutOfTypeOnlyImportsRuleId}`]: "error",
|
|
68
67
|
[`@checkdigit/${noDuplicatedImportsRuleId}`]: "error",
|
|
69
|
-
[`@checkdigit/${requireFixedServicesImportRuleId}`]: "error"
|
|
68
|
+
[`@checkdigit/${requireFixedServicesImportRuleId}`]: "error",
|
|
69
|
+
[`@checkdigit/${noServeRuntimeRuleId}`]: "error"
|
|
70
70
|
}
|
|
71
71
|
},
|
|
72
72
|
recommended: {
|
|
@@ -76,7 +76,6 @@ var configs = {
|
|
|
76
76
|
rules: {
|
|
77
77
|
"@checkdigit/no-card-numbers": "error",
|
|
78
78
|
"@checkdigit/file-path-comment": "off",
|
|
79
|
-
"@checkdigit/no-random-v4-uuid": "error",
|
|
80
79
|
"@checkdigit/no-uuid": "error",
|
|
81
80
|
"@checkdigit/require-strict-assert": "error",
|
|
82
81
|
"@checkdigit/no-wallaby-comment": "off",
|
|
@@ -97,4 +96,4 @@ var src_default = pluginToExport;
|
|
|
97
96
|
export {
|
|
98
97
|
src_default as default
|
|
99
98
|
};
|
|
100
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
99
|
+
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9u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FBTztBQUFBLE1BQ0wsK0JBQStCO0FBQUEsTUFDL0IsaUNBQWlDO0FBQUEsTUFDakMsdUJBQXVCO0FBQUEsTUFDdkIscUNBQXFDO0FBQUEsTUFDckMsa0NBQWtDO0FBQUEsTUFDbEMsMENBQTBDO0FBQUEsTUFDMUMsdURBQXVEO0FBQUEsTUFDdkQsdUNBQXVDO0FBQUEsTUFDdkMsOEJBQThCO0FBQUEsTUFDOUIsQ0FBQyxlQUFlLDBCQUEwQixFQUFFLEdBQUc7QUFBQSxNQUMvQyxDQUFDLGVBQWUsNkJBQTZCLEVBQUUsR0FBRztBQUFBLElBQ3BEO0FBQUEsRUFDRjtBQUNGO0FBRUEsSUFBTSxpQkFBNkM7QUFBQSxFQUNqRCxHQUFHO0FBQUEsRUFDSDtBQUNGO0FBQ0EsSUFBTyxjQUFROyIsCiAgIm5hbWVzIjogW10KfQo=
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@checkdigit/eslint-plugin","version":"7.2.0-PR.
|
|
1
|
+
{"name":"@checkdigit/eslint-plugin","version":"7.2.0-PR.91-31da","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.10.0","@typescript-eslint/utils":"^8.10.0","ts-api-utils":"^1.3.0"},"devDependencies":{"@checkdigit/jest-config":"^6.0.2","@checkdigit/prettier-config":"^5.5.1","@checkdigit/typescript-config":"^8.0.0","@eslint/js":"^9.13.0","@types/eslint":"^9.6.1","@types/eslint-config-prettier":"^6.11.3","@typescript-eslint/parser":"^8.10.0","@typescript-eslint/rule-tester":"^8.10.0","eslint":"^9.13.0","eslint-config-prettier":"^9.1.0","eslint-import-resolver-typescript":"^3.6.3","eslint-plugin-eslint-plugin":"^6.2.0","eslint-plugin-import":"^2.31.0","eslint-plugin-no-only-tests":"^3.3.0","eslint-plugin-no-secrets":"^1.0.2","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.10.0"},"peerDependencies":{"eslint":">=9 <10"},"engines":{"node":">=20.17"}}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// agent/no-serve-runtime.ts
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (c) 2021-2024 Check Digit, LLC
|
|
5
|
+
*
|
|
6
|
+
* This code is licensed under the MIT license (see LICENSE.txt for details).
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { ESLintUtils, TSESTree } from '@typescript-eslint/utils';
|
|
10
|
+
import getDocumentationUrl from '../get-documentation-url';
|
|
11
|
+
|
|
12
|
+
export const ruleId = 'no-serve-runtime';
|
|
13
|
+
|
|
14
|
+
const createRule = ESLintUtils.RuleCreator((name) => getDocumentationUrl(name));
|
|
15
|
+
|
|
16
|
+
const rule: ESLintUtils.RuleModule<'noServeRuntime'> = createRule({
|
|
17
|
+
name: ruleId,
|
|
18
|
+
meta: {
|
|
19
|
+
type: 'problem',
|
|
20
|
+
docs: {
|
|
21
|
+
description: '@checkdigit/serve-runtime should not be used.',
|
|
22
|
+
},
|
|
23
|
+
messages: {
|
|
24
|
+
noServeRuntime: 'Please remove the usage of @checkdigit/serve-runtime.',
|
|
25
|
+
},
|
|
26
|
+
schema: [],
|
|
27
|
+
},
|
|
28
|
+
defaultOptions: [],
|
|
29
|
+
create(context) {
|
|
30
|
+
return {
|
|
31
|
+
ImportDeclaration: (importDeclaration: TSESTree.ImportDeclaration) => {
|
|
32
|
+
if (importDeclaration.source.value === '@checkdigit/serve-runtime') {
|
|
33
|
+
context.report({
|
|
34
|
+
messageId: 'noServeRuntime',
|
|
35
|
+
node: importDeclaration,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export default rule;
|
package/src/index.ts
CHANGED
|
@@ -21,9 +21,9 @@ import requireResolveFullResponse, {
|
|
|
21
21
|
import requireTypeOutOfTypeOnlyImports, {
|
|
22
22
|
ruleId as requireTypeOutOfTypeOnlyImportsRuleId,
|
|
23
23
|
} from './require-type-out-of-type-only-imports';
|
|
24
|
+
import noServeRuntime, { ruleId as noServeRuntimeRuleId } from './agent/no-serve-runtime';
|
|
24
25
|
import filePathComment from './file-path-comment';
|
|
25
26
|
import noCardNumbers from './no-card-numbers';
|
|
26
|
-
import noRandomV4UUID from './no-random-v4-uuid';
|
|
27
27
|
import noTestImport from './no-test-import';
|
|
28
28
|
import noUuid from './no-uuid';
|
|
29
29
|
import noWallabyComment from './no-wallaby-comment';
|
|
@@ -35,7 +35,6 @@ import requireStrictAssert from './require-strict-assert';
|
|
|
35
35
|
const rules: Record<string, TSESLint.LooseRuleDefinition> = {
|
|
36
36
|
'file-path-comment': filePathComment,
|
|
37
37
|
'no-card-numbers': noCardNumbers,
|
|
38
|
-
'no-random-v4-uuid': noRandomV4UUID,
|
|
39
38
|
'no-uuid': noUuid,
|
|
40
39
|
'require-strict-assert': requireStrictAssert,
|
|
41
40
|
'no-test-import': noTestImport,
|
|
@@ -50,6 +49,7 @@ const rules: Record<string, TSESLint.LooseRuleDefinition> = {
|
|
|
50
49
|
[requireTypeOutOfTypeOnlyImportsRuleId]: requireTypeOutOfTypeOnlyImports,
|
|
51
50
|
[noDuplicatedImportsRuleId]: noDuplicatedImports,
|
|
52
51
|
[requireFixedServicesImportRuleId]: requireFixedServicesImport,
|
|
52
|
+
[noServeRuntimeRuleId]: noServeRuntime,
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
const plugin: TSESLint.FlatConfig.Plugin = {
|
|
@@ -64,7 +64,6 @@ const configs: Record<string, TSESLint.FlatConfig.Config> = {
|
|
|
64
64
|
rules: {
|
|
65
65
|
'@checkdigit/no-card-numbers': 'error',
|
|
66
66
|
'@checkdigit/file-path-comment': 'error',
|
|
67
|
-
'@checkdigit/no-random-v4-uuid': 'error',
|
|
68
67
|
'@checkdigit/no-uuid': 'error',
|
|
69
68
|
'@checkdigit/require-strict-assert': 'error',
|
|
70
69
|
'@checkdigit/no-wallaby-comment': 'error',
|
|
@@ -79,6 +78,7 @@ const configs: Record<string, TSESLint.FlatConfig.Config> = {
|
|
|
79
78
|
[`@checkdigit/${requireTypeOutOfTypeOnlyImportsRuleId}`]: 'error',
|
|
80
79
|
[`@checkdigit/${noDuplicatedImportsRuleId}`]: 'error',
|
|
81
80
|
[`@checkdigit/${requireFixedServicesImportRuleId}`]: 'error',
|
|
81
|
+
[`@checkdigit/${noServeRuntimeRuleId}`]: 'error',
|
|
82
82
|
},
|
|
83
83
|
},
|
|
84
84
|
recommended: {
|
|
@@ -88,7 +88,6 @@ const configs: Record<string, TSESLint.FlatConfig.Config> = {
|
|
|
88
88
|
rules: {
|
|
89
89
|
'@checkdigit/no-card-numbers': 'error',
|
|
90
90
|
'@checkdigit/file-path-comment': 'off',
|
|
91
|
-
'@checkdigit/no-random-v4-uuid': 'error',
|
|
92
91
|
'@checkdigit/no-uuid': 'error',
|
|
93
92
|
'@checkdigit/require-strict-assert': 'error',
|
|
94
93
|
'@checkdigit/no-wallaby-comment': 'off',
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
// src/no-random-v4-uuid.ts
|
|
2
|
-
import { AST_NODE_TYPES, ESLintUtils } from "@typescript-eslint/utils";
|
|
3
|
-
import getDocumentationUrl from "./get-documentation-url.mjs";
|
|
4
|
-
var ruleId = "no-random-v4-uuid";
|
|
5
|
-
var NO_RANDOM_V4_UUID = "NO_RANDOM_V4_UUID";
|
|
6
|
-
var createRule = ESLintUtils.RuleCreator((name) => getDocumentationUrl(name));
|
|
7
|
-
var processImportDeclaration = (node, uuid4Alias, uuidDefaultAlias) => {
|
|
8
|
-
let updatedUuid4Alias = uuid4Alias;
|
|
9
|
-
let updatedUuidDefaultAlias = uuidDefaultAlias;
|
|
10
|
-
node.specifiers.forEach((specifier) => {
|
|
11
|
-
switch (specifier.type) {
|
|
12
|
-
case AST_NODE_TYPES.ImportSpecifier:
|
|
13
|
-
if (specifier.imported.type === AST_NODE_TYPES.Identifier && specifier.imported.name === "v4") {
|
|
14
|
-
updatedUuid4Alias = specifier.local.name;
|
|
15
|
-
}
|
|
16
|
-
break;
|
|
17
|
-
case AST_NODE_TYPES.ImportDefaultSpecifier:
|
|
18
|
-
updatedUuidDefaultAlias = specifier.local.name;
|
|
19
|
-
break;
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
return { uuid4Alias: updatedUuid4Alias, uuidDefaultAlias: updatedUuidDefaultAlias };
|
|
23
|
-
};
|
|
24
|
-
var isUuid4Call = (node, uuid4Alias, uuidDefaultAlias) => node.callee.type === AST_NODE_TYPES.Identifier && node.callee.name === uuid4Alias || node.callee.type === AST_NODE_TYPES.MemberExpression && node.callee.object.type === AST_NODE_TYPES.Identifier && node.callee.object.name === uuidDefaultAlias && node.callee.property.type === AST_NODE_TYPES.Identifier && node.callee.property.name === "v4";
|
|
25
|
-
var rule = createRule({
|
|
26
|
-
name: ruleId,
|
|
27
|
-
meta: {
|
|
28
|
-
type: "problem",
|
|
29
|
-
docs: {
|
|
30
|
-
description: "Disallow the use of `uuid.v4` for generating random v4 UUIDs"
|
|
31
|
-
},
|
|
32
|
-
schema: [],
|
|
33
|
-
messages: {
|
|
34
|
-
[NO_RANDOM_V4_UUID]: "Avoid using `uuid.v4` for generating random v4 UUIDs."
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
defaultOptions: [],
|
|
38
|
-
create(context) {
|
|
39
|
-
let uuid4Alias;
|
|
40
|
-
let uuidDefaultAlias;
|
|
41
|
-
let hasUuidImport = false;
|
|
42
|
-
return {
|
|
43
|
-
ImportDeclaration(node) {
|
|
44
|
-
if (node.source.value === "uuid") {
|
|
45
|
-
hasUuidImport = true;
|
|
46
|
-
const result = processImportDeclaration(node, uuid4Alias, uuidDefaultAlias);
|
|
47
|
-
uuid4Alias = result.uuid4Alias;
|
|
48
|
-
uuidDefaultAlias = result.uuidDefaultAlias;
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
CallExpression(node) {
|
|
52
|
-
if (hasUuidImport && isUuid4Call(node, uuid4Alias, uuidDefaultAlias)) {
|
|
53
|
-
context.report({
|
|
54
|
-
node,
|
|
55
|
-
messageId: NO_RANDOM_V4_UUID
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
var no_random_v4_uuid_default = rule;
|
|
63
|
-
export {
|
|
64
|
-
no_random_v4_uuid_default as default,
|
|
65
|
-
ruleId
|
|
66
|
-
};
|
|
67
|
-
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vc3JjL25vLXJhbmRvbS12NC11dWlkLnRzIl0sCiAgIm1hcHBpbmdzIjogIjtBQVFBLFNBQVMsZ0JBQWdCLG1CQUF1QztBQUNoRSxPQUFPLHlCQUF5QjtBQUV6QixJQUFNLFNBQVM7QUFDdEIsSUFBTSxvQkFBb0I7QUFFMUIsSUFBTSxhQUFhLFlBQVksWUFBWSxDQUFDLFNBQVMsb0JBQW9CLElBQUksQ0FBQztBQUc5RSxJQUFNLDJCQUEyQixDQUMvQixNQUNBLFlBQ0EscUJBQ0c7QUFDSCxNQUFJLG9CQUFvQjtBQUN4QixNQUFJLDBCQUEwQjtBQUM5QixPQUFLLFdBQVcsUUFBUSxDQUFDLGNBQWM7QUFDckMsWUFBUSxVQUFVLE1BQU07QUFBQSxNQUN0QixLQUFLLGVBQWU7QUFDbEIsWUFBSSxVQUFVLFNBQVMsU0FBUyxlQUFlLGNBQWMsVUFBVSxTQUFTLFNBQVMsTUFBTTtBQUM3Riw4QkFBb0IsVUFBVSxNQUFNO0FBQUEsUUFDdEM7QUFDQTtBQUFBLE1BQ0YsS0FBSyxlQUFlO0FBQ2xCLGtDQUEwQixVQUFVLE1BQU07QUFDMUM7QUFBQSxJQUNKO0FBQUEsRUFDRixDQUFDO0FBQ0QsU0FBTyxFQUFFLFlBQVksbUJBQW1CLGtCQUFrQix3QkFBd0I7QUFDcEY7QUFHQSxJQUFNLGNBQWMsQ0FDbEIsTUFDQSxZQUNBLHFCQUVDLEtBQUssT0FBTyxTQUFTLGVBQWUsY0FBYyxLQUFLLE9BQU8sU0FBUyxjQUN2RSxLQUFLLE9BQU8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yI6IFtdCn0K
|
package/src/no-random-v4-uuid.ts
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
// no-random-v4-uuid.ts
|
|
2
|
-
|
|
3
|
-
/*
|
|
4
|
-
* Copyright (c) 2022-2024 Check Digit, LLC
|
|
5
|
-
*
|
|
6
|
-
* This code is licensed under the MIT license (see LICENSE.txt for details).
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { AST_NODE_TYPES, ESLintUtils, TSESLint, TSESTree } from '@typescript-eslint/utils';
|
|
10
|
-
import getDocumentationUrl from './get-documentation-url';
|
|
11
|
-
|
|
12
|
-
export const ruleId = 'no-random-v4-uuid';
|
|
13
|
-
const NO_RANDOM_V4_UUID = 'NO_RANDOM_V4_UUID';
|
|
14
|
-
|
|
15
|
-
const createRule = ESLintUtils.RuleCreator((name) => getDocumentationUrl(name));
|
|
16
|
-
|
|
17
|
-
// process the import declaration to get the alias for uuid.v4 and uuid.
|
|
18
|
-
const processImportDeclaration = (
|
|
19
|
-
node: TSESTree.ImportDeclaration,
|
|
20
|
-
uuid4Alias: string | undefined,
|
|
21
|
-
uuidDefaultAlias: string | undefined,
|
|
22
|
-
) => {
|
|
23
|
-
let updatedUuid4Alias = uuid4Alias;
|
|
24
|
-
let updatedUuidDefaultAlias = uuidDefaultAlias;
|
|
25
|
-
node.specifiers.forEach((specifier) => {
|
|
26
|
-
switch (specifier.type) {
|
|
27
|
-
case AST_NODE_TYPES.ImportSpecifier:
|
|
28
|
-
if (specifier.imported.type === AST_NODE_TYPES.Identifier && specifier.imported.name === 'v4') {
|
|
29
|
-
updatedUuid4Alias = specifier.local.name;
|
|
30
|
-
}
|
|
31
|
-
break;
|
|
32
|
-
case AST_NODE_TYPES.ImportDefaultSpecifier:
|
|
33
|
-
updatedUuidDefaultAlias = specifier.local.name;
|
|
34
|
-
break;
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
return { uuid4Alias: updatedUuid4Alias, uuidDefaultAlias: updatedUuidDefaultAlias };
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
// checks if the function call is either directly using the alias for uuid.v4 or using uuid.v4 as a member expression.
|
|
41
|
-
const isUuid4Call = (
|
|
42
|
-
node: TSESTree.CallExpression,
|
|
43
|
-
uuid4Alias: string | undefined,
|
|
44
|
-
uuidDefaultAlias: string | undefined,
|
|
45
|
-
): boolean =>
|
|
46
|
-
(node.callee.type === AST_NODE_TYPES.Identifier && node.callee.name === uuid4Alias) ||
|
|
47
|
-
(node.callee.type === AST_NODE_TYPES.MemberExpression &&
|
|
48
|
-
node.callee.object.type === AST_NODE_TYPES.Identifier &&
|
|
49
|
-
node.callee.object.name === uuidDefaultAlias &&
|
|
50
|
-
node.callee.property.type === AST_NODE_TYPES.Identifier &&
|
|
51
|
-
node.callee.property.name === 'v4');
|
|
52
|
-
|
|
53
|
-
const rule: TSESLint.RuleModule<typeof NO_RANDOM_V4_UUID> = createRule({
|
|
54
|
-
name: ruleId,
|
|
55
|
-
meta: {
|
|
56
|
-
type: 'problem',
|
|
57
|
-
docs: {
|
|
58
|
-
description: 'Disallow the use of `uuid.v4` for generating random v4 UUIDs',
|
|
59
|
-
},
|
|
60
|
-
schema: [],
|
|
61
|
-
messages: {
|
|
62
|
-
[NO_RANDOM_V4_UUID]: 'Avoid using `uuid.v4` for generating random v4 UUIDs.',
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
defaultOptions: [],
|
|
66
|
-
create(context) {
|
|
67
|
-
let uuid4Alias: string | undefined;
|
|
68
|
-
let uuidDefaultAlias: string | undefined;
|
|
69
|
-
let hasUuidImport = false;
|
|
70
|
-
|
|
71
|
-
return {
|
|
72
|
-
ImportDeclaration(node: TSESTree.ImportDeclaration) {
|
|
73
|
-
if (node.source.value === 'uuid') {
|
|
74
|
-
hasUuidImport = true;
|
|
75
|
-
const result = processImportDeclaration(node, uuid4Alias, uuidDefaultAlias);
|
|
76
|
-
uuid4Alias = result.uuid4Alias;
|
|
77
|
-
uuidDefaultAlias = result.uuidDefaultAlias;
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
CallExpression(node: TSESTree.CallExpression) {
|
|
81
|
-
if (hasUuidImport && isUuid4Call(node, uuid4Alias, uuidDefaultAlias)) {
|
|
82
|
-
context.report({
|
|
83
|
-
node,
|
|
84
|
-
messageId: NO_RANDOM_V4_UUID,
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
};
|
|
89
|
-
},
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
export default rule;
|