@checkdigit/eslint-plugin 7.5.0-PR.75-0252 → 7.5.0-PR.93-6f1c

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.
Files changed (71) hide show
  1. package/dist-mjs/index.mjs +4 -146
  2. package/dist-mjs/require-fixed-services-import.mjs +1 -1
  3. package/dist-mjs/require-resolve-full-response.mjs +1 -1
  4. package/dist-types/index.d.ts +1 -1
  5. package/package.json +1 -1
  6. package/src/index.ts +2 -144
  7. package/src/require-fixed-services-import.ts +1 -1
  8. package/src/require-resolve-full-response.ts +0 -2
  9. package/dist-mjs/agent/add-assert-import.mjs +0 -58
  10. package/dist-mjs/agent/add-base-path-const.mjs +0 -65
  11. package/dist-mjs/agent/add-base-path-import.mjs +0 -60
  12. package/dist-mjs/agent/add-url-domain.mjs +0 -61
  13. package/dist-mjs/agent/agent-test-wiring.mjs +0 -221
  14. package/dist-mjs/agent/fetch-response-body-json.mjs +0 -146
  15. package/dist-mjs/agent/fetch-response-header-getter.mjs +0 -117
  16. package/dist-mjs/agent/fetch-response-status.mjs +0 -66
  17. package/dist-mjs/agent/fetch-then.mjs +0 -269
  18. package/dist-mjs/agent/fetch.mjs +0 -38
  19. package/dist-mjs/agent/file.mjs +0 -43
  20. package/dist-mjs/agent/fix-function-call-arguments.mjs +0 -153
  21. package/dist-mjs/agent/no-fixture.mjs +0 -361
  22. package/dist-mjs/agent/no-mapped-response.mjs +0 -75
  23. package/dist-mjs/agent/no-service-wrapper.mjs +0 -185
  24. package/dist-mjs/agent/no-status-code.mjs +0 -59
  25. package/dist-mjs/agent/no-unused-function-argument.mjs +0 -79
  26. package/dist-mjs/agent/no-unused-imports.mjs +0 -81
  27. package/dist-mjs/agent/no-unused-service-variable.mjs +0 -74
  28. package/dist-mjs/agent/response-reference.mjs +0 -70
  29. package/dist-mjs/agent/url.mjs +0 -32
  30. package/dist-types/agent/add-assert-import.d.ts +0 -4
  31. package/dist-types/agent/add-base-path-const.d.ts +0 -4
  32. package/dist-types/agent/add-base-path-import.d.ts +0 -4
  33. package/dist-types/agent/add-url-domain.d.ts +0 -4
  34. package/dist-types/agent/agent-test-wiring.d.ts +0 -4
  35. package/dist-types/agent/fetch-response-body-json.d.ts +0 -4
  36. package/dist-types/agent/fetch-response-header-getter.d.ts +0 -4
  37. package/dist-types/agent/fetch-response-status.d.ts +0 -4
  38. package/dist-types/agent/fetch-then.d.ts +0 -4
  39. package/dist-types/agent/fetch.d.ts +0 -5
  40. package/dist-types/agent/file.d.ts +0 -7
  41. package/dist-types/agent/fix-function-call-arguments.d.ts +0 -9
  42. package/dist-types/agent/no-fixture.d.ts +0 -4
  43. package/dist-types/agent/no-mapped-response.d.ts +0 -4
  44. package/dist-types/agent/no-service-wrapper.d.ts +0 -4
  45. package/dist-types/agent/no-status-code.d.ts +0 -4
  46. package/dist-types/agent/no-unused-function-argument.d.ts +0 -4
  47. package/dist-types/agent/no-unused-imports.d.ts +0 -4
  48. package/dist-types/agent/no-unused-service-variable.d.ts +0 -4
  49. package/dist-types/agent/response-reference.d.ts +0 -16
  50. package/dist-types/agent/url.d.ts +0 -4
  51. package/src/agent/add-assert-import.ts +0 -74
  52. package/src/agent/add-base-path-const.ts +0 -81
  53. package/src/agent/add-base-path-import.ts +0 -69
  54. package/src/agent/add-url-domain.ts +0 -76
  55. package/src/agent/agent-test-wiring.ts +0 -273
  56. package/src/agent/fetch-response-body-json.ts +0 -197
  57. package/src/agent/fetch-response-header-getter.ts +0 -148
  58. package/src/agent/fetch-response-status.ts +0 -87
  59. package/src/agent/fetch-then.ts +0 -357
  60. package/src/agent/fetch.ts +0 -57
  61. package/src/agent/file.ts +0 -42
  62. package/src/agent/fix-function-call-arguments.ts +0 -200
  63. package/src/agent/no-fixture.ts +0 -521
  64. package/src/agent/no-mapped-response.ts +0 -84
  65. package/src/agent/no-service-wrapper.ts +0 -241
  66. package/src/agent/no-status-code.ts +0 -72
  67. package/src/agent/no-unused-function-argument.ts +0 -98
  68. package/src/agent/no-unused-imports.ts +0 -103
  69. package/src/agent/no-unused-service-variable.ts +0 -93
  70. package/src/agent/response-reference.ts +0 -129
  71. package/src/agent/url.ts +0 -32
