@checkdigit/eslint-plugin 7.5.0 → 7.6.0-PR.75-5da1
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/dist-mjs/agent/add-assert-import.mjs +58 -0
- package/dist-mjs/agent/add-base-path-const.mjs +65 -0
- package/dist-mjs/agent/add-base-path-import.mjs +60 -0
- package/dist-mjs/agent/add-url-domain.mjs +61 -0
- package/dist-mjs/agent/agent-test-wiring.mjs +221 -0
- package/dist-mjs/agent/fetch-response-body-json.mjs +146 -0
- package/dist-mjs/agent/fetch-response-header-getter.mjs +117 -0
- package/dist-mjs/agent/fetch-response-status.mjs +66 -0
- package/dist-mjs/agent/fetch-then.mjs +269 -0
- package/dist-mjs/agent/fetch.mjs +38 -0
- package/dist-mjs/agent/file.mjs +43 -0
- package/dist-mjs/agent/fix-function-call-arguments.mjs +153 -0
- package/dist-mjs/agent/no-fixture.mjs +361 -0
- package/dist-mjs/agent/no-mapped-response.mjs +75 -0
- package/dist-mjs/agent/no-service-wrapper.mjs +185 -0
- package/dist-mjs/agent/no-status-code.mjs +59 -0
- package/dist-mjs/agent/no-unused-function-argument.mjs +79 -0
- package/dist-mjs/agent/no-unused-imports.mjs +81 -0
- package/dist-mjs/agent/no-unused-service-variable.mjs +74 -0
- package/dist-mjs/agent/response-reference.mjs +70 -0
- package/dist-mjs/agent/url.mjs +32 -0
- package/dist-mjs/index.mjs +146 -4
- package/dist-types/agent/add-assert-import.d.ts +4 -0
- package/dist-types/agent/add-base-path-const.d.ts +4 -0
- package/dist-types/agent/add-base-path-import.d.ts +4 -0
- package/dist-types/agent/add-url-domain.d.ts +4 -0
- package/dist-types/agent/agent-test-wiring.d.ts +4 -0
- package/dist-types/agent/fetch-response-body-json.d.ts +4 -0
- package/dist-types/agent/fetch-response-header-getter.d.ts +4 -0
- package/dist-types/agent/fetch-response-status.d.ts +4 -0
- package/dist-types/agent/fetch-then.d.ts +4 -0
- package/dist-types/agent/fetch.d.ts +5 -0
- package/dist-types/agent/file.d.ts +7 -0
- package/dist-types/agent/fix-function-call-arguments.d.ts +9 -0
- package/dist-types/agent/no-fixture.d.ts +4 -0
- package/dist-types/agent/no-mapped-response.d.ts +4 -0
- package/dist-types/agent/no-service-wrapper.d.ts +4 -0
- package/dist-types/agent/no-status-code.d.ts +4 -0
- package/dist-types/agent/no-unused-function-argument.d.ts +4 -0
- package/dist-types/agent/no-unused-imports.d.ts +4 -0
- package/dist-types/agent/no-unused-service-variable.d.ts +4 -0
- package/dist-types/agent/response-reference.d.ts +16 -0
- package/dist-types/agent/url.d.ts +4 -0
- package/package.json +1 -96
- package/src/agent/add-assert-import.ts +74 -0
- package/src/agent/add-base-path-const.ts +81 -0
- package/src/agent/add-base-path-import.ts +69 -0
- package/src/agent/add-url-domain.ts +76 -0
- package/src/agent/agent-test-wiring.ts +273 -0
- package/src/agent/fetch-response-body-json.ts +197 -0
- package/src/agent/fetch-response-header-getter.ts +148 -0
- package/src/agent/fetch-response-status.ts +87 -0
- package/src/agent/fetch-then.ts +357 -0
- package/src/agent/fetch.ts +57 -0
- package/src/agent/file.ts +42 -0
- package/src/agent/fix-function-call-arguments.ts +200 -0
- package/src/agent/no-fixture.ts +521 -0
- package/src/agent/no-mapped-response.ts +84 -0
- package/src/agent/no-service-wrapper.ts +241 -0
- package/src/agent/no-status-code.ts +72 -0
- package/src/agent/no-unused-function-argument.ts +98 -0
- package/src/agent/no-unused-imports.ts +103 -0
- package/src/agent/no-unused-service-variable.ts +93 -0
- package/src/agent/response-reference.ts +129 -0
- package/src/agent/url.ts +32 -0
- package/src/index.ts +142 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
// agent/response-reference.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
|
+
import type { MemberExpression, ObjectPattern, VariableDeclaration } from 'estree';
|
|
11
|
+
import { type Scope } from 'eslint';
|
|
12
|
+
import debug from 'debug';
|
|
13
|
+
|
|
14
|
+
import { getParent } from '../library/tree';
|
|
15
|
+
|
|
16
|
+
const log = debug('eslint-plugin:response-reference');
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* analyze response related variables and their references
|
|
20
|
+
* the implementation is for fixture API, but it can be used for fetch API as well since the tree structure is similar
|
|
21
|
+
* @param variableDeclaration - variable declaration node
|
|
22
|
+
*/
|
|
23
|
+
export function analyzeResponseReferences(
|
|
24
|
+
variableDeclaration: VariableDeclaration | undefined,
|
|
25
|
+
scopeManager: Scope.ScopeManager,
|
|
26
|
+
): {
|
|
27
|
+
variable?: Scope.Variable;
|
|
28
|
+
bodyReferences: MemberExpression[];
|
|
29
|
+
headersReferences: MemberExpression[];
|
|
30
|
+
statusReferences: MemberExpression[];
|
|
31
|
+
destructuringBodyVariable?: Scope.Variable | ObjectPattern;
|
|
32
|
+
destructuringHeadersVariable?: Scope.Variable | ObjectPattern;
|
|
33
|
+
destructuringHeadersReferences?: MemberExpression[] | undefined;
|
|
34
|
+
} {
|
|
35
|
+
const results: {
|
|
36
|
+
variable?: Scope.Variable;
|
|
37
|
+
bodyReferences: MemberExpression[];
|
|
38
|
+
headersReferences: MemberExpression[];
|
|
39
|
+
statusReferences: MemberExpression[];
|
|
40
|
+
destructuringBodyVariable?: Scope.Variable | ObjectPattern;
|
|
41
|
+
destructuringHeadersVariable?: Scope.Variable | ObjectPattern;
|
|
42
|
+
destructuringHeadersReferences?: MemberExpression[] | undefined;
|
|
43
|
+
} = {
|
|
44
|
+
bodyReferences: [],
|
|
45
|
+
headersReferences: [],
|
|
46
|
+
statusReferences: [],
|
|
47
|
+
};
|
|
48
|
+
if (!variableDeclaration) {
|
|
49
|
+
return results;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const responseVariables = scopeManager.getDeclaredVariables(variableDeclaration);
|
|
53
|
+
for (const responseVariable of responseVariables) {
|
|
54
|
+
const identifier = responseVariable.identifiers[0];
|
|
55
|
+
assert.ok(identifier);
|
|
56
|
+
const identifierParent = getParent(identifier);
|
|
57
|
+
assert.ok(identifierParent);
|
|
58
|
+
if (identifierParent.type === 'VariableDeclarator') {
|
|
59
|
+
// e.g. const response = ...
|
|
60
|
+
results.variable = responseVariable;
|
|
61
|
+
const responseReferences = responseVariable.references.map((responseReference) =>
|
|
62
|
+
getParent(responseReference.identifier),
|
|
63
|
+
);
|
|
64
|
+
// e.g. response.body
|
|
65
|
+
results.bodyReferences = responseReferences.filter(
|
|
66
|
+
(node): node is MemberExpression =>
|
|
67
|
+
node?.type === 'MemberExpression' && node.property.type === 'Identifier' && node.property.name === 'body',
|
|
68
|
+
);
|
|
69
|
+
// e.g. response.headers / response.header / response.get()
|
|
70
|
+
results.headersReferences = responseReferences.filter(
|
|
71
|
+
(node): node is MemberExpression =>
|
|
72
|
+
node?.type === 'MemberExpression' &&
|
|
73
|
+
node.property.type === 'Identifier' &&
|
|
74
|
+
(node.property.name === 'header' || node.property.name === 'headers' || node.property.name === 'get'),
|
|
75
|
+
);
|
|
76
|
+
// e.g. response.status / response.statusCode
|
|
77
|
+
results.statusReferences = responseReferences.filter(
|
|
78
|
+
(node): node is MemberExpression =>
|
|
79
|
+
node?.type === 'MemberExpression' &&
|
|
80
|
+
node.property.type === 'Identifier' &&
|
|
81
|
+
(node.property.name === 'status' || node.property.name === 'statusCode'),
|
|
82
|
+
);
|
|
83
|
+
} else if (
|
|
84
|
+
// body reference through destruction/renaming, e.g. "const { body } = ..."
|
|
85
|
+
identifierParent.type === 'Property' &&
|
|
86
|
+
identifierParent.key.type === 'Identifier' &&
|
|
87
|
+
identifierParent.key.name === 'body'
|
|
88
|
+
) {
|
|
89
|
+
results.destructuringBodyVariable = responseVariable;
|
|
90
|
+
} else if (
|
|
91
|
+
// header reference through destruction/renaming, e.g. "const { headers } = ..."
|
|
92
|
+
identifierParent.type === 'Property' &&
|
|
93
|
+
identifierParent.key.type === 'Identifier' &&
|
|
94
|
+
identifierParent.key.name === 'headers'
|
|
95
|
+
) {
|
|
96
|
+
results.destructuringHeadersVariable = responseVariable;
|
|
97
|
+
results.destructuringHeadersReferences = responseVariable.references
|
|
98
|
+
.map((reference) => reference.identifier)
|
|
99
|
+
.map(getParent)
|
|
100
|
+
.filter(
|
|
101
|
+
(parent): parent is MemberExpression =>
|
|
102
|
+
parent?.type === 'MemberExpression' &&
|
|
103
|
+
parent.property.type === 'Identifier' &&
|
|
104
|
+
parent.property.name !== 'get' &&
|
|
105
|
+
getParent(parent)?.type !== 'CallExpression',
|
|
106
|
+
);
|
|
107
|
+
} else if (identifierParent.type === 'Property') {
|
|
108
|
+
const parent = getParent(identifierParent);
|
|
109
|
+
if (parent?.type === 'ObjectPattern') {
|
|
110
|
+
// body reference through nested destruction, e.g. "const { body: {bodyPropertyName: renamedBodyPropertyName}, headers: {headerPropertyName: renamedHeaderPropertyName} } = ..."
|
|
111
|
+
const parent2 = getParent(parent);
|
|
112
|
+
if (parent2?.type === 'Property' && parent2.key.type === 'Identifier' && parent2.key.name === 'body') {
|
|
113
|
+
results.destructuringBodyVariable = parent;
|
|
114
|
+
}
|
|
115
|
+
if (
|
|
116
|
+
parent2?.type === 'Property' &&
|
|
117
|
+
parent2.key.type === 'Identifier' &&
|
|
118
|
+
(parent2.key.name === 'header' || parent2.key.name === 'headers')
|
|
119
|
+
) {
|
|
120
|
+
results.destructuringHeadersVariable = parent;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
} else {
|
|
124
|
+
log('+++++++ can not handle identifierParent', identifierParent);
|
|
125
|
+
throw new Error(`Unknown response variable reference: ${responseVariable.name}`);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return results;
|
|
129
|
+
}
|
package/src/agent/url.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// agent/url.ts
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
4
|
+
const PLAIN_URL_REGEXP: RegExp = /^[`']\/\w+(?<serviceNamePart>-\w+)*\/v\d+\/(?<any>.|\r|\n)+[`']$/u;
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
6
|
+
const TOKENIZED_URL_REGEXP: RegExp = /^`\$\{(?<serviceNamePart>[A-Z]+_)*BASE_PATH\}\/(?<any>.|\r|\n)+`$/u;
|
|
7
|
+
|
|
8
|
+
export function isServiceApiCallUrl(url: string): boolean {
|
|
9
|
+
return PLAIN_URL_REGEXP.test(url) || TOKENIZED_URL_REGEXP.test(url);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function replaceEndpointUrlPrefixWithBasePath(url: string): string {
|
|
13
|
+
return url.replace(
|
|
14
|
+
/^(?<quotStart>[`'])\/(?<servicename>\w+(?<parts>-\w+)*)(?<path>\/v\d+\/)(?<endpoint>(?<any>.|\r|\n)+)(?<quotEnd>[`'])$/u,
|
|
15
|
+
// eslint-disable-next-line no-template-curly-in-string
|
|
16
|
+
'`${BASE_PATH}/$5`',
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function replaceEndpointUrlPrefixWithDomain(url: string): string {
|
|
21
|
+
return url.replace(
|
|
22
|
+
/^(?<quotStart>[`'])\/(?<servicename>\w+(?<parts>-\w+)*)(?<path>\/v\d+\/(?<any>.|\r|\n)+(?<quotEnd>[`'])$)/u,
|
|
23
|
+
'$1https://$2.checkdigit/$2$4',
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function addBasePathUrlDomain(url: string): string {
|
|
28
|
+
return url.replace(
|
|
29
|
+
/^(?<quotStart>[`'])\/(?<servicename>\w+(?<parts>-\w+)*)(?<path>\/v\d+(?<quotEnd>[`'])$)/u,
|
|
30
|
+
'$1https://$2.checkdigit/$2$4',
|
|
31
|
+
);
|
|
32
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -8,10 +8,30 @@
|
|
|
8
8
|
|
|
9
9
|
import type { TSESLint } from '@typescript-eslint/utils';
|
|
10
10
|
|
|
11
|
+
import addUrlDomain, { ruleId as addUrlDomainRuleId } from './agent/add-url-domain';
|
|
12
|
+
import agentTestWiring, { ruleId as agentTestWiringRuleId } from './agent/agent-test-wiring';
|
|
13
|
+
import fetchResponseBodyJson, { ruleId as fetchResponseBodyJsonRuleId } from './agent/fetch-response-body-json';
|
|
14
|
+
import fetchResponseHeaderGetter, {
|
|
15
|
+
ruleId as fetchResponseHeaderGetterRuleId,
|
|
16
|
+
} from './agent/fetch-response-header-getter';
|
|
17
|
+
import fetchResponseStatus, { ruleId as fetchResponseStatusRuleId } from './agent/fetch-response-status';
|
|
18
|
+
import fetchThen, { ruleId as fetchThenRuleId } from './agent/fetch-then';
|
|
19
|
+
import fixFunctionCallArguments, {
|
|
20
|
+
ruleId as fixFunctionCallArgumentsRuleId,
|
|
21
|
+
} from './agent/fix-function-call-arguments';
|
|
11
22
|
import invalidJsonStringify, { ruleId as invalidJsonStringifyRuleId } from './invalid-json-stringify';
|
|
12
23
|
import noDuplicatedImports, { ruleId as noDuplicatedImportsRuleId } from './no-duplicated-imports';
|
|
24
|
+
import noFixture, { ruleId as noFixtureRuleId } from './agent/no-fixture';
|
|
13
25
|
import noLegacyServiceTyping, { ruleId as noLegacyServiceTypingRuleId } from './no-legacy-service-typing';
|
|
26
|
+
import noMappedResponse, { ruleId as noMappedResponseRuleId } from './agent/no-mapped-response';
|
|
14
27
|
import noPromiseInstanceMethod, { ruleId as noPromiseInstanceMethodRuleId } from './no-promise-instance-method';
|
|
28
|
+
import noServiceWrapper, { ruleId as noServiceWrapperRuleId } from './agent/no-service-wrapper';
|
|
29
|
+
import noStatusCode, { ruleId as noStatusCodeRuleId } from './agent/no-status-code';
|
|
30
|
+
import noUnusedFunctionArguments, {
|
|
31
|
+
ruleId as noUnusedFunctionArgumentsRuleId,
|
|
32
|
+
} from './agent/no-unused-function-argument';
|
|
33
|
+
import noUnusedImports, { ruleId as noUnusedImportsRuleId } from './agent/no-unused-imports';
|
|
34
|
+
import noUnusedServiceVariables, { ruleId as noUnusedServiceVariablesRuleId } from './agent/no-unused-service-variable';
|
|
15
35
|
import requireFixedServicesImport, {
|
|
16
36
|
ruleId as requireFixedServicesImportRuleId,
|
|
17
37
|
} from './require-fixed-services-import';
|
|
@@ -22,6 +42,9 @@ import requireTypeOutOfTypeOnlyImports, {
|
|
|
22
42
|
ruleId as requireTypeOutOfTypeOnlyImportsRuleId,
|
|
23
43
|
} from './require-type-out-of-type-only-imports';
|
|
24
44
|
import noServeRuntime, { ruleId as noServeRuntimeRuleId } from './no-serve-runtime';
|
|
45
|
+
import addBasePathConst, { ruleId as addBasePathConstRuleId } from './agent/add-base-path-const';
|
|
46
|
+
import addBasePathImport, { ruleId as addBasePathImportRuleId } from './agent/add-base-path-import';
|
|
47
|
+
import addAssertImport, { ruleId as addAssertImportRuleId } from './agent/add-assert-import';
|
|
25
48
|
import filePathComment from './file-path-comment';
|
|
26
49
|
import noCardNumbers from './no-card-numbers';
|
|
27
50
|
import noSideEffects from './no-side-effects';
|
|
@@ -48,12 +71,29 @@ const rules: Record<string, TSESLint.LooseRuleDefinition> = {
|
|
|
48
71
|
'object-literal-response': objectLiteralResponse,
|
|
49
72
|
[invalidJsonStringifyRuleId]: invalidJsonStringify,
|
|
50
73
|
[noPromiseInstanceMethodRuleId]: noPromiseInstanceMethod,
|
|
74
|
+
[noFixtureRuleId]: noFixture,
|
|
75
|
+
[fetchThenRuleId]: fetchThen,
|
|
76
|
+
[noServiceWrapperRuleId]: noServiceWrapper,
|
|
77
|
+
[noStatusCodeRuleId]: noStatusCode,
|
|
78
|
+
[fetchResponseBodyJsonRuleId]: fetchResponseBodyJson,
|
|
79
|
+
[fetchResponseHeaderGetterRuleId]: fetchResponseHeaderGetter,
|
|
80
|
+
[fetchResponseStatusRuleId]: fetchResponseStatus,
|
|
81
|
+
[addUrlDomainRuleId]: addUrlDomain,
|
|
51
82
|
[noLegacyServiceTypingRuleId]: noLegacyServiceTyping,
|
|
83
|
+
[noMappedResponseRuleId]: noMappedResponse,
|
|
52
84
|
[requireResolveFullResponseRuleId]: requireResolveFullResponse,
|
|
53
85
|
[noDuplicatedImportsRuleId]: noDuplicatedImports,
|
|
54
86
|
[noServeRuntimeRuleId]: noServeRuntime,
|
|
87
|
+
[addBasePathConstRuleId]: addBasePathConst,
|
|
88
|
+
[addBasePathImportRuleId]: addBasePathImport,
|
|
89
|
+
[addAssertImportRuleId]: addAssertImport,
|
|
55
90
|
[requireFixedServicesImportRuleId]: requireFixedServicesImport,
|
|
56
91
|
[requireTypeOutOfTypeOnlyImportsRuleId]: requireTypeOutOfTypeOnlyImports,
|
|
92
|
+
[noUnusedFunctionArgumentsRuleId]: noUnusedFunctionArguments,
|
|
93
|
+
[noUnusedServiceVariablesRuleId]: noUnusedServiceVariables,
|
|
94
|
+
[noUnusedImportsRuleId]: noUnusedImports,
|
|
95
|
+
[fixFunctionCallArgumentsRuleId]: fixFunctionCallArguments,
|
|
96
|
+
[agentTestWiringRuleId]: agentTestWiring,
|
|
57
97
|
};
|
|
58
98
|
|
|
59
99
|
const plugin: TSESLint.FlatConfig.Plugin = {
|
|
@@ -87,6 +127,25 @@ const configs: Record<string, TSESLint.FlatConfig.Config[]> = {
|
|
|
87
127
|
[`@checkdigit/${requireFixedServicesImportRuleId}`]: 'error',
|
|
88
128
|
[`@checkdigit/${requireTypeOutOfTypeOnlyImportsRuleId}`]: 'error',
|
|
89
129
|
[`@checkdigit/${noServeRuntimeRuleId}`]: 'error',
|
|
130
|
+
// --- agent rules BEGIN ---
|
|
131
|
+
[`@checkdigit/${noMappedResponseRuleId}`]: 'off',
|
|
132
|
+
[`@checkdigit/${addUrlDomainRuleId}`]: 'off',
|
|
133
|
+
[`@checkdigit/${noFixtureRuleId}`]: 'off',
|
|
134
|
+
[`@checkdigit/${noServiceWrapperRuleId}`]: 'off',
|
|
135
|
+
[`@checkdigit/${noStatusCodeRuleId}`]: 'off',
|
|
136
|
+
[`@checkdigit/${fetchResponseBodyJsonRuleId}`]: 'off',
|
|
137
|
+
[`@checkdigit/${fetchResponseHeaderGetterRuleId}`]: 'off',
|
|
138
|
+
[`@checkdigit/${fetchResponseStatusRuleId}`]: 'off',
|
|
139
|
+
[`@checkdigit/${fetchThenRuleId}`]: 'off',
|
|
140
|
+
[`@checkdigit/${noUnusedFunctionArgumentsRuleId}`]: 'off',
|
|
141
|
+
[`@checkdigit/${noUnusedServiceVariablesRuleId}`]: 'off',
|
|
142
|
+
[`@checkdigit/${noUnusedImportsRuleId}`]: 'off',
|
|
143
|
+
[`@checkdigit/${fixFunctionCallArgumentsRuleId}`]: 'off',
|
|
144
|
+
[`@checkdigit/${agentTestWiringRuleId}`]: 'off',
|
|
145
|
+
[`@checkdigit/${addBasePathConstRuleId}`]: 'off',
|
|
146
|
+
[`@checkdigit/${addBasePathImportRuleId}`]: 'off',
|
|
147
|
+
[`@checkdigit/${addAssertImportRuleId}`]: 'off',
|
|
148
|
+
// --- agent rules END ---
|
|
90
149
|
},
|
|
91
150
|
},
|
|
92
151
|
],
|
|
@@ -116,6 +175,89 @@ const configs: Record<string, TSESLint.FlatConfig.Config[]> = {
|
|
|
116
175
|
[`@checkdigit/${requireFixedServicesImportRuleId}`]: 'off',
|
|
117
176
|
[`@checkdigit/${requireTypeOutOfTypeOnlyImportsRuleId}`]: 'error',
|
|
118
177
|
[`@checkdigit/${noServeRuntimeRuleId}`]: 'off',
|
|
178
|
+
// --- agent rules BEGIN ---
|
|
179
|
+
[`@checkdigit/${noMappedResponseRuleId}`]: 'off',
|
|
180
|
+
[`@checkdigit/${addUrlDomainRuleId}`]: 'off',
|
|
181
|
+
[`@checkdigit/${noFixtureRuleId}`]: 'off',
|
|
182
|
+
[`@checkdigit/${noServiceWrapperRuleId}`]: 'off',
|
|
183
|
+
[`@checkdigit/${noStatusCodeRuleId}`]: 'off',
|
|
184
|
+
[`@checkdigit/${fetchResponseBodyJsonRuleId}`]: 'off',
|
|
185
|
+
[`@checkdigit/${fetchResponseHeaderGetterRuleId}`]: 'off',
|
|
186
|
+
[`@checkdigit/${fetchResponseStatusRuleId}`]: 'off',
|
|
187
|
+
[`@checkdigit/${fetchThenRuleId}`]: 'off',
|
|
188
|
+
[`@checkdigit/${noUnusedFunctionArgumentsRuleId}`]: 'off',
|
|
189
|
+
[`@checkdigit/${noUnusedServiceVariablesRuleId}`]: 'off',
|
|
190
|
+
[`@checkdigit/${noUnusedImportsRuleId}`]: 'off',
|
|
191
|
+
[`@checkdigit/${fixFunctionCallArgumentsRuleId}`]: 'off',
|
|
192
|
+
[`@checkdigit/${agentTestWiringRuleId}`]: 'off',
|
|
193
|
+
[`@checkdigit/${addBasePathConstRuleId}`]: 'off',
|
|
194
|
+
[`@checkdigit/${addBasePathImportRuleId}`]: 'off',
|
|
195
|
+
[`@checkdigit/${addAssertImportRuleId}`]: 'off',
|
|
196
|
+
// --- agent rules END ---
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
],
|
|
200
|
+
'agent-phase-1-test': [
|
|
201
|
+
{
|
|
202
|
+
files: ['**/*.spec.ts', '**/*.test.ts', 'src/api/v*/index.ts'],
|
|
203
|
+
// eslint-disable-next-line sonarjs/no-duplicate-string
|
|
204
|
+
ignores: ['src/plugin/**'],
|
|
205
|
+
plugins: {
|
|
206
|
+
'@checkdigit': plugin,
|
|
207
|
+
},
|
|
208
|
+
rules: {
|
|
209
|
+
[`@checkdigit/${noMappedResponseRuleId}`]: 'error',
|
|
210
|
+
[`@checkdigit/${addUrlDomainRuleId}`]: 'error',
|
|
211
|
+
[`@checkdigit/${noServiceWrapperRuleId}`]: 'error',
|
|
212
|
+
[`@checkdigit/${noStatusCodeRuleId}`]: 'error',
|
|
213
|
+
[`@checkdigit/${fetchResponseBodyJsonRuleId}`]: 'error',
|
|
214
|
+
[`@checkdigit/${fetchResponseHeaderGetterRuleId}`]: 'error',
|
|
215
|
+
[`@checkdigit/${fetchResponseStatusRuleId}`]: 'error',
|
|
216
|
+
[`@checkdigit/${fetchThenRuleId}`]: 'error',
|
|
217
|
+
[`@checkdigit/${noUnusedFunctionArgumentsRuleId}`]: 'error',
|
|
218
|
+
[`@checkdigit/${noUnusedServiceVariablesRuleId}`]: 'error',
|
|
219
|
+
[`@checkdigit/${noUnusedImportsRuleId}`]: 'error',
|
|
220
|
+
[`@checkdigit/${fixFunctionCallArgumentsRuleId}`]: 'error',
|
|
221
|
+
[`@checkdigit/${addBasePathConstRuleId}`]: 'error',
|
|
222
|
+
[`@checkdigit/${addBasePathImportRuleId}`]: 'error',
|
|
223
|
+
[`@checkdigit/${addAssertImportRuleId}`]: 'error',
|
|
224
|
+
[`@checkdigit/${noFixtureRuleId}`]: 'error',
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
files: ['**/*.spec.ts'],
|
|
229
|
+
ignores: ['src/plugin/**'],
|
|
230
|
+
plugins: {
|
|
231
|
+
'@checkdigit': plugin,
|
|
232
|
+
},
|
|
233
|
+
rules: {
|
|
234
|
+
[`@checkdigit/${agentTestWiringRuleId}`]: 'error',
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
],
|
|
238
|
+
'agent-phase-2-production': [
|
|
239
|
+
{
|
|
240
|
+
files: ['**/*.ts'],
|
|
241
|
+
ignores: ['src/plugin/**'],
|
|
242
|
+
plugins: {
|
|
243
|
+
'@checkdigit': plugin,
|
|
244
|
+
},
|
|
245
|
+
rules: {
|
|
246
|
+
[`@checkdigit/${noMappedResponseRuleId}`]: 'error',
|
|
247
|
+
[`@checkdigit/${addUrlDomainRuleId}`]: 'error',
|
|
248
|
+
[`@checkdigit/${noServiceWrapperRuleId}`]: 'error',
|
|
249
|
+
[`@checkdigit/${noStatusCodeRuleId}`]: 'error',
|
|
250
|
+
[`@checkdigit/${fetchResponseBodyJsonRuleId}`]: 'error',
|
|
251
|
+
[`@checkdigit/${fetchResponseHeaderGetterRuleId}`]: 'error',
|
|
252
|
+
[`@checkdigit/${fetchResponseStatusRuleId}`]: 'error',
|
|
253
|
+
[`@checkdigit/${fetchThenRuleId}`]: 'error',
|
|
254
|
+
[`@checkdigit/${noUnusedFunctionArgumentsRuleId}`]: 'error',
|
|
255
|
+
[`@checkdigit/${noUnusedServiceVariablesRuleId}`]: 'error',
|
|
256
|
+
[`@checkdigit/${noUnusedImportsRuleId}`]: 'error',
|
|
257
|
+
[`@checkdigit/${fixFunctionCallArgumentsRuleId}`]: 'error',
|
|
258
|
+
[`@checkdigit/${addBasePathConstRuleId}`]: 'error',
|
|
259
|
+
[`@checkdigit/${addBasePathImportRuleId}`]: 'error',
|
|
260
|
+
[`@checkdigit/${addAssertImportRuleId}`]: 'error',
|
|
119
261
|
},
|
|
120
262
|
},
|
|
121
263
|
],
|