@enormora/eslint-config-typescript 0.0.43 → 0.0.45
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/package.json +13 -4
- package/plugins/enormora-typescript/enormora-typescript-plugin.js +9 -0
- package/plugins/enormora-typescript/enormora-typescript-plugin.js.map +1 -0
- package/plugins/enormora-typescript/no-impure-satisfies.js +99 -0
- package/plugins/enormora-typescript/no-impure-satisfies.js.map +1 -0
- package/plugins/enormora-typescript/prefer-named-callable-types.js +152 -0
- package/plugins/enormora-typescript/prefer-named-callable-types.js.map +1 -0
- package/presets/typescript/typescript-environment.js +47 -0
- package/presets/typescript/typescript-environment.js.map +1 -0
- package/presets/typescript/typescript.js +80 -139
- package/presets/typescript/typescript.js.map +1 -0
- package/readme.md +7 -0
- package/sbom.cdx.json +72 -21
package/package.json
CHANGED
|
@@ -7,8 +7,10 @@
|
|
|
7
7
|
}
|
|
8
8
|
],
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
11
|
-
"@typescript-eslint/parser": "8.
|
|
10
|
+
"@typescript-eslint/eslint-plugin": "8.61.0",
|
|
11
|
+
"@typescript-eslint/parser": "8.61.0",
|
|
12
|
+
"@typescript-eslint/type-utils": "8.61.0",
|
|
13
|
+
"@typescript-eslint/utils": "8.61.0",
|
|
12
14
|
"eslint-import-resolver-typescript": "4.4.5",
|
|
13
15
|
"eslint-plugin-functional": "10.0.0",
|
|
14
16
|
"eslint-plugin-import-x": "4.16.2",
|
|
@@ -23,12 +25,19 @@
|
|
|
23
25
|
"license": "MIT",
|
|
24
26
|
"name": "@enormora/eslint-config-typescript",
|
|
25
27
|
"peerDependencies": {
|
|
26
|
-
"@enormora/eslint-config-base": "0.0.
|
|
28
|
+
"@enormora/eslint-config-base": "0.0.39",
|
|
29
|
+
"typescript": ">=4.8.4 <6.1.0"
|
|
27
30
|
},
|
|
28
31
|
"repository": {
|
|
29
32
|
"type": "git",
|
|
30
33
|
"url": "git://github.com/enormora/eslint-config.git"
|
|
31
34
|
},
|
|
35
|
+
"sideEffects": [
|
|
36
|
+
"./plugins/enormora-typescript/no-impure-satisfies.js",
|
|
37
|
+
"./plugins/enormora-typescript/prefer-named-callable-types.js",
|
|
38
|
+
"./presets/typescript/typescript-environment.js",
|
|
39
|
+
"./presets/typescript/typescript.js"
|
|
40
|
+
],
|
|
32
41
|
"type": "module",
|
|
33
|
-
"version": "0.0.
|
|
42
|
+
"version": "0.0.45"
|
|
34
43
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { noImpureSatisfiesRule } from "./no-impure-satisfies.js";
|
|
2
|
+
import { preferNamedCallableTypesRule } from "./prefer-named-callable-types.js";
|
|
3
|
+
export const enormoraTypescriptPlugin = {
|
|
4
|
+
rules: {
|
|
5
|
+
'no-impure-satisfies': noImpureSatisfiesRule,
|
|
6
|
+
'prefer-named-callable-types': preferNamedCallableTypesRule
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=enormora-typescript-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enormora-typescript-plugin.js","sourceRoot":"","sources":["../../../../../configs/plugins/enormora-typescript/enormora-typescript-plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAAC;AAMhF,MAAM,CAAC,MAAM,wBAAwB,GAA6B;IAC9D,KAAK,EAAE;QACH,qBAAqB,EAAE,qBAAmD;QAC1E,6BAA6B,EAAE,4BAA0D;KAC5F;CACJ,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { isTypeFlagSet } from '@typescript-eslint/type-utils';
|
|
2
|
+
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
3
|
+
import ts, {} from 'typescript';
|
|
4
|
+
function ruleUrl(ruleName) {
|
|
5
|
+
return `https://github.com/enormora/eslint-config/blob/main/configs/plugins/enormora-typescript/${ruleName}.ts`;
|
|
6
|
+
}
|
|
7
|
+
const { RuleCreator: ruleCreator } = ESLintUtils;
|
|
8
|
+
const buildRule = ruleCreator(ruleUrl);
|
|
9
|
+
function collectArrayOrTupleArguments(checker, type) {
|
|
10
|
+
if (checker.isArrayType(type) || checker.isTupleType(type)) {
|
|
11
|
+
return checker.getTypeArguments(type);
|
|
12
|
+
}
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
function collectPropertyTypes(checker, type) {
|
|
16
|
+
return checker.getPropertiesOfType(type).map(function getSymbolType(property) {
|
|
17
|
+
return checker.getTypeOfSymbol(property);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
function collectCallReturnTypes(checker, type) {
|
|
21
|
+
return checker.getSignaturesOfType(type, ts.SignatureKind.Call).map(function getReturnType(signature) {
|
|
22
|
+
return checker.getReturnTypeOfSignature(signature);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function collectIndexTypes(checker, type) {
|
|
26
|
+
const result = [];
|
|
27
|
+
const numberIndex = checker.getIndexInfoOfType(type, ts.IndexKind.Number);
|
|
28
|
+
if (numberIndex !== undefined) {
|
|
29
|
+
result.push(numberIndex.type);
|
|
30
|
+
}
|
|
31
|
+
const stringIndex = checker.getIndexInfoOfType(type, ts.IndexKind.String);
|
|
32
|
+
if (stringIndex !== undefined) {
|
|
33
|
+
result.push(stringIndex.type);
|
|
34
|
+
}
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
function collectObjectTypeChildren(checker, type) {
|
|
38
|
+
return [
|
|
39
|
+
...collectArrayOrTupleArguments(checker, type),
|
|
40
|
+
...collectPropertyTypes(checker, type),
|
|
41
|
+
...collectCallReturnTypes(checker, type),
|
|
42
|
+
...collectIndexTypes(checker, type)
|
|
43
|
+
];
|
|
44
|
+
}
|
|
45
|
+
function childrenOf(checker, type) {
|
|
46
|
+
if (type.isUnionOrIntersection()) {
|
|
47
|
+
return type.types;
|
|
48
|
+
}
|
|
49
|
+
if (!isTypeFlagSet(type, ts.TypeFlags.Object)) {
|
|
50
|
+
return [];
|
|
51
|
+
}
|
|
52
|
+
return collectObjectTypeChildren(checker, type);
|
|
53
|
+
}
|
|
54
|
+
function containsLiteralComponent(checker, rootType, visited) {
|
|
55
|
+
const queue = [rootType];
|
|
56
|
+
while (queue.length > 0) {
|
|
57
|
+
const current = queue.shift();
|
|
58
|
+
if (!visited.has(current)) {
|
|
59
|
+
visited.add(current);
|
|
60
|
+
if (current.isLiteral()) {
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
queue.push(...childrenOf(checker, current));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
const description = 'Disallow `satisfies` expressions that aren’t pure type checks: literal constraints or no-op.';
|
|
69
|
+
const typeChangingMessage = 'This `satisfies` narrows the inferred type via literal constraints. Remove it or use `as const`.';
|
|
70
|
+
const trivialMessage = 'This `satisfies` is purely structural and adds no narrowing. Remove it or use a type annotation.';
|
|
71
|
+
export const noImpureSatisfiesRule = buildRule({
|
|
72
|
+
name: 'no-impure-satisfies',
|
|
73
|
+
meta: {
|
|
74
|
+
type: 'problem',
|
|
75
|
+
docs: { description },
|
|
76
|
+
messages: {
|
|
77
|
+
typeChangingSatisfies: typeChangingMessage,
|
|
78
|
+
trivialSatisfies: trivialMessage
|
|
79
|
+
},
|
|
80
|
+
schema: []
|
|
81
|
+
},
|
|
82
|
+
defaultOptions: [],
|
|
83
|
+
create(context) {
|
|
84
|
+
const services = ESLintUtils.getParserServices(context);
|
|
85
|
+
const checker = services.program.getTypeChecker();
|
|
86
|
+
return {
|
|
87
|
+
TSSatisfiesExpression(node) {
|
|
88
|
+
const satisfiesTypeNode = services.esTreeNodeToTSNodeMap.get(node.typeAnnotation);
|
|
89
|
+
const satisfiesType = checker.getTypeFromTypeNode(satisfiesTypeNode);
|
|
90
|
+
const containsLiteral = containsLiteralComponent(checker, satisfiesType, new WeakSet());
|
|
91
|
+
context.report({
|
|
92
|
+
node,
|
|
93
|
+
messageId: containsLiteral ? 'typeChangingSatisfies' : 'trivialSatisfies'
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
//# sourceMappingURL=no-impure-satisfies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-impure-satisfies.js","sourceRoot":"","sources":["../../../../../configs/plugins/enormora-typescript/no-impure-satisfies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAiB,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,EAAE,EAAkE,MAAM,YAAY,CAAC;AAEhG,SAAS,OAAO,CAAC,QAAgB;IAC7B,OAAO,2FAA2F,QAAQ,KAAK,CAAC;AACpH,CAAC;AAED,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,WAAW,CAAC;AACjD,MAAM,SAAS,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;AAEvC,SAAS,4BAA4B,CAAC,OAAoB,EAAE,IAAU;IAClE,IAAI,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;QACzD,OAAO,OAAO,CAAC,gBAAgB,CAAC,IAAqB,CAAC,CAAC;IAC3D,CAAC;IACD,OAAO,EAAE,CAAC;AACd,CAAC;AAED,SAAS,oBAAoB,CAAC,OAAoB,EAAE,IAAU;IAC1D,OAAO,OAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,SAAS,aAAa,CAAC,QAAQ;QACxE,OAAO,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;AACP,CAAC;AAED,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AiB,CAAC,OAAO,CAAC,CAAC;QACxD,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC;QAElD,OAAO;YACH,qBAAqB,CAAC,IAAoC;gBACtD,MAAM,iBAAiB,GAAG,QAAQ,CAAC,qBAAqB,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,CAAa,CAAC;gBAC9F,MAAM,aAAa,GAAG,OAAO,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,CAAC;gBACrE,MAAM,eAAe,GAAG,wBAAwB,CAAC,OAAO,EAAE,aAAa,EAAE,IAAI,OAAO,EAAE,CAAC,CAAC;gBAExF,OAAO,CAAC,MAAM,CAAC;oBACX,IAAI;oBACJ,SAAS,EAAE,eAAe,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,kBAAkB;iBAC5E,CAAC,CAAC;YACP,CAAC;SACJ,CAAC;IACN,CAAC;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { AST_NODE_TYPES, ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
+
import ts, {} from 'typescript';
|
|
3
|
+
function ruleUrl(ruleName) {
|
|
4
|
+
return `https://github.com/enormora/eslint-config/blob/main/configs/plugins/enormora-typescript/${ruleName}.ts`;
|
|
5
|
+
}
|
|
6
|
+
const { RuleCreator: ruleCreator } = ESLintUtils;
|
|
7
|
+
const buildRule = ruleCreator(ruleUrl);
|
|
8
|
+
const callableUtilities = new Set([
|
|
9
|
+
'ConstructorParameters',
|
|
10
|
+
'InstanceType',
|
|
11
|
+
'Parameters',
|
|
12
|
+
'ReturnType',
|
|
13
|
+
'ThisParameterType'
|
|
14
|
+
]);
|
|
15
|
+
function isCallableUtility(name) {
|
|
16
|
+
return callableUtilities.has(name);
|
|
17
|
+
}
|
|
18
|
+
function getUtilityName(typeReference) {
|
|
19
|
+
const { typeName } = typeReference;
|
|
20
|
+
if (typeName.type !== AST_NODE_TYPES.Identifier) {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
if (!isCallableUtility(typeName.name)) {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
return typeName.name;
|
|
27
|
+
}
|
|
28
|
+
function getCallSignatureTypes(checker, type, kind) {
|
|
29
|
+
return checker.getSignaturesOfType(type, kind);
|
|
30
|
+
}
|
|
31
|
+
function collectParameterTypes(checker, signatures) {
|
|
32
|
+
return signatures.flatMap(function getParameterTypes(signature) {
|
|
33
|
+
return signature.getParameters().map(function symbolType(parameter) {
|
|
34
|
+
return checker.getTypeOfSymbol(parameter);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function collectReturnTypes(checker, signatures) {
|
|
39
|
+
return signatures.map(function returnType(signature) {
|
|
40
|
+
return checker.getReturnTypeOfSignature(signature);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function collectThisParameterTypes(checker, signatures) {
|
|
44
|
+
return signatures
|
|
45
|
+
.map(function pickThisParameter(signature) {
|
|
46
|
+
return signature.thisParameter;
|
|
47
|
+
})
|
|
48
|
+
.filter(function keepDefined(parameter) {
|
|
49
|
+
return parameter !== undefined;
|
|
50
|
+
})
|
|
51
|
+
.map(function symbolType(parameter) {
|
|
52
|
+
return checker.getTypeOfSymbol(parameter);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function candidatesForUtility(checker, utility, exprType) {
|
|
56
|
+
if (utility === 'ReturnType') {
|
|
57
|
+
return collectReturnTypes(checker, getCallSignatureTypes(checker, exprType, ts.SignatureKind.Call));
|
|
58
|
+
}
|
|
59
|
+
if (utility === 'Parameters') {
|
|
60
|
+
return collectParameterTypes(checker, getCallSignatureTypes(checker, exprType, ts.SignatureKind.Call));
|
|
61
|
+
}
|
|
62
|
+
if (utility === 'ConstructorParameters') {
|
|
63
|
+
return collectParameterTypes(checker, getCallSignatureTypes(checker, exprType, ts.SignatureKind.Construct));
|
|
64
|
+
}
|
|
65
|
+
if (utility === 'InstanceType') {
|
|
66
|
+
return collectReturnTypes(checker, getCallSignatureTypes(checker, exprType, ts.SignatureKind.Construct));
|
|
67
|
+
}
|
|
68
|
+
return collectThisParameterTypes(checker, getCallSignatureTypes(checker, exprType, ts.SignatureKind.Call));
|
|
69
|
+
}
|
|
70
|
+
function isExternalSourceFile(fileName) {
|
|
71
|
+
return fileName.includes('/node_modules/');
|
|
72
|
+
}
|
|
73
|
+
function findLocalAlias(type) {
|
|
74
|
+
const { aliasSymbol } = type;
|
|
75
|
+
if (aliasSymbol === undefined) {
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
const fileName = aliasSymbol.declarations?.[0]?.getSourceFile().fileName;
|
|
79
|
+
if (fileName === undefined || isExternalSourceFile(fileName)) {
|
|
80
|
+
return undefined;
|
|
81
|
+
}
|
|
82
|
+
return { alias: aliasSymbol, fileName };
|
|
83
|
+
}
|
|
84
|
+
function findFirstLocalAlias(candidates) {
|
|
85
|
+
for (const candidate of candidates) {
|
|
86
|
+
const found = findLocalAlias(candidate);
|
|
87
|
+
if (found !== undefined) {
|
|
88
|
+
return found;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return undefined;
|
|
92
|
+
}
|
|
93
|
+
function getEnclosingUtilityTypeReference(typeQuery) {
|
|
94
|
+
const instantiation = typeQuery.parent;
|
|
95
|
+
if (instantiation.type !== AST_NODE_TYPES.TSTypeParameterInstantiation) {
|
|
96
|
+
return undefined;
|
|
97
|
+
}
|
|
98
|
+
const reference = instantiation.parent;
|
|
99
|
+
if (reference.type !== AST_NODE_TYPES.TSTypeReference) {
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
102
|
+
if (reference.typeArguments !== instantiation) {
|
|
103
|
+
return undefined;
|
|
104
|
+
}
|
|
105
|
+
return reference;
|
|
106
|
+
}
|
|
107
|
+
function findReportableTypeQuery(services, checker, node) {
|
|
108
|
+
const reference = getEnclosingUtilityTypeReference(node);
|
|
109
|
+
const utilityName = reference === undefined ? undefined : getUtilityName(reference);
|
|
110
|
+
if (reference === undefined || utilityName === undefined) {
|
|
111
|
+
return undefined;
|
|
112
|
+
}
|
|
113
|
+
const candidates = candidatesForUtility(checker, utilityName, services.getTypeAtLocation(node));
|
|
114
|
+
const local = findFirstLocalAlias(candidates);
|
|
115
|
+
return local === undefined
|
|
116
|
+
? undefined
|
|
117
|
+
: { reference, utilityName, aliasName: local.alias.name };
|
|
118
|
+
}
|
|
119
|
+
const description = 'Disallow reconstructing a callable’s related type via `typeof` through a callable utility ' +
|
|
120
|
+
'(`ReturnType`, `Parameters`, `ConstructorParameters`, `InstanceType`, `ThisParameterType`) ' +
|
|
121
|
+
'when the resulting type already has a named alias defined in the local sources.';
|
|
122
|
+
const preferNamedAliasMessage = 'Use the named type alias `{{aliasName}}` instead of reconstructing it from `typeof` through `{{utilityName}}`.';
|
|
123
|
+
export const preferNamedCallableTypesRule = buildRule({
|
|
124
|
+
name: 'prefer-named-callable-types',
|
|
125
|
+
meta: {
|
|
126
|
+
type: 'problem',
|
|
127
|
+
docs: { description },
|
|
128
|
+
messages: {
|
|
129
|
+
preferNamedAlias: preferNamedAliasMessage
|
|
130
|
+
},
|
|
131
|
+
schema: []
|
|
132
|
+
},
|
|
133
|
+
defaultOptions: [],
|
|
134
|
+
create(context) {
|
|
135
|
+
const services = ESLintUtils.getParserServices(context);
|
|
136
|
+
const checker = services.program.getTypeChecker();
|
|
137
|
+
return {
|
|
138
|
+
TSTypeQuery(node) {
|
|
139
|
+
const finding = findReportableTypeQuery(services, checker, node);
|
|
140
|
+
if (finding === undefined) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
context.report({
|
|
144
|
+
node: finding.reference,
|
|
145
|
+
messageId: 'preferNamedAlias',
|
|
146
|
+
data: { aliasName: finding.aliasName, utilityName: finding.utilityName }
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
//# sourceMappingURL=prefer-named-callable-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prefer-named-callable-types.js","sourceRoot":"","sources":["../../../../../configs/plugins/enormora-typescript/prefer-named-callable-types.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,cAAc,EACd,WAAW,EAGd,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,EAAE,EAAwE,MAAM,YAAY,CAAC;AAEtG,SAAS,OAAO,CAAC,QAAgB;IAC7B,OAAO,2FAA2F,QAAQ,KAAK,CAAC;AACpH,CAAC;AAED,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,WAAW,CAAC;AACjD,MAAM,SAAS,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;AAIvC,MAAM,iBAAiB,GAAiC,IAAI,GAAG,CAAC;IAC5D,uBAAuB;IACvB,cAAc;IACd,YAAY;IACZ,YAAY;IACZ,mBAAmB;CACtB,CAAC,CAAC;AAEH,SAAS,iBAAiB,CAAC,IAAY;IACnC,OAAQ,iBAAyC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAChE,CAAC;AAED,SAAS,cAAc,CAAC,aAAuC;IAC3D,MAAM,EAAE,QAAQ,EAAE,GAAG,aAAa,CAAC;IACnC,IAAI,QAAQ,CAAC,IAAI,KAAK,cAAc,CAAC,UAAU,EAAE,CAAC;QAC9C,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACpC,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,OAAO,QAAQ,CAAC,IAAI,CAAC;AACzB,CAAC;AAED,SAAS,qBAAqB,CAC1B,OAAoB,EACpB,IAAU,EACV,IAAsB;IAEtB,OAAO,OAAO,CAAC,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACnD,CAAC;AAED,SAAS,qBAAqB,CAC1B,OAAoB,EACpB,UAAgC;IA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AAI,EAAE,CAAC;AAClE,CAAC;AAED,MAAM,WAAW,GAAG,4FAA4F;IAC5G,6FAA6F;IAC7F,iFAAiF,CAAC;AAEtF,MAAM,uBAAuB,GACzB,gHAAgH,CAAC;AAErH,MAAM,CAAC,MAAM,4BAA4B,GAAG,SAAS,CAAC;IAClD,IAAI,EAAE,6BAA6B;IACnC,IAAI,EAAE;QACF,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,EAAE,WAAW,EAAE;QACrB,QAAQ,EAAE;YACN,gBAAgB,EAAE,uBAAuB;SAC5C;QACD,MAAM,EAAE,EAAE;KACb;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,CAAC,OAAO;QACV,MAAM,QAAQ,GAAG,WAAW,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QACxD,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC;QAElD,OAAO;YACH,WAAW,CAAC,IAA0B;gBAClC,MAAM,OAAO,GAAG,uBAAuB,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;gBACjE,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;oBACxB,OAAO;gBACX,CAAC;gBACD,OAAO,CAAC,MAAM,CAAC;oBACX,IAAI,EAAE,OAAO,CAAC,SAAS;oBACvB,SAAS,EAAE,kBAAkB;oBAC7B,IAAI,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE;iBAC3E,CAAC,CAAC;YACP,CAAC;SACJ,CAAC;IACN,CAAC;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import typescriptParser from '@typescript-eslint/parser';
|
|
2
|
+
import { createTypeScriptImportResolver } from 'eslint-import-resolver-typescript';
|
|
3
|
+
import { createNodeResolver } from 'eslint-plugin-import-x';
|
|
4
|
+
import { javascriptExtensions, typescriptExtensions } from "@enormora/eslint-config-base/constants.js";
|
|
5
|
+
export const typescriptLanguageOptions = {
|
|
6
|
+
parser: typescriptParser,
|
|
7
|
+
parserOptions: {
|
|
8
|
+
warnOnUnsupportedTypeScriptVersion: false,
|
|
9
|
+
sourceType: 'module',
|
|
10
|
+
ecmaFeatures: {
|
|
11
|
+
jsx: false,
|
|
12
|
+
globalReturn: false
|
|
13
|
+
},
|
|
14
|
+
projectService: true
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
export const typescriptSettings = {
|
|
18
|
+
'import/parsers': {
|
|
19
|
+
'@typescript-eslint/parser': typescriptExtensions
|
|
20
|
+
},
|
|
21
|
+
'import-x/resolver-next': [
|
|
22
|
+
createNodeResolver({
|
|
23
|
+
extensions: [...javascriptExtensions, ...typescriptExtensions]
|
|
24
|
+
}),
|
|
25
|
+
createTypeScriptImportResolver()
|
|
26
|
+
],
|
|
27
|
+
// The upstream defaults in `is-immutable-type` classify Date, URL,
|
|
28
|
+
// and URLSearchParams as Mutable, which poisons any union, record,
|
|
29
|
+
// or recursive value type that mentions them. We promote them — and
|
|
30
|
+
// a few more value-like built-ins — to ReadonlyShallow so consumers
|
|
31
|
+
// can use them without a Readonly<T> wrapper. Map and Set stay
|
|
32
|
+
// Mutable (via the upstream defaults) so the autofixer keeps
|
|
33
|
+
// rewriting them to ReadonlyMap/ReadonlySet.
|
|
34
|
+
immutability: {
|
|
35
|
+
overrides: [
|
|
36
|
+
{ type: { from: 'lib', name: 'Date' }, to: 'ReadonlyShallow' },
|
|
37
|
+
{ type: { from: 'lib', name: 'RegExp' }, to: 'ReadonlyShallow' },
|
|
38
|
+
{ type: { from: 'lib', name: 'URL' }, to: 'ReadonlyShallow' },
|
|
39
|
+
{ type: { from: 'lib', name: 'URLSearchParams' }, to: 'ReadonlyShallow' },
|
|
40
|
+
{ type: { from: 'lib', name: 'WeakMap' }, to: 'ReadonlyShallow' },
|
|
41
|
+
{ type: { from: 'lib', name: 'WeakSet' }, to: 'ReadonlyShallow' },
|
|
42
|
+
{ type: { from: 'lib', name: 'Promise' }, to: 'ReadonlyShallow' },
|
|
43
|
+
{ type: { from: 'lib', name: 'Error' }, to: 'ReadonlyShallow' }
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=typescript-environment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescript-environment.js","sourceRoot":"","sources":["../../../../../configs/presets/typescript/typescript-environment.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,8BAA8B,EAAE,MAAM,mCAAmC,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAEhF,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACrC,MAAM,EAAE,gBAAgB;IACxB,aAAa,EAAE;QACX,kCAAkC,EAAE,KAAK;QACzC,UAAU,EAAE,QAAQ;QACpB,YAAY,EAAE;YACV,GAAG,EAAE,KAAK;YACV,YAAY,EAAE,KAAK;SACtB;QACD,cAAc,EAAE,IAAI;KACvB;CACJ,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAC9B,gBAAgB,EAAE;QACd,2BAA2B,EAAE,oBAAoB;KACpD;IACD,wBAAwB,EAAE;QACtB,kBAAkB,CAAC;YACf,UAAU,EAAE,CAAE,GAAG,oBAAoB,EAAE,GAAG,oBAAoB,CAAE;SACnE,CAAC;QACF,8BAA8B,EAAE;KACnC;IACD,mEAAmE;IACnE,mEAAmE;IACnE,oEAAoE;IACpE,oEAAoE;IACpE,+DAA+D;IAC/D,6DAA6D;IAC7D,6CAA6C;IAC7C,YAAY,EAAE;QACV,SAAS,EAAE;YACP,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,iBAAiB,EAAE;YAC9D,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,iBAAiB,EAAE;YAChE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,iBAAiB,EAAE;YAC7D,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,iBAAiB,EAAE,EAAE,EAAE,EAAE,iBAAiB,EAAE;YACzE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,iBAAiB,EAAE;YACjE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,iBAAiB,EAAE;YACjE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,iBAAiB,EAAE;YACjE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,iBAAiB,EAAE;SAClE;KACJ;CACJ,CAAC"}
|
|
@@ -1,25 +1,20 @@
|
|
|
1
1
|
import typescriptPlugin from '@typescript-eslint/eslint-plugin';
|
|
2
|
-
import typescriptParser from '@typescript-eslint/parser';
|
|
3
|
-
import { createTypeScriptImportResolver } from 'eslint-import-resolver-typescript';
|
|
4
2
|
import functionalPlugin from 'eslint-plugin-functional';
|
|
5
|
-
import { createNodeResolver } from 'eslint-plugin-import-x';
|
|
6
3
|
import perfectionistPlugin from 'eslint-plugin-perfectionist';
|
|
7
|
-
import {
|
|
8
|
-
import { createRestrictedSyntaxPlugin } from
|
|
9
|
-
import { baseSharedConfig } from
|
|
10
|
-
|
|
4
|
+
import { enormoraTypescriptPlugin } from "../../plugins/enormora-typescript/enormora-typescript-plugin.js";
|
|
5
|
+
import { createRestrictedSyntaxPlugin } from "@enormora/eslint-config-base/rule-sets/restricted-syntax.js";
|
|
6
|
+
import { baseSharedConfig } from "@enormora/eslint-config-base/presets/base/base-shared.js";
|
|
7
|
+
import { typescriptLanguageOptions, typescriptSettings } from "./typescript-environment.js";
|
|
11
8
|
export const noTsEnumDeclarationRestriction = {
|
|
12
9
|
selector: 'TSEnumDeclaration',
|
|
13
10
|
message: 'Use a string union type instead'
|
|
14
11
|
};
|
|
15
|
-
|
|
16
|
-
const namedReferenceTypePrefix = String.raw`(?:(?:keyof)?typeof)?`;
|
|
12
|
+
const namedReferenceTypePrefix = String.raw `(?:(?:keyof)?typeof)?`;
|
|
17
13
|
const mutableContainerLookahead = String
|
|
18
|
-
.raw`(?!(?:Array|ReadonlyArray|Map|ReadonlyMap|Set|ReadonlySet|Record|Readonly)\b)`;
|
|
19
|
-
const namedReferenceBody = String.raw`[A-Z][\w$]*(?:\.[A-Z][\w$]*)*(?:<.*>)?`;
|
|
14
|
+
.raw `(?!(?:Array|ReadonlyArray|Map|ReadonlyMap|Set|ReadonlySet|Record|Readonly)\b)`;
|
|
15
|
+
const namedReferenceBody = String.raw `[A-Z][\w$]*(?:\.[A-Z][\w$]*)*(?:<.*>)?`;
|
|
20
16
|
const namedReferenceAtom = `${namedReferenceTypePrefix}${mutableContainerLookahead}${namedReferenceBody}`;
|
|
21
|
-
const namedReferenceIgnorePattern = String.raw`^${namedReferenceAtom}(?:[|&]${namedReferenceAtom})*$`;
|
|
22
|
-
|
|
17
|
+
const namedReferenceIgnorePattern = String.raw `^${namedReferenceAtom}(?:[|&]${namedReferenceAtom})*$`;
|
|
23
18
|
const functionLikeNodes = [
|
|
24
19
|
'FunctionDeclaration',
|
|
25
20
|
'FunctionExpression',
|
|
@@ -30,19 +25,15 @@ const functionLikeNodes = [
|
|
|
30
25
|
'TSConstructorType'
|
|
31
26
|
]
|
|
32
27
|
.join(', ');
|
|
33
|
-
|
|
34
28
|
const noInlineSignatureTypeLiteralSelector = [
|
|
35
29
|
`:matches(${functionLikeNodes}) > .params TSTypeAnnotation > TSTypeLiteral`,
|
|
36
30
|
`:matches(${functionLikeNodes}) > TSTypeAnnotation.returnType > TSTypeLiteral`
|
|
37
31
|
]
|
|
38
32
|
.join(', ');
|
|
39
|
-
|
|
40
33
|
export const noInlineSignatureTypeLiteralRestriction = {
|
|
41
34
|
selector: noInlineSignatureTypeLiteralSelector,
|
|
42
|
-
message:
|
|
43
|
-
'Inline object type literals are not allowed in function parameters or return types — extract a named type.'
|
|
35
|
+
message: 'Inline object type literals are not allowed in function parameters or return types — extract a named type.'
|
|
44
36
|
};
|
|
45
|
-
|
|
46
37
|
const noPublicClassPropertySelector = [
|
|
47
38
|
'PropertyDefinition[accessibility="public"]',
|
|
48
39
|
'AccessorProperty[accessibility="public"]',
|
|
@@ -50,94 +41,47 @@ const noPublicClassPropertySelector = [
|
|
|
50
41
|
'MethodDefinition[kind="set"][accessibility="public"]'
|
|
51
42
|
]
|
|
52
43
|
.join(', ');
|
|
53
|
-
|
|
54
44
|
export const noPublicClassPropertyRestriction = {
|
|
55
45
|
selector: noPublicClassPropertySelector,
|
|
56
46
|
message: 'Class properties and accessors must be private or protected — only methods may be public.'
|
|
57
47
|
};
|
|
58
|
-
|
|
59
48
|
const restrictedSyntaxTypescriptPlugin = createRestrictedSyntaxPlugin([
|
|
60
49
|
'no-ts-enum-declaration',
|
|
61
50
|
'no-inline-signature-type-literal',
|
|
62
51
|
'no-public-class-property'
|
|
63
|
-
]);
|
|
64
|
-
|
|
52
|
+
], {});
|
|
65
53
|
function asArray(value) {
|
|
66
54
|
if (Array.isArray(value)) {
|
|
67
55
|
return value;
|
|
68
56
|
}
|
|
69
|
-
|
|
70
|
-
return [ value ];
|
|
57
|
+
return [value];
|
|
71
58
|
}
|
|
72
|
-
|
|
73
59
|
function configureWrappedCoreRule(name, optionsOverrides) {
|
|
74
60
|
const coreRuleConfig = asArray(baseSharedConfig.rules[name]);
|
|
75
|
-
const [
|
|
61
|
+
const [coreRuleSeverity, ...coreRuleOptions] = coreRuleConfig;
|
|
76
62
|
const options = optionsOverrides === undefined ? coreRuleOptions : asArray(optionsOverrides);
|
|
77
|
-
|
|
78
63
|
return {
|
|
79
64
|
[name]: 'off',
|
|
80
|
-
[`@typescript-eslint/${name}`]: [
|
|
65
|
+
[`@typescript-eslint/${name}`]: [coreRuleSeverity, ...options]
|
|
81
66
|
};
|
|
82
67
|
}
|
|
83
|
-
|
|
84
68
|
export const typescriptConfig = {
|
|
85
|
-
languageOptions:
|
|
86
|
-
|
|
87
|
-
parserOptions: {
|
|
88
|
-
warnOnUnsupportedTypeScriptVersion: false,
|
|
89
|
-
sourceType: 'module',
|
|
90
|
-
ecmaFeatures: {
|
|
91
|
-
jsx: false,
|
|
92
|
-
globalReturn: false
|
|
93
|
-
},
|
|
94
|
-
projectService: true
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
settings: {
|
|
98
|
-
'import/parsers': {
|
|
99
|
-
'@typescript-eslint/parser': typescriptExtensions
|
|
100
|
-
},
|
|
101
|
-
'import-x/resolver-next': [
|
|
102
|
-
createNodeResolver({
|
|
103
|
-
extensions: [ ...javascriptExtensions, ...typescriptExtensions ]
|
|
104
|
-
}),
|
|
105
|
-
createTypeScriptImportResolver()
|
|
106
|
-
],
|
|
107
|
-
// The upstream defaults in `is-immutable-type` classify Date, URL,
|
|
108
|
-
// and URLSearchParams as Mutable, which poisons any union, record,
|
|
109
|
-
// or recursive value type that mentions them. We promote them — and
|
|
110
|
-
// a few more value-like built-ins — to ReadonlyShallow so consumers
|
|
111
|
-
// can use them without a Readonly<T> wrapper. Map and Set stay
|
|
112
|
-
// Mutable (via the upstream defaults) so the autofixer keeps
|
|
113
|
-
// rewriting them to ReadonlyMap/ReadonlySet.
|
|
114
|
-
immutability: {
|
|
115
|
-
overrides: [
|
|
116
|
-
{ type: { from: 'lib', name: 'Date' }, to: 'ReadonlyShallow' },
|
|
117
|
-
{ type: { from: 'lib', name: 'RegExp' }, to: 'ReadonlyShallow' },
|
|
118
|
-
{ type: { from: 'lib', name: 'URL' }, to: 'ReadonlyShallow' },
|
|
119
|
-
{ type: { from: 'lib', name: 'URLSearchParams' }, to: 'ReadonlyShallow' },
|
|
120
|
-
{ type: { from: 'lib', name: 'WeakMap' }, to: 'ReadonlyShallow' },
|
|
121
|
-
{ type: { from: 'lib', name: 'WeakSet' }, to: 'ReadonlyShallow' },
|
|
122
|
-
{ type: { from: 'lib', name: 'Promise' }, to: 'ReadonlyShallow' },
|
|
123
|
-
{ type: { from: 'lib', name: 'Error' }, to: 'ReadonlyShallow' }
|
|
124
|
-
]
|
|
125
|
-
}
|
|
126
|
-
},
|
|
69
|
+
languageOptions: typescriptLanguageOptions,
|
|
70
|
+
settings: typescriptSettings,
|
|
127
71
|
plugins: {
|
|
128
72
|
'@typescript-eslint': typescriptPlugin,
|
|
129
73
|
perfectionist: perfectionistPlugin,
|
|
130
74
|
functional: functionalPlugin,
|
|
131
|
-
'restricted-syntax-typescript': restrictedSyntaxTypescriptPlugin
|
|
75
|
+
'restricted-syntax-typescript': restrictedSyntaxTypescriptPlugin,
|
|
76
|
+
'enormora-typescript': enormoraTypescriptPlugin
|
|
132
77
|
},
|
|
133
78
|
rules: {
|
|
134
|
-
'restricted-syntax-typescript/no-ts-enum-declaration': [
|
|
79
|
+
'restricted-syntax-typescript/no-ts-enum-declaration': ['error', noTsEnumDeclarationRestriction],
|
|
135
80
|
'restricted-syntax-typescript/no-inline-signature-type-literal': [
|
|
136
81
|
'error',
|
|
137
82
|
noInlineSignatureTypeLiteralRestriction
|
|
138
83
|
],
|
|
139
|
-
'restricted-syntax-typescript/no-public-class-property': [
|
|
140
|
-
|
|
84
|
+
'restricted-syntax-typescript/no-public-class-property': ['error', noPublicClassPropertyRestriction],
|
|
141
85
|
'@typescript-eslint/no-require-imports': 'error',
|
|
142
86
|
'@typescript-eslint/adjacent-overload-signatures': 'error',
|
|
143
87
|
'@typescript-eslint/array-type': [
|
|
@@ -147,7 +91,7 @@ export const typescriptConfig = {
|
|
|
147
91
|
}
|
|
148
92
|
],
|
|
149
93
|
'@typescript-eslint/await-thenable': 'error',
|
|
150
|
-
'@typescript-eslint/no-empty-object-type': [
|
|
94
|
+
'@typescript-eslint/no-empty-object-type': ['error', { allowInterfaces: 'never', allowObjectTypes: 'never' }],
|
|
151
95
|
'@typescript-eslint/no-unsafe-function-type': 'error',
|
|
152
96
|
'@typescript-eslint/no-wrapper-object-types': 'error',
|
|
153
97
|
'@typescript-eslint/no-restricted-types': [
|
|
@@ -155,13 +99,11 @@ export const typescriptConfig = {
|
|
|
155
99
|
{
|
|
156
100
|
types: {
|
|
157
101
|
'Record<never, never>': {
|
|
158
|
-
message:
|
|
159
|
-
'The `object` type is hard to use. Use `Record<PropertyKey, never>` instead. See: https://github.com/typescript-eslint/typescript-eslint/pull/848',
|
|
102
|
+
message: 'The `object` type is hard to use. Use `Record<PropertyKey, never>` instead. See: https://github.com/typescript-eslint/typescript-eslint/pull/848',
|
|
160
103
|
fixWith: 'Record<PropertyKey, never>'
|
|
161
104
|
},
|
|
162
105
|
object: {
|
|
163
|
-
message:
|
|
164
|
-
'The `object` type is hard to use. Use `Record<string, unknown>` instead. See: https://github.com/typescript-eslint/typescript-eslint/pull/848',
|
|
106
|
+
message: 'The `object` type is hard to use. Use `Record<string, unknown>` instead. See: https://github.com/typescript-eslint/typescript-eslint/pull/848',
|
|
165
107
|
fixWith: 'Record<string, unknown>'
|
|
166
108
|
},
|
|
167
109
|
Omit: {
|
|
@@ -175,17 +117,17 @@ export const typescriptConfig = {
|
|
|
175
117
|
'error',
|
|
176
118
|
{
|
|
177
119
|
selector: 'parameter',
|
|
178
|
-
format: [
|
|
120
|
+
format: ['camelCase'],
|
|
179
121
|
leadingUnderscore: 'allow',
|
|
180
122
|
trailingUnderscore: 'forbid'
|
|
181
123
|
},
|
|
182
124
|
{
|
|
183
125
|
selector: 'typeLike',
|
|
184
|
-
format: [
|
|
126
|
+
format: ['PascalCase']
|
|
185
127
|
},
|
|
186
128
|
{
|
|
187
129
|
selector: 'interface',
|
|
188
|
-
format: [
|
|
130
|
+
format: ['PascalCase'],
|
|
189
131
|
custom: {
|
|
190
132
|
regex: '^I[A-Z]',
|
|
191
133
|
match: false
|
|
@@ -210,10 +152,10 @@ export const typescriptConfig = {
|
|
|
210
152
|
// misfires on intentional tagged-union returns (e.g. `Value | Sentinel`)
|
|
211
153
|
// even when expressed as a single named alias.
|
|
212
154
|
'sonarjs/function-return-type': 'off',
|
|
213
|
-
...configureWrappedCoreRule('max-params'),
|
|
155
|
+
...configureWrappedCoreRule('max-params', undefined),
|
|
214
156
|
'@typescript-eslint/member-ordering': 'error',
|
|
215
|
-
...configureWrappedCoreRule('no-array-constructor'),
|
|
216
|
-
...configureWrappedCoreRule('no-empty-function'),
|
|
157
|
+
...configureWrappedCoreRule('no-array-constructor', undefined),
|
|
158
|
+
...configureWrappedCoreRule('no-empty-function', undefined),
|
|
217
159
|
'@typescript-eslint/no-explicit-any': 'error',
|
|
218
160
|
'@typescript-eslint/no-extraneous-class': 'error',
|
|
219
161
|
'@typescript-eslint/no-for-in-array': 'error',
|
|
@@ -226,7 +168,6 @@ export const typescriptConfig = {
|
|
|
226
168
|
checksVoidReturn: true
|
|
227
169
|
}
|
|
228
170
|
],
|
|
229
|
-
|
|
230
171
|
'@typescript-eslint/no-this-alias': [
|
|
231
172
|
'error',
|
|
232
173
|
{
|
|
@@ -237,12 +178,14 @@ export const typescriptConfig = {
|
|
|
237
178
|
'@typescript-eslint/no-unnecessary-qualifier': 'error',
|
|
238
179
|
'@typescript-eslint/no-unnecessary-type-arguments': 'error',
|
|
239
180
|
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
|
|
181
|
+
'enormora-typescript/no-impure-satisfies': 'error',
|
|
182
|
+
'enormora-typescript/prefer-named-callable-types': 'error',
|
|
240
183
|
'@typescript-eslint/no-unused-private-class-members': 'error',
|
|
241
|
-
...configureWrappedCoreRule('no-unused-vars'),
|
|
242
|
-
...configureWrappedCoreRule('no-useless-constructor'),
|
|
184
|
+
...configureWrappedCoreRule('no-unused-vars', undefined),
|
|
185
|
+
...configureWrappedCoreRule('no-useless-constructor', undefined),
|
|
243
186
|
'@typescript-eslint/no-useless-constructor': 'error',
|
|
244
187
|
'@typescript-eslint/no-useless-default-assignment': 'error',
|
|
245
|
-
...configureWrappedCoreRule('prefer-destructuring'),
|
|
188
|
+
...configureWrappedCoreRule('prefer-destructuring', undefined),
|
|
246
189
|
'@typescript-eslint/prefer-for-of': 'error',
|
|
247
190
|
'@typescript-eslint/prefer-function-type': 'error',
|
|
248
191
|
'@typescript-eslint/prefer-includes': 'error',
|
|
@@ -283,23 +226,23 @@ export const typescriptConfig = {
|
|
|
283
226
|
'@typescript-eslint/strict-void-return': 'error',
|
|
284
227
|
'@typescript-eslint/only-throw-error': 'error',
|
|
285
228
|
'@typescript-eslint/prefer-optional-chain': 'error',
|
|
286
|
-
'@typescript-eslint/prefer-nullish-coalescing': [
|
|
287
|
-
'@typescript-eslint/class-literal-property-style': [
|
|
288
|
-
'@typescript-eslint/consistent-type-definitions': [
|
|
289
|
-
...configureWrappedCoreRule('default-param-last'),
|
|
290
|
-
...configureWrappedCoreRule('dot-notation'),
|
|
291
|
-
'@typescript-eslint/explicit-member-accessibility': [
|
|
229
|
+
'@typescript-eslint/prefer-nullish-coalescing': ['error', { ignoreIfStatements: true }],
|
|
230
|
+
'@typescript-eslint/class-literal-property-style': ['error', 'fields'],
|
|
231
|
+
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
|
|
232
|
+
...configureWrappedCoreRule('default-param-last', undefined),
|
|
233
|
+
...configureWrappedCoreRule('dot-notation', undefined),
|
|
234
|
+
'@typescript-eslint/explicit-member-accessibility': ['error', { accessibility: 'explicit' }],
|
|
292
235
|
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
293
236
|
'@typescript-eslint/init-declarations': 'off',
|
|
294
|
-
'@typescript-eslint/method-signature-style': [
|
|
237
|
+
'@typescript-eslint/method-signature-style': ['error', 'property'],
|
|
295
238
|
'@typescript-eslint/no-base-to-string': 'error',
|
|
296
|
-
...configureWrappedCoreRule('no-dupe-class-members'),
|
|
297
|
-
'@typescript-eslint/no-dynamic-delete': [
|
|
298
|
-
'@typescript-eslint/no-extra-non-null-assertion': [
|
|
299
|
-
'@typescript-eslint/no-floating-promises': [
|
|
300
|
-
'@typescript-eslint/no-implied-eval': [
|
|
301
|
-
'@typescript-eslint/no-invalid-this': [
|
|
302
|
-
'@typescript-eslint/no-invalid-void-type': [
|
|
239
|
+
...configureWrappedCoreRule('no-dupe-class-members', undefined),
|
|
240
|
+
'@typescript-eslint/no-dynamic-delete': ['error'],
|
|
241
|
+
'@typescript-eslint/no-extra-non-null-assertion': ['error'],
|
|
242
|
+
'@typescript-eslint/no-floating-promises': ['error'],
|
|
243
|
+
'@typescript-eslint/no-implied-eval': ['error'],
|
|
244
|
+
'@typescript-eslint/no-invalid-this': ['error'],
|
|
245
|
+
'@typescript-eslint/no-invalid-void-type': ['error'],
|
|
303
246
|
...configureWrappedCoreRule('no-magic-numbers', {
|
|
304
247
|
ignoreEnums: false,
|
|
305
248
|
ignoreNumericLiteralTypes: true,
|
|
@@ -310,22 +253,22 @@ export const typescriptConfig = {
|
|
|
310
253
|
detectObjects: false,
|
|
311
254
|
enforceConst: false,
|
|
312
255
|
ignoreClassFieldInitialValues: false,
|
|
313
|
-
ignore: [
|
|
256
|
+
ignore: [-1, 0, 1]
|
|
314
257
|
}),
|
|
315
|
-
'@typescript-eslint/no-namespace': [
|
|
316
|
-
'@typescript-eslint/no-non-null-asserted-optional-chain': [
|
|
317
|
-
'@typescript-eslint/no-non-null-assertion': [
|
|
318
|
-
'@typescript-eslint/no-unnecessary-boolean-literal-compare': [
|
|
319
|
-
'@typescript-eslint/no-unnecessary-condition': [
|
|
320
|
-
'@typescript-eslint/no-unsafe-assignment': [
|
|
321
|
-
'@typescript-eslint/no-unsafe-call': [
|
|
322
|
-
'@typescript-eslint/no-unsafe-member-access': [
|
|
323
|
-
'@typescript-eslint/no-unsafe-return': [
|
|
324
|
-
...configureWrappedCoreRule('no-use-before-define'),
|
|
325
|
-
'@typescript-eslint/prefer-as-const': [
|
|
258
|
+
'@typescript-eslint/no-namespace': ['error'],
|
|
259
|
+
'@typescript-eslint/no-non-null-asserted-optional-chain': ['error'],
|
|
260
|
+
'@typescript-eslint/no-non-null-assertion': ['error'],
|
|
261
|
+
'@typescript-eslint/no-unnecessary-boolean-literal-compare': ['error'],
|
|
262
|
+
'@typescript-eslint/no-unnecessary-condition': ['error'],
|
|
263
|
+
'@typescript-eslint/no-unsafe-assignment': ['error'],
|
|
264
|
+
'@typescript-eslint/no-unsafe-call': ['error'],
|
|
265
|
+
'@typescript-eslint/no-unsafe-member-access': ['error'],
|
|
266
|
+
'@typescript-eslint/no-unsafe-return': ['error'],
|
|
267
|
+
...configureWrappedCoreRule('no-use-before-define', undefined),
|
|
268
|
+
'@typescript-eslint/prefer-as-const': ['error'],
|
|
326
269
|
// disabled because we use functional/prefer-immutable-types.md
|
|
327
|
-
'@typescript-eslint/prefer-readonly-parameter-types': [
|
|
328
|
-
'@typescript-eslint/prefer-reduce-type-parameter': [
|
|
270
|
+
'@typescript-eslint/prefer-readonly-parameter-types': ['off'],
|
|
271
|
+
'@typescript-eslint/prefer-reduce-type-parameter': ['error'],
|
|
329
272
|
'@typescript-eslint/ban-ts-comment': [
|
|
330
273
|
'error',
|
|
331
274
|
{
|
|
@@ -336,21 +279,21 @@ export const typescriptConfig = {
|
|
|
336
279
|
minimumDescriptionLength: 10
|
|
337
280
|
}
|
|
338
281
|
],
|
|
339
|
-
'@typescript-eslint/restrict-template-expressions': [
|
|
340
|
-
'@typescript-eslint/return-await': [
|
|
341
|
-
'@typescript-eslint/switch-exhaustiveness-check': [
|
|
342
|
-
'@typescript-eslint/unbound-method': [
|
|
343
|
-
'@typescript-eslint/ban-tslint-comment': [
|
|
344
|
-
'@typescript-eslint/no-confusing-non-null-assertion': [
|
|
345
|
-
'@typescript-eslint/prefer-enum-initializers': [
|
|
346
|
-
'@typescript-eslint/prefer-literal-enum-member': [
|
|
347
|
-
...configureWrappedCoreRule('no-redeclare'),
|
|
348
|
-
...configureWrappedCoreRule('no-shadow'),
|
|
282
|
+
'@typescript-eslint/restrict-template-expressions': ['off'],
|
|
283
|
+
'@typescript-eslint/return-await': ['off'],
|
|
284
|
+
'@typescript-eslint/switch-exhaustiveness-check': ['error'],
|
|
285
|
+
'@typescript-eslint/unbound-method': ['off'],
|
|
286
|
+
'@typescript-eslint/ban-tslint-comment': ['off'],
|
|
287
|
+
'@typescript-eslint/no-confusing-non-null-assertion': ['error'],
|
|
288
|
+
'@typescript-eslint/prefer-enum-initializers': ['off'],
|
|
289
|
+
'@typescript-eslint/prefer-literal-enum-member': ['off'],
|
|
290
|
+
...configureWrappedCoreRule('no-redeclare', undefined),
|
|
291
|
+
...configureWrappedCoreRule('no-shadow', undefined),
|
|
349
292
|
'@typescript-eslint/consistent-type-imports': [
|
|
350
293
|
'error',
|
|
351
294
|
{ prefer: 'type-imports', fixStyle: 'inline-type-imports', disallowTypeAnnotations: true }
|
|
352
295
|
],
|
|
353
|
-
'@typescript-eslint/consistent-indexed-object-style': [
|
|
296
|
+
'@typescript-eslint/consistent-indexed-object-style': ['error', 'record'],
|
|
354
297
|
'@typescript-eslint/no-loop-func': 'off',
|
|
355
298
|
'@typescript-eslint/no-unnecessary-type-constraint': 'error',
|
|
356
299
|
'@typescript-eslint/no-confusing-void-expression': [
|
|
@@ -369,9 +312,9 @@ export const typescriptConfig = {
|
|
|
369
312
|
'@typescript-eslint/consistent-type-exports': 'error',
|
|
370
313
|
'@typescript-eslint/no-redundant-type-constituents': 'error',
|
|
371
314
|
'@typescript-eslint/no-useless-empty-export': 'error',
|
|
372
|
-
'@typescript-eslint/consistent-generic-constructors': [
|
|
315
|
+
'@typescript-eslint/consistent-generic-constructors': ['error', 'constructor'],
|
|
373
316
|
'@typescript-eslint/no-duplicate-enum-values': 'error',
|
|
374
|
-
'@typescript-eslint/parameter-properties': [
|
|
317
|
+
'@typescript-eslint/parameter-properties': ['error', { prefer: 'class-property' }],
|
|
375
318
|
'@typescript-eslint/no-unsafe-declaration-merging': 'error',
|
|
376
319
|
'@typescript-eslint/no-mixed-enums': 'error',
|
|
377
320
|
'@typescript-eslint/no-import-type-side-effects': 'error',
|
|
@@ -381,7 +324,7 @@ export const typescriptConfig = {
|
|
|
381
324
|
'@typescript-eslint/no-array-delete': 'error',
|
|
382
325
|
'@typescript-eslint/no-unnecessary-template-expression': 'error',
|
|
383
326
|
'@typescript-eslint/no-unnecessary-type-conversion': 'error',
|
|
384
|
-
...configureWrappedCoreRule('prefer-promise-reject-errors'),
|
|
327
|
+
...configureWrappedCoreRule('prefer-promise-reject-errors', undefined),
|
|
385
328
|
'@typescript-eslint/prefer-find': 'error',
|
|
386
329
|
'@typescript-eslint/no-deprecated': 'off',
|
|
387
330
|
'@typescript-eslint/no-unnecessary-parameter-property-assignment': 'error',
|
|
@@ -389,7 +332,6 @@ export const typescriptConfig = {
|
|
|
389
332
|
'@typescript-eslint/no-unsafe-type-assertion': 'error',
|
|
390
333
|
'@typescript-eslint/related-getter-setter-pairs': 'error',
|
|
391
334
|
'@typescript-eslint/no-misused-spread': 'error',
|
|
392
|
-
|
|
393
335
|
'functional/functional-parameters': 'off',
|
|
394
336
|
'functional/immutable-data': 'off',
|
|
395
337
|
'functional/no-classes': 'off',
|
|
@@ -414,7 +356,7 @@ export const typescriptConfig = {
|
|
|
414
356
|
// named class/interface/type-alias references whose upstream
|
|
415
357
|
// members are not declared readonly, so structural shallow
|
|
416
358
|
// checks cannot be satisfied by any annotation.
|
|
417
|
-
ignoreTypePattern: [
|
|
359
|
+
ignoreTypePattern: [namedReferenceIgnorePattern],
|
|
418
360
|
fixer: {
|
|
419
361
|
ReadonlyShallow: [
|
|
420
362
|
{
|
|
@@ -461,7 +403,7 @@ export const typescriptConfig = {
|
|
|
461
403
|
}
|
|
462
404
|
],
|
|
463
405
|
'functional/prefer-tacit': 'error',
|
|
464
|
-
'functional/readonly-type': [
|
|
406
|
+
'functional/readonly-type': ['error', 'keyword'],
|
|
465
407
|
'functional/no-class-inheritance': 'off',
|
|
466
408
|
'functional/type-declaration-immutability': [
|
|
467
409
|
'error',
|
|
@@ -499,13 +441,12 @@ export const typescriptConfig = {
|
|
|
499
441
|
]
|
|
500
442
|
}
|
|
501
443
|
],
|
|
502
|
-
ignoreTypePattern: [
|
|
444
|
+
ignoreTypePattern: [namedReferenceIgnorePattern],
|
|
503
445
|
ignoreInterfaces: false
|
|
504
446
|
}
|
|
505
447
|
],
|
|
506
|
-
...configureWrappedCoreRule('consistent-return'),
|
|
448
|
+
...configureWrappedCoreRule('consistent-return', undefined),
|
|
507
449
|
'@typescript-eslint/use-unknown-in-catch-callback-variable': 'error',
|
|
508
|
-
|
|
509
450
|
'import/extensions': [
|
|
510
451
|
'error',
|
|
511
452
|
{
|
|
@@ -518,7 +459,6 @@ export const typescriptConfig = {
|
|
|
518
459
|
json: 'ignorePackages'
|
|
519
460
|
}
|
|
520
461
|
],
|
|
521
|
-
|
|
522
462
|
'perfectionist/sort-intersection-types': [
|
|
523
463
|
'error',
|
|
524
464
|
{
|
|
@@ -588,3 +528,4 @@ export const typescriptConfig = {
|
|
|
588
528
|
'perfectionist/sort-modules': 'off'
|
|
589
529
|
}
|
|
590
530
|
};
|
|
531
|
+
//# sourceMappingURL=typescript.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescript.js","sourceRoot":"","sources":["../../../../../configs/presets/typescript/typescript.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,kCAAkC,CAAC;AAEhE,OAAO,gBAAgB,MAAM,0BAA0B,CAAC;AACxD,OAAO,mBAAmB,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,M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AChC,kCAAkC,EAAE,KAAK;QACzC,kCAAkC,EAAE,KAAK;QACzC,iCAAiC,EAAE,KAAK;QACxC,4BAA4B,EAAE,KAAK;QACnC,gCAAgC,EAAE,KAAK;QACvC,0CAA0C,EAAE,KAAK;QACjD,yBAAyB,EAAE,KAAK;QAChC,qCAAqC,EAAE,KAAK;QAC5C,+BAA+B,EAAE,KAAK;QACtC,4BAA4B,EAAE,KAAK;KACtC;CACwB,CAAC"}
|
package/readme.md
CHANGED
|
@@ -29,3 +29,10 @@ export default [
|
|
|
29
29
|
}
|
|
30
30
|
];
|
|
31
31
|
```
|
|
32
|
+
|
|
33
|
+
## First-party rules
|
|
34
|
+
|
|
35
|
+
This preset ships a first-party plugin under the namespace `enormora-typescript`:
|
|
36
|
+
|
|
37
|
+
- `enormora-typescript/no-impure-satisfies` — flags every `satisfies` expression. Constraints that contain literal types (e.g. `{ kind: 'a' }`, `1`, `readonly [1, 2]`) are reported as `typeChangingSatisfies` because they pin the inferred type to specific literals. Constraints that are purely structural (e.g. `{ kind: string }`, `Handler`) are reported as `trivialSatisfies` because they impose no narrowing beyond what TypeScript already infers. The preset enables the rule with type-aware parsing (`parserOptions.projectService`).
|
|
38
|
+
- `enormora-typescript/prefer-named-callable-types` — flags `typeof <callable>` inside `ReturnType`, `Parameters`, `ConstructorParameters`, `InstanceType`, and `ThisParameterType` whenever the extracted type already has a named alias declared in the local sources (outside `node_modules`). The fix is to import (or, if needed, `export` first) the existing alias instead of reconstructing it through the utility type.
|
package/sbom.cdx.json
CHANGED
|
@@ -9,57 +9,83 @@
|
|
|
9
9
|
{
|
|
10
10
|
"type": "application",
|
|
11
11
|
"name": "packtory",
|
|
12
|
-
"version": "0.0.
|
|
12
|
+
"version": "0.0.33"
|
|
13
13
|
}
|
|
14
14
|
]
|
|
15
15
|
},
|
|
16
16
|
"component": {
|
|
17
17
|
"type": "library",
|
|
18
18
|
"name": "@enormora/eslint-config-typescript",
|
|
19
|
-
"version": "0.0.
|
|
20
|
-
"bom-ref": "pkg:npm/@enormora/eslint-config-typescript@0.0.
|
|
21
|
-
"purl": "pkg:npm/@enormora/eslint-config-typescript@0.0.
|
|
19
|
+
"version": "0.0.45",
|
|
20
|
+
"bom-ref": "pkg:npm/@enormora/eslint-config-typescript@0.0.45",
|
|
21
|
+
"purl": "pkg:npm/@enormora/eslint-config-typescript@0.0.45"
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"components": [
|
|
25
25
|
{
|
|
26
26
|
"type": "library",
|
|
27
27
|
"name": "@enormora/eslint-config-base",
|
|
28
|
-
"version": "0.0.
|
|
29
|
-
"bom-ref": "pkg:npm/@enormora/eslint-config-base@0.0.
|
|
28
|
+
"version": "0.0.39",
|
|
29
|
+
"bom-ref": "pkg:npm/@enormora/eslint-config-base@0.0.39",
|
|
30
30
|
"scope": "optional",
|
|
31
31
|
"licenses": [
|
|
32
32
|
{
|
|
33
33
|
"expression": "MIT"
|
|
34
34
|
}
|
|
35
35
|
],
|
|
36
|
-
"purl": "pkg:npm/@enormora/eslint-config-base@0.0.
|
|
36
|
+
"purl": "pkg:npm/@enormora/eslint-config-base@0.0.39"
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
"type": "library",
|
|
40
40
|
"name": "@typescript-eslint/eslint-plugin",
|
|
41
|
-
"version": "8.
|
|
42
|
-
"bom-ref": "pkg:npm/@typescript-eslint/eslint-plugin@8.
|
|
41
|
+
"version": "8.61.0",
|
|
42
|
+
"bom-ref": "pkg:npm/@typescript-eslint/eslint-plugin@8.61.0",
|
|
43
43
|
"scope": "required",
|
|
44
44
|
"licenses": [
|
|
45
45
|
{
|
|
46
46
|
"expression": "MIT"
|
|
47
47
|
}
|
|
48
48
|
],
|
|
49
|
-
"purl": "pkg:npm/@typescript-eslint/eslint-plugin@8.
|
|
49
|
+
"purl": "pkg:npm/@typescript-eslint/eslint-plugin@8.61.0"
|
|
50
50
|
},
|
|
51
51
|
{
|
|
52
52
|
"type": "library",
|
|
53
53
|
"name": "@typescript-eslint/parser",
|
|
54
|
-
"version": "8.
|
|
55
|
-
"bom-ref": "pkg:npm/@typescript-eslint/parser@8.
|
|
54
|
+
"version": "8.61.0",
|
|
55
|
+
"bom-ref": "pkg:npm/@typescript-eslint/parser@8.61.0",
|
|
56
56
|
"scope": "required",
|
|
57
57
|
"licenses": [
|
|
58
58
|
{
|
|
59
59
|
"expression": "MIT"
|
|
60
60
|
}
|
|
61
61
|
],
|
|
62
|
-
"purl": "pkg:npm/@typescript-eslint/parser@8.
|
|
62
|
+
"purl": "pkg:npm/@typescript-eslint/parser@8.61.0"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"type": "library",
|
|
66
|
+
"name": "@typescript-eslint/type-utils",
|
|
67
|
+
"version": "8.61.0",
|
|
68
|
+
"bom-ref": "pkg:npm/@typescript-eslint/type-utils@8.61.0",
|
|
69
|
+
"scope": "required",
|
|
70
|
+
"licenses": [
|
|
71
|
+
{
|
|
72
|
+
"expression": "MIT"
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
"purl": "pkg:npm/@typescript-eslint/type-utils@8.61.0"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"type": "library",
|
|
79
|
+
"name": "@typescript-eslint/utils",
|
|
80
|
+
"version": "8.61.0",
|
|
81
|
+
"bom-ref": "pkg:npm/@typescript-eslint/utils@8.61.0",
|
|
82
|
+
"scope": "required",
|
|
83
|
+
"licenses": [
|
|
84
|
+
{
|
|
85
|
+
"expression": "MIT"
|
|
86
|
+
}
|
|
87
|
+
],
|
|
88
|
+
"purl": "pkg:npm/@typescript-eslint/utils@8.61.0"
|
|
63
89
|
},
|
|
64
90
|
{
|
|
65
91
|
"type": "library",
|
|
@@ -112,29 +138,51 @@
|
|
|
112
138
|
}
|
|
113
139
|
],
|
|
114
140
|
"purl": "pkg:npm/eslint-plugin-perfectionist@5.9.0"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"type": "library",
|
|
144
|
+
"name": "typescript",
|
|
145
|
+
"version": ">=4.8.4 <6.1.0",
|
|
146
|
+
"bom-ref": "pkg:npm/typescript@%3E%3D4.8.4%20%3C6.1.0",
|
|
147
|
+
"scope": "optional",
|
|
148
|
+
"licenses": [
|
|
149
|
+
{
|
|
150
|
+
"expression": "Apache-2.0"
|
|
151
|
+
}
|
|
152
|
+
],
|
|
153
|
+
"purl": "pkg:npm/typescript@%3E%3D4.8.4%20%3C6.1.0"
|
|
115
154
|
}
|
|
116
155
|
],
|
|
117
156
|
"dependencies": [
|
|
118
157
|
{
|
|
119
|
-
"ref": "pkg:npm/@enormora/eslint-config-base@0.0.
|
|
158
|
+
"ref": "pkg:npm/@enormora/eslint-config-base@0.0.39"
|
|
120
159
|
},
|
|
121
160
|
{
|
|
122
|
-
"ref": "pkg:npm/@enormora/eslint-config-typescript@0.0.
|
|
161
|
+
"ref": "pkg:npm/@enormora/eslint-config-typescript@0.0.45",
|
|
123
162
|
"dependsOn": [
|
|
124
|
-
"pkg:npm/@enormora/eslint-config-base@0.0.
|
|
125
|
-
"pkg:npm/@typescript-eslint/eslint-plugin@8.
|
|
126
|
-
"pkg:npm/@typescript-eslint/parser@8.
|
|
163
|
+
"pkg:npm/@enormora/eslint-config-base@0.0.39",
|
|
164
|
+
"pkg:npm/@typescript-eslint/eslint-plugin@8.61.0",
|
|
165
|
+
"pkg:npm/@typescript-eslint/parser@8.61.0",
|
|
166
|
+
"pkg:npm/@typescript-eslint/type-utils@8.61.0",
|
|
167
|
+
"pkg:npm/@typescript-eslint/utils@8.61.0",
|
|
127
168
|
"pkg:npm/eslint-import-resolver-typescript@4.4.5",
|
|
128
169
|
"pkg:npm/eslint-plugin-functional@10.0.0",
|
|
129
170
|
"pkg:npm/eslint-plugin-import-x@4.16.2",
|
|
130
|
-
"pkg:npm/eslint-plugin-perfectionist@5.9.0"
|
|
171
|
+
"pkg:npm/eslint-plugin-perfectionist@5.9.0",
|
|
172
|
+
"pkg:npm/typescript@%3E%3D4.8.4%20%3C6.1.0"
|
|
131
173
|
]
|
|
132
174
|
},
|
|
133
175
|
{
|
|
134
|
-
"ref": "pkg:npm/@typescript-eslint/eslint-plugin@8.
|
|
176
|
+
"ref": "pkg:npm/@typescript-eslint/eslint-plugin@8.61.0"
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"ref": "pkg:npm/@typescript-eslint/parser@8.61.0"
|
|
135
180
|
},
|
|
136
181
|
{
|
|
137
|
-
"ref": "pkg:npm/@typescript-eslint/
|
|
182
|
+
"ref": "pkg:npm/@typescript-eslint/type-utils@8.61.0"
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"ref": "pkg:npm/@typescript-eslint/utils@8.61.0"
|
|
138
186
|
},
|
|
139
187
|
{
|
|
140
188
|
"ref": "pkg:npm/eslint-import-resolver-typescript@4.4.5"
|
|
@@ -147,6 +195,9 @@
|
|
|
147
195
|
},
|
|
148
196
|
{
|
|
149
197
|
"ref": "pkg:npm/eslint-plugin-perfectionist@5.9.0"
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
"ref": "pkg:npm/typescript@%3E%3D4.8.4%20%3C6.1.0"
|
|
150
201
|
}
|
|
151
202
|
]
|
|
152
203
|
}
|