@checkdigit/eslint-plugin 6.9.0-PR.86-3a12 → 6.9.0-PR.89-6297

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.
@@ -12193,27 +12193,6 @@
12193
12193
  ],
12194
12194
  "format": "cjs"
12195
12195
  },
12196
- "src/no-duplicated-imports.ts": {
12197
- "bytes": 4278,
12198
- "imports": [
12199
- {
12200
- "path": "node_modules/@typescript-eslint/utils/dist/index.js",
12201
- "kind": "import-statement",
12202
- "original": "@typescript-eslint/utils"
12203
- },
12204
- {
12205
- "path": "node:assert",
12206
- "kind": "import-statement",
12207
- "external": true
12208
- },
12209
- {
12210
- "path": "src/get-documentation-url.ts",
12211
- "kind": "import-statement",
12212
- "original": "./get-documentation-url"
12213
- }
12214
- ],
12215
- "format": "esm"
12216
- },
12217
12196
  "src/library/ts-tree.ts": {
12218
12197
  "bytes": 2883,
12219
12198
  "imports": [
@@ -12262,22 +12241,6 @@
12262
12241
  ],
12263
12242
  "format": "esm"
12264
12243
  },
12265
- "src/require-fixed-services-import.ts": {
12266
- "bytes": 1467,
12267
- "imports": [
12268
- {
12269
- "path": "node_modules/@typescript-eslint/utils/dist/index.js",
12270
- "kind": "import-statement",
12271
- "original": "@typescript-eslint/utils"
12272
- },
12273
- {
12274
- "path": "src/get-documentation-url.ts",
12275
- "kind": "import-statement",
12276
- "original": "./get-documentation-url"
12277
- }
12278
- ],
12279
- "format": "esm"
12280
- },
12281
12244
  "src/require-resolve-full-response.ts": {
12282
12245
  "bytes": 7652,
12283
12246
  "imports": [
@@ -12335,6 +12298,22 @@
12335
12298
  "imports": [],
12336
12299
  "format": "esm"
12337
12300
  },
12301
+ "src/no-random-v4-uuid.ts": {
12302
+ "bytes": 2647,
12303
+ "imports": [
12304
+ {
12305
+ "path": "node_modules/@typescript-eslint/utils/dist/index.js",
12306
+ "kind": "import-statement",
12307
+ "original": "@typescript-eslint/utils"
12308
+ },
12309
+ {
12310
+ "path": "src/get-documentation-url.ts",
12311
+ "kind": "import-statement",
12312
+ "original": "./get-documentation-url"
12313
+ }
12314
+ ],
12315
+ "format": "esm"
12316
+ },
12338
12317
  "src/no-test-import.ts": {
12339
12318
  "bytes": 1874,
12340
12319
  "imports": [],
@@ -12371,18 +12350,13 @@
12371
12350
  "format": "esm"
12372
12351
  },
12373
12352
  "src/index.ts": {
12374
- "bytes": 3990,
12353
+ "bytes": 3701,
12375
12354
  "imports": [
12376
12355
  {
12377
12356
  "path": "src/invalid-json-stringify.ts",
12378
12357
  "kind": "import-statement",
12379
12358
  "original": "./invalid-json-stringify"
12380
12359
  },
12381
- {
12382
- "path": "src/no-duplicated-imports.ts",
12383
- "kind": "import-statement",
12384
- "original": "./no-duplicated-imports"
12385
- },
12386
12360
  {
12387
12361
  "path": "src/agent/no-full-response.ts",
12388
12362
  "kind": "import-statement",
@@ -12393,11 +12367,6 @@
12393
12367
  "kind": "import-statement",
12394
12368
  "original": "./no-promise-instance-method"
12395
12369
  },
12396
- {
12397
- "path": "src/require-fixed-services-import.ts",
12398
- "kind": "import-statement",
12399
- "original": "./require-fixed-services-import"
12400
- },
12401
12370
  {
12402
12371
  "path": "src/require-resolve-full-response.ts",
12403
12372
  "kind": "import-statement",
@@ -12418,6 +12387,11 @@
12418
12387
  "kind": "import-statement",
12419
12388
  "original": "./no-card-numbers"
12420
12389
  },
12390
+ {
12391
+ "path": "src/no-random-v4-uuid.ts",
12392
+ "kind": "import-statement",
12393
+ "original": "./no-random-v4-uuid"
12394
+ },
12421
12395
  {
12422
12396
  "path": "src/no-test-import.ts",
12423
12397
  "kind": "import-statement",
@@ -12965,11 +12939,6 @@
12965
12939
  "kind": "require-call",
12966
12940
  "external": true
12967
12941
  },
12968
- {
12969
- "path": "node:assert",
12970
- "kind": "require-call",
12971
- "external": true
12972
- },
12973
12942
  {
12974
12943
  "path": "node:assert",
12975
12944
  "kind": "require-call",
@@ -15227,7 +15196,7 @@
15227
15196
  "bytesInOutput": 2215
15228
15197
  },
15229
15198
  "src/index.ts": {
15230
- "bytesInOutput": 2494
15199
+ "bytesInOutput": 2456
15231
15200
  },
15232
15201
  "package.json": {
15233
15202
  "bytesInOutput": 2998
@@ -15238,21 +15207,15 @@
15238
15207
  "src/invalid-json-stringify.ts": {
15239
15208
  "bytesInOutput": 2471
15240
15209
  },
15241
- "src/no-duplicated-imports.ts": {
15242
- "bytesInOutput": 3724
15243
- },
15244
15210
  "src/library/ts-tree.ts": {
15245
- "bytesInOutput": 2078
15211
+ "bytesInOutput": 2070
15246
15212
  },
15247
15213
  "src/agent/no-full-response.ts": {
15248
- "bytesInOutput": 2006
15214
+ "bytesInOutput": 2000
15249
15215
  },
15250
15216
  "src/no-promise-instance-method.ts": {
15251
15217
  "bytesInOutput": 1275
15252
15218
  },
15253
- "src/require-fixed-services-import.ts": {
15254
- "bytesInOutput": 1254
15255
- },
15256
15219
  "src/require-resolve-full-response.ts": {
15257
15220
  "bytesInOutput": 7354
15258
15221
  },
@@ -15265,6 +15228,9 @@
15265
15228
  "src/no-card-numbers.ts": {
15266
15229
  "bytesInOutput": 3356
15267
15230
  },
15231
+ "src/no-random-v4-uuid.ts": {
15232
+ "bytesInOutput": 2051
15233
+ },
15268
15234
  "src/no-test-import.ts": {
15269
15235
  "bytesInOutput": 1458
15270
15236
  },
@@ -15287,7 +15253,7 @@
15287
15253
  "bytesInOutput": 3362
15288
15254
  }
15289
15255
  },
15290
- "bytes": 4241869
15256
+ "bytes": 4236477
15291
15257
  }
15292
15258
  }