@@ -1,59 +0,0 @@
1
- // src/agent/no-status-code.ts
2
- import { ESLintUtils } from "@typescript-eslint/utils";
3
- import getDocumentationUrl from "../get-documentation-url.mjs";
4
- var ruleId = "no-status-code";
5
- var createRule = ESLintUtils.RuleCreator((name) => getDocumentationUrl(name));
6
- var rule = createRule({
7
- name: ruleId,
8
- meta: {
9
- type: "suggestion",
10
- docs: {
11
- description: 'Access the status code property of the fetch Response using "status" instead of "statusCode".'
12
- },
13
- messages: {
14
- replaceStatusCode: 'Replace "statusCode" with "status".',
15
- unknownError: 'Unknown error occurred in file "{{fileName}}": {{ error }}.'
16
- },
17
- fixable: "code",
18
- schema: []
19
- },
20
- defaultOptions: [],
21
- create(context) {
22
- const parserServices = ESLintUtils.getParserServices(context);
23
- const typeChecker = parserServices.program.getTypeChecker();
24
- return {
25
- 'MemberExpression[property.name="statusCode"]': (responseStatusCode) => {
26
- try {
27
- const responseNode = parserServices.esTreeNodeToTSNodeMap.get(responseStatusCode.object);
28
- const responseType = typeChecker.getTypeAtLocation(responseNode);
29
- const shouldReplace = responseType.getProperties().some((symbol) => symbol.name === "status") && !responseType.getProperties().some((symbol) => symbol.name === "statusCode");
30
- if (shouldReplace) {
31
- context.report({
32
- messageId: "replaceStatusCode",
33
- node: responseStatusCode.property,
34
- fix(fixer) {
35
- return fixer.replaceText(responseStatusCode.property, "status");
36
- }
37
- });
38
- }
39
- } catch (error) {
40
- console.error(`Failed to apply ${ruleId} rule for file "${context.filename}":`, error);
41
- context.report({
42
- node: responseStatusCode,
43
- messageId: "unknownError",
44
- data: {
45
- fileName: context.filename,
46
- error: error instanceof Error ? error.toString() : JSON.stringify(error)
47
- }
48
- });
49
- }
50
- }
51
- };
52
- }
53
- });
54
- var no_status_code_default = rule;
55
- export {
56
- no_status_code_default as default,
57
- ruleId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FBSSxlQUFlO0FBQ2pCLG9CQUFRLE9BQU87QUFBQSxjQUNiLFdBQVc7QUFBQSxjQUNYLE1BQU0sbUJBQW1CO0FBQUEsY0FDekIsSUFBSSxPQUFPO0FBQ1QsdUJBQU8sTUFBTSxZQUFZLG1CQUFtQixVQUFVLFFBQVE7QUFBQSxjQUNoRTtBQUFBLFlBQ0YsQ0FBQztBQUFBLFVBQ0g7QUFBQSxRQUNGLFNBQVMsT0FBTztBQUVkLGtCQUFRLE1BQU0sbUJBQW1CLE1BQU0sbUJBQW1CLFFBQVEsUUFBUSxNQUFNLEtBQUs7QUFDckYsa0JBQVEsT0FBTztBQUFBLFlBQ2IsTUFBTTtBQUFBLFlBQ04sV0FBVztBQUFBLFlBQ1gsTUFBTTtBQUFBLGNBQ0osVUFBVSxRQUFRO0FBQUEsY0FDbEIsT0FBTyxpQkFBaUIsUUFBUSxNQUFNLFNBQVMsSUFBSSxLQUFLLFVBQVUsS0FBSztBQUFBLFlBQ3pFO0FBQUEsVUFDRixDQUFDO0FBQUEsUUFDSDtBQUFBLE1BQ0Y7QUFBQSxJQUNGO0FBQUEsRUFDRjtBQUNGLENBQUM7QUFFRCxJQUFPLHlCQUFROyIsCiAgIm5hbWVzIjogW10KfQo=
@@ -1,79 +0,0 @@
1
- // src/agent/no-unused-function-argument.ts
2
- import { strict as assert } from "node:assert";
3
- import { ESLintUtils, TSESTree } from "@typescript-eslint/utils";
4
- import getDocumentationUrl from "../get-documentation-url.mjs";
5
- var ruleId = "no-unused-function-argument";
6
- var createRule = ESLintUtils.RuleCreator((name) => getDocumentationUrl(name));
7
- var rule = createRule({
8
- name: ruleId,
9
- meta: {
10
- type: "suggestion",
11
- docs: {
12
- description: "Remove unused function arguments."
13
- },
14
- messages: {
15
- removeUnusedFunctionArguments: "Removing unused function arguments.",
16
- unknownError: 'Unknown error occurred in file "{{fileName}}": {{ error }}.'
17
- },
18
- fixable: "code",
19
- schema: []
20
- },
21
- defaultOptions: [],
22
- create(context) {
23
- const sourceCode = context.sourceCode;
24
- function isParameterUsed(parameter, scope) {
25
- return scope.references.some((ref) => ref.identifier.name === parameter.name) || scope.childScopes.some((childScope) => isParameterUsed(parameter, childScope));
26
- }
27
- return {
28
- FunctionDeclaration(functionDeclaration) {
29
- try {
30
- const parameters = functionDeclaration.params;
31
- if (parameters.length === 0) {
32
- return;
33
- }
34
- const functionScope = sourceCode.getScope(functionDeclaration);
35
- const parametersToKeep = parameters.filter(
36
- (parameter) => parameter.type !== TSESTree.AST_NODE_TYPES.Identifier || isParameterUsed(parameter, functionScope)
37
- );
38
- if (parametersToKeep.length === parameters.length) {
39
- return;
40
- }
41
- const updatedParameters = parametersToKeep.map((parameter) => sourceCode.getText(parameter)).join(", ");
42
- context.report({
43
- node: functionDeclaration,
44
- messageId: "removeUnusedFunctionArguments",
45
- fix(fixer) {
46
- const firstParameter = parameters[0];
47
- const lastParameter = parameters.at(-1);
48
- assert.ok(firstParameter !== void 0 && lastParameter !== void 0);
49
- const tokenAfterParameters = sourceCode.getTokenAfter(lastParameter);
50
- return fixer.replaceTextRange(
51
- [
52
- firstParameter.range[0],
53
- tokenAfterParameters?.value === "," ? tokenAfterParameters.range[1] : lastParameter.range[1]
54
- ],
55
- updatedParameters
56
- );
57
- }
58
- });
59
- } catch (error) {
60
- console.error(`Failed to apply ${ruleId} rule for file "${context.filename}":`, error);
61
- context.report({
62
- node: functionDeclaration,
63
- messageId: "unknownError",
64
- data: {
65
- fileName: context.filename,
66
- error: error instanceof Error ? error.toString() : JSON.stringify(error)
67
- }
68
- });
69
- }
70
- }
71
- };
72
- }
73
- });
74
- var no_unused_function_argument_default = rule;
75
- export {
76
- no_unused_function_argument_default as default,
77
- ruleId
78
- };
79
- //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vc3JjL2FnZW50L25vLXVudXNlZC1mdW5jdGlvbi1hcmd1bWVudC50cyJdLAogICJtYXBwaW5ncyI6ICI7Q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UEsUUFDSDtBQUFBLE1BQ0Y7QUFBQSxJQUNGO0FBQUEsRUFDRjtBQUNGLENBQUM7QUFFRCxJQUFPLHNDQUFROyIsCiAgIm5hbWVzIjogW10KfQo=
@@ -1,81 +0,0 @@
1
- // src/agent/no-unused-imports.ts
2
- import { ESLintUtils, TSESTree } from "@typescript-eslint/utils";
3
- import getDocumentationUrl from "../get-documentation-url.mjs";
4
- var ruleId = "no-unused-imports";
5
- var createRule = ESLintUtils.RuleCreator((name) => getDocumentationUrl(name));
6
- var rule = createRule({
7
- name: ruleId,
8
- meta: {
9
- type: "suggestion",
10
- docs: {
11
- description: "Remove unused imports."
12
- },
13
- messages: {
14
- removeUnusedImports: "Removing unused imports.",
15
- unknownError: 'Unknown error occurred in file "{{fileName}}": {{ error }}.'
16
- },
17
- fixable: "code",
18
- schema: []
19
- },
20
- defaultOptions: [],
21
- create(context) {
22
- const sourceCode = context.sourceCode;
23
- function isImportUsed(specifier, scope) {
24
- return specifier.type !== TSESTree.AST_NODE_TYPES.ImportSpecifier || scope.references.some((ref) => ref.identifier.name === specifier.local.name) || scope.childScopes.some((childScope) => isImportUsed(specifier, childScope));
25
- }
26
- return {
27
- ImportDeclaration(importDeclaration) {
28
- try {
29
- const moduleName = importDeclaration.source.value;
30
- if (!importDeclaration.specifiers.every(
31
- (specifier) => specifier.type === TSESTree.AST_NODE_TYPES.ImportSpecifier
32
- ) || // [TODO:] move to meta schema
33
- !["@checkdigit/serve-runtime", "@checkdigit/fixture"].includes(moduleName)) {
34
- return;
35
- }
36
- const originalSpecifiers = importDeclaration.specifiers;
37
- const scope = sourceCode.getScope(importDeclaration);
38
- const usedSpecifiers = originalSpecifiers.filter((specifier) => isImportUsed(specifier, scope));
39
- if (usedSpecifiers.length === originalSpecifiers.length) {
40
- return;
41
- }
42
- if (usedSpecifiers.length === 0) {
43
- context.report({
44
- messageId: "removeUnusedImports",
45
- node: importDeclaration,
46
- *fix(fixer) {
47
- yield fixer.remove(importDeclaration);
48
- }
49
- });
50
- return;
51
- }
52
- const usedSpecifierTexts = usedSpecifiers.map((specifier) => sourceCode.getText(specifier));
53
- const updatedImportDeclaration = `import ${importDeclaration.importKind === "type" ? "type " : ""}{ ${usedSpecifierTexts.join(", ")} } from '${moduleName}';`;
54
- context.report({
55
- messageId: "removeUnusedImports",
56
- node: importDeclaration,
57
- *fix(fixer) {
58
- yield fixer.replaceText(importDeclaration, updatedImportDeclaration);
59
- }
60
- });
61
- } catch (error) {
62
- console.error(`Failed to apply ${ruleId} rule for file "${context.filename}":`, error);
63
- context.report({
64
- node: importDeclaration,
65
- messageId: "unknownError",
66
- data: {
67
- fileName: context.filename,
68
- error: error instanceof Error ? error.toString() : JSON.stringify(error)
69
- }
70
- });
71
- }
72
- }
73
- };
74
- }
75
- });
76
- var no_unused_imports_default = rule;
77
- export {
78
- no_unused_imports_default as default,
79
- ruleId
80
- };
81
- //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vc3JjL2FnZW50L25vLXVudXNlZC1pbXBvcnRzLnRzIl0sCiAgIm1hcHBpbmdzIjogIjtBQVFBLFNBQVMsYUFBYSxnQkFBZ0I7QUFHdEMsT0FBTyx5QkFBeUI7QUFFekIsSUFBTSxTQUFTO0FBRXRCLElBQU0sYUFBYSxZQUFZLFlBQVksQ0FBQyxTQUFTLG9CQUFvQixJQUFJLENBQUM7QUFFOUUsSUFBTSxPQUF1RSxXQUFXO0FBQUEsRUFDdEYsTUFBTTtBQUFBLEVBQ04sTUFBTTtBQUFBLElBQ0osTUFBTTtBQUFBLElBQ04sTUFBTTtBQUFBLE1BQ0osYUFBYTtBQUFBLElBQ2Y7QUFBQSxJQUNBLFVBQVU7QUFBQSxNQUNSLHFCQUFxQjtBQUFBLE1BQ3JCLGNBQWM7QUFBQSxJQUNoQjtBQUFBLElBQ0EsU0FBUztBQUFBLElBQ1QsUUFBUSxDQUFDO0FBQUEsRUFDWDtBQUFBLEVBQ0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FBQztBQUNEO0FBQUEsVUFDRjtBQUVBLGdCQUFNLHFCQUFxQixlQUFlLElBQUksQ0FBQyxjQUFjLFdBQVcsUUFBUSxTQUFTLENBQUM7QUFDMUYsZ0JBQU0sMkJBQTJCLFVBQVUsa0JBQWtCLGVBQWUsU0FBUyxVQUFVLEVBQUUsS0FBSyxtQkFBbUIsS0FBSyxJQUFJLENBQUMsWUFBWSxVQUFVO0FBRXpKLGtCQUFRLE9BQU87QUFBQSxZQUNiLFdBQVc7QUFBQSxZQUNYLE1BQU07QUFBQSxZQUNOLENBQUMsSUFBSSxPQUFPO0FBQ1Ysb0JBQU0sTUFBTSxZQUFZLG1CQUFtQix3QkFBd0I7QUFBQSxZQUNyRTtBQUFBLFVBQ0YsQ0FBQztBQUFBLFFBQ0gsU0FBUyxPQUFPO0FBRWQsa0JBQVEsTUFBTSxtQkFBbUIsTUFBTSxtQkFBbUIsUUFBUSxRQUFRLE1BQU0sS0FBSztBQUNyRixrQkFBUSxPQUFPO0FBQUEsWUFDYixNQUFNO0FBQUEsWUFDTixXQUFXO0FBQUEsWUFDWCxNQUFNO0FBQUEsY0FDSixVQUFVLFFBQVE7QUFBQSxjQUNsQixPQUFPLGlCQUFpQixRQUFRLE1BQU0sU0FBUyxJQUFJLEtBQUssVUFBVSxLQUFLO0FBQUEsWUFDekU7QUFBQSxVQUNGLENBQUM7QUFBQSxRQUNIO0FBQUEsTUFDRjtBQUFBLElBQ0Y7QUFBQSxFQUNGO0FBQ0YsQ0FBQztBQUVELElBQU8sNEJBQVE7IiwKICAibmFtZXMiOiBbXQp9Cg==
@@ -1,74 +0,0 @@
1
- // src/agent/no-unused-service-variable.ts
2
- import { strict as assert } from "node:assert";
3
- import { ESLintUtils, TSESTree } from "@typescript-eslint/utils";
4
- import getDocumentationUrl from "../get-documentation-url.mjs";
5
- import { getEnclosingScopeNode } from "../library/ts-tree.mjs";
6
- var ruleId = "no-unused-service-variable";
7
- var createRule = ESLintUtils.RuleCreator((name) => getDocumentationUrl(name));
8
- var rule = createRule({
9
- name: ruleId,
10
- meta: {
11
- type: "suggestion",
12
- docs: {
13
- description: "Remove unused service variables."
14
- },
15
- messages: {
16
- removeUnusedServiceVariables: "Removing unused service variables.",
17
- unknownError: 'Unknown error occurred in file "{{fileName}}": {{ error }}.'
18
- },
19
- fixable: "code",
20
- schema: []
21
- },
22
- defaultOptions: [],
23
- create(context) {
24
- const sourceCode = context.sourceCode;
25
- const scopeManager = sourceCode.scopeManager;
26
- function isVariableUsed(variableIdentifier, scope) {
27
- const variable = scope.variables.find((variableToCheck) => variableToCheck.name === variableIdentifier.name);
28
- return variable !== void 0 && variable.references.length > 1;
29
- }
30
- return {
31
- VariableDeclaration(variableDeclaration) {
32
- try {
33
- if (variableDeclaration.declarations.length !== 1 || !sourceCode.getText(variableDeclaration).includes(".service.")) {
34
- return;
35
- }
36
- const enclosingScopeNode = getEnclosingScopeNode(variableDeclaration);
37
- assert.ok(enclosingScopeNode, "enclosingScopeNode is undefined");
38
- const declarator = variableDeclaration.declarations[0];
39
- if (declarator.id.type !== TSESTree.AST_NODE_TYPES.Identifier) {
40
- return;
41
- }
42
- const scope = scopeManager?.acquire(enclosingScopeNode);
43
- assert.ok(scope, "variable declaration is undefined");
44
- if (isVariableUsed(declarator.id, scope)) {
45
- return;
46
- }
47
- context.report({
48
- node: variableDeclaration,
49
- messageId: "removeUnusedServiceVariables",
50
- fix(fixer) {
51
- return fixer.remove(variableDeclaration);
52
- }
53
- });
54
- } catch (error) {
55
- console.error(`Failed to apply ${ruleId} rule for file "${context.filename}":`, error);
56
- context.report({
57
- node: variableDeclaration,
58
- messageId: "unknownError",
59
- data: {
60
- fileName: context.filename,
61
- error: error instanceof Error ? error.toString() : JSON.stringify(error)
62
- }
63
- });
64
- }
65
- }
66
- };
67
- }
68
- });
69
- var no_unused_service_variable_default = rule;
70
- export {
71
- no_unused_service_variable_default as default,
72
- ruleId
73
- };
74
- //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW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node:assert";
3
- import "eslint";
4
- import debug from "debug";
5
- import { getParent } from "../library/tree.mjs";
6
- var log = debug("eslint-plugin:response-reference");
7
- function analyzeResponseReferences(variableDeclaration, scopeManager) {
8
- const results = {
9
- bodyReferences: [],
10
- headersReferences: [],
11
- statusReferences: []
12
- };
13
- if (!variableDeclaration) {
14
- return results;
15
- }
16
- const responseVariables = scopeManager.getDeclaredVariables(variableDeclaration);
17
- for (const responseVariable of responseVariables) {
18
- const identifier = responseVariable.identifiers[0];
19
- assert.ok(identifier);
20
- const identifierParent = getParent(identifier);
21
- assert.ok(identifierParent);
22
- if (identifierParent.type === "VariableDeclarator") {
23
- results.variable = responseVariable;
24
- const responseReferences = responseVariable.references.map(
25
- (responseReference) => getParent(responseReference.identifier)
26
- );
27
- results.bodyReferences = responseReferences.filter(
28
- (node) => node?.type === "MemberExpression" && node.property.type === "Identifier" && node.property.name === "body"
29
- );
30
- results.headersReferences = responseReferences.filter(
31
- (node) => node?.type === "MemberExpression" && node.property.type === "Identifier" && (node.property.name === "header" || node.property.name === "headers" || node.property.name === "get")
32
- );
33
- results.statusReferences = responseReferences.filter(
34
- (node) => node?.type === "MemberExpression" && node.property.type === "Identifier" && (node.property.name === "status" || node.property.name === "statusCode")
35
- );
36
- } else if (
37
- // body reference through destruction/renaming, e.g. "const { body } = ..."
38
- identifierParent.type === "Property" && identifierParent.key.type === "Identifier" && identifierParent.key.name === "body"
39
- ) {
40
- results.destructuringBodyVariable = responseVariable;
41
- } else if (
42
- // header reference through destruction/renaming, e.g. "const { headers } = ..."
43
- identifierParent.type === "Property" && identifierParent.key.type === "Identifier" && identifierParent.key.name === "headers"
44
- ) {
45
- results.destructuringHeadersVariable = responseVariable;
46
- results.destructuringHeadersReferences = responseVariable.references.map((reference) => reference.identifier).map(getParent).filter(
47
- (parent) => parent?.type === "MemberExpression" && parent.property.type === "Identifier" && parent.property.name !== "get" && getParent(parent)?.type !== "CallExpression"
48
- );
49
- } else if (identifierParent.type === "Property") {
50
- const parent = getParent(identifierParent);
51
- if (parent?.type === "ObjectPattern") {
52
- const parent2 = getParent(parent);
53
- if (parent2?.type === "Property" && parent2.key.type === "Identifier" && parent2.key.name === "body") {
54
- results.destructuringBodyVariable = parent;
55
- }
56
- if (parent2?.type === "Property" && parent2.key.type === "Identifier" && (parent2.key.name === "header" || parent2.key.name === "headers")) {
57
- results.destructuringHeadersVariable = parent;
58
- }
59
- }
60
- } else {
61
- log("+++++++ can not handle identifierParent", identifierParent);
62
- throw new Error(`Unknown response variable reference: ${responseVariable.name}`);
63
- }
64
- }
65
- return results;
66
- }
67
- export {
68
- analyzeResponseReferences
69
- };
70
- //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vc3JjL2FnZW50L3Jlc3BvbnNlLXJlZmVyZW5jZS50cyJdLAogICJtYXBwaW5ncyI6ICI7QUFRQSxTQUFTLFVBQVUsY0FBYztBQUVqQyxPQUEyQjtBQUMzQixPQUFPLFdBQVc7QUFFbEIsU0FBUyxpQkFBaUI7QUFFMUIsSUFBTSxNQUFNLE1BQU0sa0NBQWtDO0FBTzdDLFNBQVMsMEJBQ2QscUJBQ0EsY0FTQTtBQUNBLFFBQU0sVUFRRjtBQUFBLElBQ0YsZ0JBQWdCLENBQUM7QUFBQSxJQUNqQixtQkFBbUIsQ0FBQztBQUFBLElBQ3BCLGtCQUFrQixDQUFDO0FBQUEsRUFDckI7QUFDQSxNQUFJLENBQUMscUJBQXFCO0FBQ3hCLFdBQU87QUFBQSxFQUNUO0FBRUEsUUFBTSxvQkFBb0IsYUFBYSxxQkFBcUIsbUJBQW1CO0FBQy9FLGFBQVcsb0JBQW9CLG1CQUFtQjtBQUNoRCxVQUFNLGFBQWEsaUJBQWlCLFlBQVksQ0FBQztBQUNqRCxXQUFPLEdBQUcsVUFBVTtBQUNwQixVQUFNLG1CQUFtQixVQUFVLFVBQVU7QUFDN0MsV0FBTyxHQUFHLGdCQUFnQjtBQUM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;
4
- function isServiceApiCallUrl(url) {
5
- return PLAIN_URL_REGEXP.test(url) || TOKENIZED_URL_REGEXP.test(url);
6
- }
7
- function replaceEndpointUrlPrefixWithBasePath(url) {
8
- return url.replace(
9
- /^(?<quotStart>[`'])\/(?<servicename>\w+(?<parts>-\w+)*)(?<path>\/v\d+\/)(?<endpoint>(?<any>.|\r|\n)+)(?<quotEnd>[`'])$/u,
10
- // eslint-disable-next-line no-template-curly-in-string
11
- "`${BASE_PATH}/$5`"
12
- );
13
- }
14
- function replaceEndpointUrlPrefixWithDomain(url) {
15
- return url.replace(
16
- /^(?<quotStart>[`'])\/(?<servicename>\w+(?<parts>-\w+)*)(?<path>\/v\d+\/(?<any>.|\r|\n)+(?<quotEnd>[`'])$)/u,
17
- "$1https://$2.checkdigit/$2$4"
18
- );
19
- }
20
- function addBasePathUrlDomain(url) {
21
- return url.replace(
22
- /^(?<quotStart>[`'])\/(?<servicename>\w+(?<parts>-\w+)*)(?<path>\/v\d+(?<quotEnd>[`'])$)/u,
23
- "$1https://$2.checkdigit/$2$4"
24
- );
25
- }
26
- export {
27
- addBasePathUrlDomain,
28
- isServiceApiCallUrl,
29
- replaceEndpointUrlPrefixWithBasePath,
30
- replaceEndpointUrlPrefixWithDomain
31
- };
32
- //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vc3JjL2FnZW50L3VybC50cyJdLAogICJtYXBwaW5ncyI6ICI7QUFHQSxJQUFNLG1CQUEyQjtBQUVqQyxJQUFNLHVCQUErQjtBQUU5QixTQUFTLG9CQUFvQixLQUFzQjtBQUN4RCxTQUFPLGlCQUFpQixLQUFLLEdBQUcsS0FBSyxxQkFBcUIsS0FBSyxHQUFHO0FBQ3BFO0FBRU8sU0FBUyxxQ0FBcUMsS0FBcUI7QUFDeEUsU0FBTyxJQUFJO0FBQUEsSUFDVDtBQUFBO0FBQUEsSUFFQTtBQUFBLEVBQ0Y7QUFDRjtBQUVPLFNBQVMsbUNBQW1DLEtBQXFCO0FBQ3RFLFNBQU8sSUFBSTtBQUFBLElBQ1Q7QUFBQSxJQUNBO0FBQUEsRUFDRjtBQUNGO0FBRU8sU0FBUyxxQkFBcUIsS0FBcUI7QUFDeEQsU0FBTyxJQUFJO0FBQUEsSUFDVDtBQUFBLElBQ0E7QUFBQSxFQUNGO0FBQ0Y7IiwKICAibmFtZXMiOiBbXQp9Cg==
@@ -1,4 +0,0 @@
1
- import { ESLintUtils } from '@typescript-eslint/utils';
2
- export declare const ruleId = "add-assert-import";
3
- declare const rule: ESLintUtils.RuleModule<'addAssertImport'>;
4
- export default rule;
@@ -1,4 +0,0 @@
1
- import { ESLintUtils } from '@typescript-eslint/utils';
2
- export declare const ruleId = "add-base-path-const";
3
- declare const rule: ESLintUtils.RuleModule<'addBasePathConst'>;
4
- export default rule;
@@ -1,4 +0,0 @@
1
- import { ESLintUtils } from '@typescript-eslint/utils';
2
- export declare const ruleId = "add-base-path-import";
3
- declare const rule: ESLintUtils.RuleModule<'addBasePathImport'>;
4
- export default rule;
@@ -1,4 +0,0 @@
1
- import { ESLintUtils } from '@typescript-eslint/utils';
2
- export declare const ruleId = "add-url-domain";
3
- declare const rule: ESLintUtils.RuleModule<'addDomain' | 'unknownError'>;
4
- export default rule;
@@ -1,4 +0,0 @@
1
- import { ESLintUtils } from '@typescript-eslint/utils';
2
- export declare const ruleId = "agent-test-wiring";
3
- declare const rule: ESLintUtils.RuleModule<'updateTestWiring' | 'unknownError'>;
4
- export default rule;
@@ -1,4 +0,0 @@
1
- import { ESLintUtils } from '@typescript-eslint/utils';
2
- export declare const ruleId = "fetch-response-body-json";
3
- declare const rule: ESLintUtils.RuleModule<'unknownError' | 'replaceBodyWithJson' | 'refactorNeeded'>;
4
- export default rule;
@@ -1,4 +0,0 @@
1
- import { ESLintUtils } from '@typescript-eslint/utils';
2
- export declare const ruleId = "fetch-response-header-getter-ts";
3
- declare const rule: ESLintUtils.RuleModule<'unknownError' | 'useGetter'>;
4
- export default rule;
@@ -1,4 +0,0 @@
1
- import { ESLintUtils } from '@typescript-eslint/utils';
2
- export declare const ruleId = "fetch-response-status";
3
- declare const rule: ESLintUtils.RuleModule<'unknownError' | 'renameStatusCodeProperty'>;
4
- export default rule;
@@ -1,4 +0,0 @@
1
- import { type Rule } from 'eslint';
2
- export declare const ruleId = "fetch-then";
3
- declare const rule: Rule.RuleModule;
4
- export default rule;
@@ -1,5 +0,0 @@
1
- import type { Node } from 'estree';
2
- export declare function getResponseBodyRetrievalText(responseVariableName: string): string;
3
- export declare function getResponseHeadersRetrievalText(responseVariableName: string): string;
4
- export declare function isInvalidResponseHeadersAccess(responseHeadersAccess: Node): boolean;
5
- export declare function hasAssertions(fixtureCall: Node): boolean;
@@ -1,7 +0,0 @@
1
- export declare function isApiIndexFile(filename: string): boolean;
2
- export declare function getProjectRootFolder(indexFilename: string): string;
3
- export declare function getSwaggerPathByIndexFile(indexFilename: string): string;
4
- export declare function loadSwagger(filename: string): string;
5
- export declare function loadPackageJson(projectRoot: string): string;
6
- export declare function getApiFolder(folder: string): string | undefined;
7
- export declare function getApiIndexPathByFilename(filename: string): string | undefined;
@@ -1,9 +0,0 @@
1
- import { ESLintUtils } from '@typescript-eslint/utils';
2
- export declare const ruleId = "fix-function-call-arguments";
3
- export interface FixFunctionCallArgumentsRuleOptions {
4
- typesToCheck: string[];
5
- }
6
- declare const rule: ESLintUtils.RuleModule<'removeIncompatibleFunctionArguments' | 'unknownError', [
7
- FixFunctionCallArgumentsRuleOptions
8
- ]>;
9
- export default rule;
@@ -1,4 +0,0 @@
1
- import { type Rule } from 'eslint';
2
- export declare const ruleId = "no-fixture";
3
- declare const rule: Rule.RuleModule;
4
- export default rule;
@@ -1,4 +0,0 @@
1
- import { ESLintUtils } from '@typescript-eslint/utils';
2
- export declare const ruleId = "no-mapped-response";
3
- declare const rule: ESLintUtils.RuleModule<'unknownError' | 'replaceFullResponseWithFetchResponse'>;
4
- export default rule;
@@ -1,4 +0,0 @@
1
- import { ESLintUtils } from '@typescript-eslint/utils';
2
- export declare const ruleId = "no-service-wrapper";
3
- declare const rule: ESLintUtils.RuleModule<'unknownError' | 'preferNativeFetch' | 'invalidOptions'>;
4
- export default rule;
@@ -1,4 +0,0 @@
1
- import { ESLintUtils } from '@typescript-eslint/utils';
2
- export declare const ruleId = "no-status-code";
3
- declare const rule: ESLintUtils.RuleModule<'unknownError' | 'replaceStatusCode'>;
4
- export default rule;
@@ -1,4 +0,0 @@
1
- import { ESLintUtils } from '@typescript-eslint/utils';
2
- export declare const ruleId = "no-unused-function-argument";
3
- declare const rule: ESLintUtils.RuleModule<'unknownError' | 'removeUnusedFunctionArguments'>;
4
- export default rule;
@@ -1,4 +0,0 @@
1
- import { ESLintUtils } from '@typescript-eslint/utils';
2
- export declare const ruleId = "no-unused-imports";
3
- declare const rule: ESLintUtils.RuleModule<'unknownError' | 'removeUnusedImports'>;
4
- export default rule;
@@ -1,4 +0,0 @@
1
- import { ESLintUtils } from '@typescript-eslint/utils';
2
- export declare const ruleId = "no-unused-service-variable";
3
- declare const rule: ESLintUtils.RuleModule<'unknownError' | 'removeUnusedServiceVariables'>;
4
- export default rule;
@@ -1,16 +0,0 @@
1
- import type { MemberExpression, ObjectPattern, VariableDeclaration } from 'estree';
2
- import { type Scope } from 'eslint';
3
- /**
4
- * analyze response related variables and their references
5
- * the implementation is for fixture API, but it can be used for fetch API as well since the tree structure is similar
6
- * @param variableDeclaration - variable declaration node
7
- */
8
- export declare function analyzeResponseReferences(variableDeclaration: VariableDeclaration | undefined, scopeManager: Scope.ScopeManager): {
9
- variable?: Scope.Variable;
10
- bodyReferences: MemberExpression[];
11
- headersReferences: MemberExpression[];
12
- statusReferences: MemberExpression[];
13
- destructuringBodyVariable?: Scope.Variable | ObjectPattern;
14
- destructuringHeadersVariable?: Scope.Variable | ObjectPattern;
15
- destructuringHeadersReferences?: MemberExpression[] | undefined;
16
- };
@@ -1,4 +0,0 @@
1
- export declare function isServiceApiCallUrl(url: string): boolean;
2
- export declare function replaceEndpointUrlPrefixWithBasePath(url: string): string;
3
- export declare function replaceEndpointUrlPrefixWithDomain(url: string): string;
4
- export declare function addBasePathUrlDomain(url: string): string;
@@ -1,74 +0,0 @@
1
- // agent/add-url-domain.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 { strict as assert } from 'node:assert';
10
-
11
- import { AST_NODE_TYPES, ESLintUtils } from '@typescript-eslint/utils';
12
-
13
- import getDocumentationUrl from '../get-documentation-url';
14
-
15
- export const ruleId = 'add-assert-import';
16
-
17
- const ASSERT_IMPORT_STATEMENT = "import { strict as assert } from 'node:assert';";
18
-
19
- const createRule = ESLintUtils.RuleCreator((name) => getDocumentationUrl(name));
20
-
21
- const rule: ESLintUtils.RuleModule<'addAssertImport'> = createRule({
22
- name: ruleId,
23
- meta: {
24
- type: 'suggestion',
25
- docs: {
26
- description: 'Add import of assert module of node.',
27
- },
28
- messages: {
29
- addAssertImport: 'Add import of assert module of node.',
30
- },
31
- fixable: 'code',
32
- schema: [],
33
- },
34
- defaultOptions: [],
35
- create(context) {
36
- let isAssertImported = false;
37
- let isAssertUsed = false;
38
-
39
- return {
40
- ImportDeclaration: (node) => {
41
- if (node.source.value === 'assert' || node.source.value === 'node:assert') {
42
- isAssertImported = true;
43
- }
44
- },
45
- CallExpression: (callExpression) => {
46
- // detect if assert is used
47
- if (
48
- (callExpression.callee.type === AST_NODE_TYPES.Identifier && callExpression.callee.name === 'assert') ||
49
- (callExpression.callee.type === AST_NODE_TYPES.MemberExpression &&
50
- callExpression.callee.object.type === AST_NODE_TYPES.Identifier &&
51
- callExpression.callee.object.name === 'assert')
52
- ) {
53
- isAssertUsed = true;
54
- }
55
- },
56
- 'Program:exit': (program) => {
57
- // add assert import if necessary
58
- if (isAssertUsed && !isAssertImported) {
59
- const firstStatement = program.body[0];
60
- assert(firstStatement);
61
- context.report({
62
- node: program,
63
- messageId: 'addAssertImport',
64
- fix(fixer) {
65
- return fixer.insertTextBefore(firstStatement, `${ASSERT_IMPORT_STATEMENT}\n`);
66
- },
67
- });
68
- }
69
- },
70
- };
71
- },
72
- });
73
-
74
- export default rule;