15293
15259
  }
@@ -1,11 +1,7 @@
1
1
  // src/index.ts
2
2
  import invalidJsonStringify, { ruleId as invalidJsonStringifyRuleId } from "./invalid-json-stringify.mjs";
3
- import noDuplicatedImports, { ruleId as noDuplicatedImportsRuleId } from "./no-duplicated-imports.mjs";
4
3
  import noFullResponse, { ruleId as noFullResponseRuleId } from "./agent/no-full-response.mjs";
5
4
  import noPromiseInstanceMethod, { ruleId as noPromiseInstanceMethodRuleId } from "./no-promise-instance-method.mjs";
6
- import requireFixedServicesImport, {
7
- ruleId as requireFixedServicesImportRuleId
8
- } from "./require-fixed-services-import.mjs";
9
5
  import requireResolveFullResponse, {
10
6
  ruleId as requireResolveFullResponseRuleId
11
7
  } from "./require-resolve-full-response.mjs";
@@ -14,6 +10,7 @@ import requireTypeOutOfTypeOnlyImports, {
14
10
  } from "./require-type-out-of-type-only-imports.mjs";
15
11
  import filePathComment from "./file-path-comment.mjs";
16
12
  import noCardNumbers from "./no-card-numbers.mjs";
13
+ import noRandomV4UUID from "./no-random-v4-uuid.mjs";
17
14
  import noTestImport from "./no-test-import.mjs";
18
15
  import noUuid from "./no-uuid.mjs";
19
16
  import noWallabyComment from "./no-wallaby-comment.mjs";
@@ -25,6 +22,7 @@ var src_default = {
25
22
  rules: {
26
23
  "file-path-comment": filePathComment,
27
24
  "no-card-numbers": noCardNumbers,
25
+ "no-random-v4-uuid": noRandomV4UUID,
28
26
  "no-uuid": noUuid,
29
27
  "require-strict-assert": requireStrictAssert,
30
28
  "no-test-import": noTestImport,
@@ -36,8 +34,6 @@ var src_default = {
36
34
  [noPromiseInstanceMethodRuleId]: noPromiseInstanceMethod,
37
35
  [noFullResponseRuleId]: noFullResponse,
38
36
  [requireResolveFullResponseRuleId]: requireResolveFullResponse,
39
- [noDuplicatedImportsRuleId]: noDuplicatedImports,
40
- [requireFixedServicesImportRuleId]: requireFixedServicesImport,
41
37
  [requireTypeOutOfTypeOnlyImportsRuleId]: requireTypeOutOfTypeOnlyImports
42
38
  },
43
39
  configs: {
@@ -45,6 +41,7 @@ var src_default = {
45
41
  rules: {
46
42
  "@checkdigit/no-card-numbers": "error",
47
43
  "@checkdigit/file-path-comment": "error",
44
+ "@checkdigit/no-random-v4-uuid": "error",
48
45
  "@checkdigit/no-uuid": "error",
49
46
  "@checkdigit/require-strict-assert": "error",
50
47
  "@checkdigit/no-wallaby-comment": "error",
@@ -56,8 +53,6 @@ var src_default = {
56
53
  [`@checkdigit/${noPromiseInstanceMethodRuleId}`]: "error",
57
54
  [`@checkdigit/${noFullResponseRuleId}`]: "error",
58
55
  [`@checkdigit/${requireResolveFullResponseRuleId}`]: "error",
59
- [`@checkdigit/${noDuplicatedImportsRuleId}`]: "error",
60
- [`@checkdigit/${requireFixedServicesImportRuleId}`]: "error",
61
56
  [`@checkdigit/${requireTypeOutOfTypeOnlyImportsRuleId}`]: "error"
62
57
  }
63
58
  },
@@ -65,6 +60,7 @@ var src_default = {
65
60
  rules: {
66
61
  "@checkdigit/no-card-numbers": "error",
67
62
  "@checkdigit/file-path-comment": "off",
63
+ "@checkdigit/no-random-v4-uuid": "error",
68
64
  "@checkdigit/no-uuid": "error",
69
65
  "@checkdigit/require-strict-assert": "error",
70
66
  "@checkdigit/no-wallaby-comment": "off",
@@ -81,4 +77,4 @@ var src_default = {
81
77
  export {
82
78
  src_default as default
83
79
  };
84
- //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vc3JjL2luZGV4LnRzIl0sCiAgIm1hcHBpbmdzIjogIjtBQVFBLE9BQU8sd0JBQXdCLFVBQVUsa0NBQWtDO0FBQzNFLE9BQU8sdUJBQXVCLFVBQVUsaUNBQWlDO0FBQ3pFLE9BQU8sa0JBQWtCLFVBQVUsNEJBQTRCO0FBQy9ELE9BQU8sMkJBQTJCLFVBQVUscUNBQXFDO0FBQ2pGLE9BQU87QUFBQSxFQUNMLFVBQVU7QUFBQSxPQUNMO0FBQ1AsT0FBTztBQUFBLEVBQ0wsVUFBVTtBQUFBLE9BQ0w7QUFDUCxPQUFPO0FBQUEsRUFDTCxVQUFVO0FBQUEsT0FDTDtBQUNQLE9BQU8scUJBQXFCO0FBQzVCLE9BQU8sbUJBQW1CO0FBQzFCLE9BQU8sa0JBQWtCO0FBQ3pCLE9BQU8sWUFBWTtBQUNuQixPQUFPLHNCQUFzQjtBQUM3QixPQUFPLDJCQUEyQjtBQUNsQyxPQUFPLGtCQUFrQjtBQUN6QixPQUFPL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BQyxlQUFlLG9CQUFvQixFQUFFLEdBQUc7QUFBQSxRQUN6QyxDQUFDLGVBQWUsZ0NBQWdDLEVBQUUsR0FBRztBQUFBLFFBQ3JELENBQUMsZUFBZSxxQ0FBcUMsRUFBRSxHQUFHO0FBQUEsTUFDNUQ7QUFBQSxJQUNGO0FBQUEsSUFDQSxhQUFhO0FBQUEsTUFDWCxPQUFPO0FBQUEsUUFDTCwrQkFBK0I7QUFBQSxRQUMvQixpQ0FBaUM7QUFBQSxRQUNqQyxpQ0FBaUM7QUFBQSxRQUNqQyx1QkFBdUI7QUFBQSxRQUN2QixxQ0FBcUM7QUFBQSxRQUNyQyxrQ0FBa0M7QUFBQSxRQUNsQywwQ0FBMEM7QUFBQSxRQUMxQyx1REFBdUQ7QUFBQSxRQUN2RCx1Q0FBdUM7QUFBQSxRQUN2Qyw4QkFBOEI7QUFBQSxRQUM5QixDQUFDLGVBQWUsMEJBQTBCLEVBQUUsR0FBRztBQUFBLFFBQy9DLENBQUMsZUFBZSw2QkFBNkIsRUFBRSxHQUFHO0FBQUEsTUFDcEQ7QUFBQSxJQUNGO0FBQUEsRUFDRjtBQUNGOyIsCiAgIm5hbWVzIjogW10KfQo=
@@ -0,0 +1,60 @@
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
+ node.specifiers.forEach((specifier) => {
9
+ switch (specifier.type) {
10
+ case AST_NODE_TYPES.ImportSpecifier:
11
+ if (specifier.imported.name === "v4") {
12
+ uuid4Alias.current = specifier.local.name;
13
+ }
14
+ break;
15
+ case AST_NODE_TYPES.ImportDefaultSpecifier:
16
+ uuidDefaultAlias.current = specifier.local.name;
17
+ break;
18
+ }
19
+ });
20
+ };
21
+ 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";
22
+ var rule = createRule({
23
+ name: ruleId,
24
+ meta: {
25
+ type: "problem",
26
+ docs: {
27
+ description: "Disallow the use of `uuid.v4` for generating random v4 UUIDs"
28
+ },
29
+ schema: [],
30
+ messages: {
31
+ [NO_RANDOM_V4_UUID]: "Avoid using `uuid.v4` for generating random v4 UUIDs."
32
+ }
33
+ },
34
+ defaultOptions: [],
35
+ create(context) {
36
+ const uuid4Alias = { current: null };
37
+ const uuidDefaultAlias = { current: null };
38
+ return {
39
+ ImportDeclaration(node) {
40
+ if (node.source.value === "uuid") {
41
+ processImportDeclaration(node, uuid4Alias, uuidDefaultAlias);
42
+ }
43
+ },
44
+ CallExpression(node) {
45
+ if (isUuid4Call(node, uuid4Alias.current, uuidDefaultAlias.current)) {
46
+ context.report({
47
+ node,
48
+ messageId: NO_RANDOM_V4_UUID
49
+ });
50
+ }
51
+ }
52
+ };
53
+ }
54
+ });
55
+ var no_random_v4_uuid_default = rule;
56
+ export {
57
+ no_random_v4_uuid_default as default,
58
+ ruleId
59
+ };
60
+ //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vc3JjL25vLXJhbmRvbS12NC11dWlkLnRzIl0sCiAgIm1hcHBpbmdzIjogIjtBQVFBLFNBQVMsZ0JBQWdCLG1CQUE2QjtBQUN0RCxPQUFPLHlCQUF5QjtBQUV6QixJQUFNLFNBQVM7QUFDdEIsSUFBTSxvQkFBb0I7QUFFMUIsSUFBTSxhQUFhLFlBQVksWUFBWSxDQUFDLF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BQU0sbUJBQW1CLEVBQUUsU0FBUyxLQUFLO0FBRXpDLFdBQU87QUFBQSxNQUNMLGtCQUFrQixNQUFrQztBQUNsRCxZQUFJLEtBQUssT0FBTyxVQUFVLFFBQVE7QUFDaEMsbUNBQXlCLE1BQU0sWUFBWSxnQkFBZ0I7QUFBQSxRQUM3RDtBQUFBLE1BQ0Y7QUFBQSxNQUNBLGVBQWUsTUFBK0I7QUFDNUMsWUFBSSxZQUFZLE1BQU0sV0FBVyxTQUFTLGlCQUFpQixPQUFPLEdBQUc7QUFDbkUsa0JBQVEsT0FBTztBQUFBLFlBQ2I7QUFBQSxZQUNBLFdBQVc7QUFBQSxVQUNiLENBQUM7QUFBQSxRQUNIO0FBQUEsTUFDRjtBQUFBLElBQ0Y7QUFBQSxFQUNGO0FBQ0YsQ0FBQztBQUVELElBQU8sNEJBQVE7IiwKICAibmFtZXMiOiBbXQp9Cg==
@@ -2,6 +2,7 @@ declare const _default: {
2
2
  rules: {
3
3
  'file-path-comment': import("eslint").Rule.RuleModule;
4
4
  'no-card-numbers': import("eslint").Rule.RuleModule;
5
+ 'no-random-v4-uuid': import("@typescript-eslint/utils/ts-eslint").RuleModule<"NO_RANDOM_V4_UUID", never[], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
5
6
  'no-uuid': import("eslint").Rule.RuleModule;
6
7
  'require-strict-assert': import("eslint").Rule.RuleModule;
7
8
  'no-test-import': import("eslint").Rule.RuleModule;
@@ -13,8 +14,6 @@ declare const _default: {
13
14
  "no-promise-instance-method": import("eslint").Rule.RuleModule;
14
15
  "no-full-response": import("@typescript-eslint/utils/ts-eslint").RuleModule<"removeFullResponse" | "unknownError", never[], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
15
16
  "require-resolve-full-response": import("@typescript-eslint/utils/ts-eslint").RuleModule<"unknownError" | "invalidOptions", never[], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
16
- "no-duplicated-imports": import("@typescript-eslint/utils/ts-eslint").RuleModule<"mergeDuplicatedImports", never[], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
17
- "require-fixed-services-import": import("@typescript-eslint/utils/ts-eslint").RuleModule<"updateServicesImportFrom", never[], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
18
17
  "require-type-out-of-type-only-imports": import("@typescript-eslint/utils/ts-eslint").RuleModule<"moveTypeOutside", never[], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
19
18
  };
20
19
  configs: {
@@ -22,6 +21,7 @@ declare const _default: {
22
21
  rules: {
23
22
  '@checkdigit/no-card-numbers': string;
24
23
  '@checkdigit/file-path-comment': string;
24
+ '@checkdigit/no-random-v4-uuid': string;
25
25
  '@checkdigit/no-uuid': string;
26
26
  '@checkdigit/require-strict-assert': string;
27
27
  '@checkdigit/no-wallaby-comment': string;
@@ -33,8 +33,6 @@ declare const _default: {
33
33
  "@checkdigit/no-promise-instance-method": string;
34
34
  "@checkdigit/no-full-response": string;
35
35
  "@checkdigit/require-resolve-full-response": string;
36
- "@checkdigit/no-duplicated-imports": string;
37
- "@checkdigit/require-fixed-services-import": string;
38
36
  "@checkdigit/require-type-out-of-type-only-imports": string;
39
37
  };
40
38
  };
@@ -42,6 +40,7 @@ declare const _default: {
42
40
  rules: {
43
41
  '@checkdigit/no-card-numbers': string;
44
42
  '@checkdigit/file-path-comment': string;
43
+ '@checkdigit/no-random-v4-uuid': string;
45
44
  '@checkdigit/no-uuid': string;
46
45
  '@checkdigit/require-strict-assert': string;
47
46
  '@checkdigit/no-wallaby-comment': string;
@@ -0,0 +1,4 @@
1
+ import { ESLintUtils } from '@typescript-eslint/utils';
2
+ export declare const ruleId = "no-random-v4-uuid";
3
+ declare const rule: ESLintUtils.RuleModule<"NO_RANDOM_V4_UUID", never[], ESLintUtils.RuleListener>;
4
+ export default rule;
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@checkdigit/eslint-plugin","version":"6.9.0-PR.86-3a12","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","require":"./dist-cjs/index.cjs","import":"./dist-mjs/index.mjs","default":"./dist-mjs/index.mjs"}},"files":["src","dist-types","dist-cjs","dist-mjs","!src/**/*.test.ts","!src/**/*.spec.ts","!dist-types/**/*.test.d.ts","!dist-types/**/*.spec.d.ts","!dist-cjs/**/*.test.cjs","!dist-cjs/**/*.spec.cjs","!dist-mjs/**/*.test.mjs","!dist-mjs/**/*.spec.mjs","SECURITY.md"],"scripts":{"build:dist-cjs":"rimraf dist-cjs && npx builder --type=commonjs --sourceMap --entryPoint=index.ts --outDir=dist-cjs --outFile=index.cjs --external=espree && echo \"module.exports = module.exports.default;\" >> dist-cjs/index.cjs && node dist-cjs/index.cjs","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 --ignore-path .gitignore .","lint:fix":"eslint --ignore-path .gitignore . --fix","prepublishOnly":"npm run build:dist-types && npm run build:dist-cjs && 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":"7.18.0","@typescript-eslint/utils":"7.18.0","ts-api-utils":"^1.3.0"},"devDependencies":{"@checkdigit/jest-config":"^6.0.2","@checkdigit/prettier-config":"^5.5.1","@checkdigit/typescript-config":"6.0.0","@types/eslint":"8.56.10","@typescript-eslint/eslint-plugin":"7.18.0","@typescript-eslint/parser":"7.18.0","@typescript-eslint/rule-tester":"7.18.0","eslint-config-prettier":"^9.1.0","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":"0.24.0","http-status-codes":"^2.3.0"},"peerDependencies":{"eslint":">=8 <9"},"engines":{"node":">=20.14"}}
1
+ {"name":"@checkdigit/eslint-plugin","version":"6.9.0-PR.89-6297","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","require":"./dist-cjs/index.cjs","import":"./dist-mjs/index.mjs","default":"./dist-mjs/index.mjs"}},"files":["src","dist-types","dist-cjs","dist-mjs","!src/**/*.test.ts","!src/**/*.spec.ts","!dist-types/**/*.test.d.ts","!dist-types/**/*.spec.d.ts","!dist-cjs/**/*.test.cjs","!dist-cjs/**/*.spec.cjs","!dist-mjs/**/*.test.mjs","!dist-mjs/**/*.spec.mjs","SECURITY.md"],"scripts":{"build:dist-cjs":"rimraf dist-cjs && npx builder --type=commonjs --sourceMap --entryPoint=index.ts --outDir=dist-cjs --outFile=index.cjs --external=espree && echo \"module.exports = module.exports.default;\" >> dist-cjs/index.cjs && node dist-cjs/index.cjs","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 --ignore-path .gitignore .","lint:fix":"eslint --ignore-path .gitignore . --fix","prepublishOnly":"npm run build:dist-types && npm run build:dist-cjs && 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":"7.18.0","@typescript-eslint/utils":"7.18.0","ts-api-utils":"^1.3.0"},"devDependencies":{"@checkdigit/jest-config":"^6.0.2","@checkdigit/prettier-config":"^5.5.1","@checkdigit/typescript-config":"6.0.0","@types/eslint":"8.56.10","@typescript-eslint/eslint-plugin":"7.18.0","@typescript-eslint/parser":"7.18.0","@typescript-eslint/rule-tester":"7.18.0","eslint-config-prettier":"^9.1.0","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":"0.24.0","http-status-codes":"^2.3.0"},"peerDependencies":{"eslint":">=8 <9"},"engines":{"node":">=20.14"}}
package/src/index.ts CHANGED
@@ -7,12 +7,8 @@
7
7
  */
8
8
 
9
9
  import invalidJsonStringify, { ruleId as invalidJsonStringifyRuleId } from './invalid-json-stringify';
10
- import noDuplicatedImports, { ruleId as noDuplicatedImportsRuleId } from './no-duplicated-imports';
11
10
  import noFullResponse, { ruleId as noFullResponseRuleId } from './agent/no-full-response';
12
11
  import noPromiseInstanceMethod, { ruleId as noPromiseInstanceMethodRuleId } from './no-promise-instance-method';
13
- import requireFixedServicesImport, {
14
- ruleId as requireFixedServicesImportRuleId,
15
- } from './require-fixed-services-import';
16
12
  import requireResolveFullResponse, {
17
13
  ruleId as requireResolveFullResponseRuleId,
18
14
  } from './require-resolve-full-response';
@@ -21,6 +17,7 @@ import requireTypeOutOfTypeOnlyImports, {
21
17
  } from './require-type-out-of-type-only-imports';
22
18
  import filePathComment from './file-path-comment';
23
19
  import noCardNumbers from './no-card-numbers';
20
+ import noRandomV4UUID from './no-random-v4-uuid';
24
21
  import noTestImport from './no-test-import';
25
22
  import noUuid from './no-uuid';
26
23
  import noWallabyComment from './no-wallaby-comment';
@@ -33,6 +30,7 @@ export default {
33
30
  rules: {
34
31
  'file-path-comment': filePathComment,
35
32
  'no-card-numbers': noCardNumbers,
33
+ 'no-random-v4-uuid': noRandomV4UUID,
36
34
  'no-uuid': noUuid,
37
35
  'require-strict-assert': requireStrictAssert,
38
36
  'no-test-import': noTestImport,
@@ -44,8 +42,6 @@ export default {
44
42
  [noPromiseInstanceMethodRuleId]: noPromiseInstanceMethod,
45
43
  [noFullResponseRuleId]: noFullResponse,
46
44
  [requireResolveFullResponseRuleId]: requireResolveFullResponse,
47
- [noDuplicatedImportsRuleId]: noDuplicatedImports,
48
- [requireFixedServicesImportRuleId]: requireFixedServicesImport,
49
45
  [requireTypeOutOfTypeOnlyImportsRuleId]: requireTypeOutOfTypeOnlyImports,
50
46
  },
51
47
  configs: {
@@ -53,6 +49,7 @@ export default {
53
49
  rules: {
54
50
  '@checkdigit/no-card-numbers': 'error',
55
51
  '@checkdigit/file-path-comment': 'error',
52
+ '@checkdigit/no-random-v4-uuid': 'error',
56
53
  '@checkdigit/no-uuid': 'error',
57
54
  '@checkdigit/require-strict-assert': 'error',
58
55
  '@checkdigit/no-wallaby-comment': 'error',
@@ -64,8 +61,6 @@ export default {
64
61
  [`@checkdigit/${noPromiseInstanceMethodRuleId}`]: 'error',
65
62
  [`@checkdigit/${noFullResponseRuleId}`]: 'error',
66
63
  [`@checkdigit/${requireResolveFullResponseRuleId}`]: 'error',
67
- [`@checkdigit/${noDuplicatedImportsRuleId}`]: 'error',
68
- [`@checkdigit/${requireFixedServicesImportRuleId}`]: 'error',
69
64
  [`@checkdigit/${requireTypeOutOfTypeOnlyImportsRuleId}`]: 'error',
70
65
  },
71
66
  },
@@ -73,6 +68,7 @@ export default {
73
68
  rules: {
74
69
  '@checkdigit/no-card-numbers': 'error',
75
70
  '@checkdigit/file-path-comment': 'off',
71
+ '@checkdigit/no-random-v4-uuid': 'error',
76
72
  '@checkdigit/no-uuid': 'error',
77
73
  '@checkdigit/require-strict-assert': 'error',
78
74
  '@checkdigit/no-wallaby-comment': 'off',
@@ -0,0 +1,85 @@
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, 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: { current: string | null },
21
+ uuidDefaultAlias: { current: string | null },
22
+ ) => {
23
+ node.specifiers.forEach((specifier) => {
24
+ switch (specifier.type) {
25
+ case AST_NODE_TYPES.ImportSpecifier:
26
+ if (specifier.imported.name === 'v4') {
27
+ uuid4Alias.current = specifier.local.name;
28
+ }
29
+ break;
30
+ case AST_NODE_TYPES.ImportDefaultSpecifier:
31
+ uuidDefaultAlias.current = specifier.local.name;
32
+ break;
33
+ }
34
+ });
35
+ };
36
+
37
+ // checks if the function call is either directly using the alias for uuid.v4 or using uuid.v4 as a member expression.
38
+ const isUuid4Call = (
39
+ node: TSESTree.CallExpression,
40
+ uuid4Alias: string | null,
41
+ uuidDefaultAlias: string | null,
42
+ ): boolean =>
43
+ (node.callee.type === AST_NODE_TYPES.Identifier && node.callee.name === uuid4Alias) ||
44
+ (node.callee.type === AST_NODE_TYPES.MemberExpression &&
45
+ node.callee.object.type === AST_NODE_TYPES.Identifier &&
46
+ node.callee.object.name === uuidDefaultAlias &&
47
+ node.callee.property.type === AST_NODE_TYPES.Identifier &&
48
+ node.callee.property.name === 'v4');
49
+
50
+ const rule = createRule({
51
+ name: ruleId,
52
+ meta: {
53
+ type: 'problem',
54
+ docs: {
55
+ description: 'Disallow the use of `uuid.v4` for generating random v4 UUIDs',
56
+ },
57
+ schema: [],
58
+ messages: {
59
+ [NO_RANDOM_V4_UUID]: 'Avoid using `uuid.v4` for generating random v4 UUIDs.',
60
+ },
61
+ },
62
+ defaultOptions: [],
63
+ create(context) {
64
+ const uuid4Alias = { current: null };
65
+ const uuidDefaultAlias = { current: null };
66
+
67
+ return {
68
+ ImportDeclaration(node: TSESTree.ImportDeclaration) {
69
+ if (node.source.value === 'uuid') {
70
+ processImportDeclaration(node, uuid4Alias, uuidDefaultAlias);
71
+ }
72
+ },
73
+ CallExpression(node: TSESTree.CallExpression) {
74
+ if (isUuid4Call(node, uuid4Alias.current, uuidDefaultAlias.current)) {
75
+ context.report({
76
+ node,
77
+ messageId: NO_RANDOM_V4_UUID,
78
+ });
79
+ }
80
+ },
81
+ };
82
+ },
83
+ });
84
+
85
+ export default rule;
@@ -1,87 +0,0 @@
1
- // src/no-duplicated-imports.ts
2
- import { ESLintUtils, TSESTree } from "@typescript-eslint/utils";
3
- import { strict as assert } from "node:assert";
4
- import getDocumentationUrl from "./get-documentation-url.mjs";
5
- var ruleId = "no-duplicated-imports";
6
- var createRule = ESLintUtils.RuleCreator((name) => getDocumentationUrl(name));
7
- var rule = createRule({
8
- name: ruleId,
9
- meta: {
10
- type: "suggestion",
11
- docs: {
12
- description: 'Merge duplicated import statements with the same "from".'
13
- },
14
- messages: {
15
- mergeDuplicatedImports: 'Merge duplicated import statements with the same "from".'
16
- },
17
- fixable: "code",
18
- schema: []
19
- },
20
- defaultOptions: [],
21
- create(context) {
22
- const sourceCode = context.sourceCode;
23
- const importDeclarations = /* @__PURE__ */ new Map();
24
- return {
25
- ImportDeclaration(node) {
26
- const moduleName = node.source.value;
27
- let declarations = importDeclarations.get(moduleName);
28
- if (declarations === void 0) {
29
- declarations = [];
30
- importDeclarations.set(moduleName, declarations);
31
- }
32
- declarations.push(node);
33
- },
34
- "Program:exit"() {
35
- for (const [moduleName, declarations] of importDeclarations.entries()) {
36
- if (declarations.length <= 1) {
37
- continue;
38
- }
39
- const firstDeclaration = declarations[0];
40
- assert.ok(firstDeclaration);
41
- const isAllTypeOnly = declarations.every(
42
- (declaration) => declaration.importKind === "type" || declaration.specifiers.every(
43
- (specifier) => specifier.type === TSESTree.AST_NODE_TYPES.ImportSpecifier && specifier.importKind === "type"
44
- )
45
- );
46
- context.report({
47
- messageId: "mergeDuplicatedImports",
48
- node: firstDeclaration,
49
- fix(fixer) {
50
- const fixes = [];
51
- const defaultSpecifier = declarations.flatMap(
52
- (declaration) => declaration.specifiers.map(
53
- (specifier) => specifier.type === TSESTree.AST_NODE_TYPES.ImportDefaultSpecifier ? specifier : void 0
54
- )
55
- ).filter(Boolean);
56
- const defaultSpecifierText = defaultSpecifier[0] ? sourceCode.getText(defaultSpecifier[0]) : void 0;
57
- const mergedSpecifiers = declarations.flatMap((declaration) => {
58
- const isCurrentDeclarationTypeOnly = declaration.importKind === "type" || declaration.specifiers.every(
59
- (specifier) => specifier.type === TSESTree.AST_NODE_TYPES.ImportSpecifier && specifier.importKind === "type"
60
- );
61
- return declaration.specifiers.filter((specifier) => specifier.type !== TSESTree.AST_NODE_TYPES.ImportDefaultSpecifier).map(
62
- (specifier) => (
63
- // eslint-disable-next-line no-nested-ternary
64
- isAllTypeOnly ? sourceCode.getText(specifier).replace("type ", "") : isCurrentDeclarationTypeOnly ? `type ${sourceCode.getText(specifier)}` : sourceCode.getText(specifier)
65
- )
66
- );
67
- });
68
- const mergedSpecifiersText = `${isAllTypeOnly ? "type " : ""}{ ${mergedSpecifiers.join(", ")} }`;
69
- const mergedImport = `import ${[defaultSpecifierText, mergedSpecifiersText].filter(Boolean).join(", ")} from '${moduleName}';`;
70
- fixes.push(fixer.replaceText(firstDeclaration, mergedImport));
71
- declarations.slice(1).forEach((declaration) => {
72
- fixes.push(fixer.removeRange([declaration.range[0], declaration.range[1] + 1]));
73
- });
74
- return fixes;
75
- }
76
- });
77
- }
78
- }
79
- };
80
- }
81
- });
82
- var no_duplicated_imports_default = rule;
83
- export {
84
- no_duplicated_imports_default as default,
85
- ruleId
86
- };
87
- //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vc3JjL25vLWR1cGxpY2F0ZWQtaW1wb3J0cy50cyJdLAogICJtYXBwaW5ncyI6ICI7QUFRQSxTQUFTLGFBQWEsZ0JBQWdCO0FBQ3RDLFNBQVMsVUFBVSxjQUFjO0FBQ2pDLE9BQU8seUJBQXlCO0FBRXpCLElBQU0sU0FBUztBQUV0QixJQUFNLGFBQWEsWUFBWSxZQUFZLENBQUMsU0FBUyxvQkFBb0IsSUFBSSxDQUFDO0FBRTlFLElBQU0sT0FBTyxXQUFXO0FBQUEsRUFDdEIsTUFBTTtBQUFBLEVBQ04sTUFBTTtBQUFBLElBQ0osTUFBTTtBQUFBLElBQ04sTUFBTTtBQUFBLE1BQ0osYUFBYTtBQUFBLElBQ2Y7QUFBQSxJQUNBLFVBQVU7QUFBQSxNQUNSLHdCQUF3QjtBQUFBLElBQzFCO0FBQUEsSUFDQSxTQUFTO0FBQUEsSUFDVCxRQUFRLENBQUM7QUFBQSxFQUNYO0FBQUEsRUFDQSxnQkFBZ0IsQ0FBQztBQUFBLEVBQ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