@futdevpro/dynamo-eslint 1.14.6 → 1.14.8
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/build/configs/base.js +12 -1
- package/build/configs/base.js.map +1 -1
- package/build/plugin/index.d.ts +8 -0
- package/build/plugin/index.d.ts.map +1 -1
- package/build/plugin/index.js +12 -0
- package/build/plugin/index.js.map +1 -1
- package/build/plugin/rules/explicit-types.js +2 -2
- package/build/plugin/rules/explicit-types.js.map +1 -1
- package/build/plugin/rules/import/import-order.d.ts.map +1 -1
- package/build/plugin/rules/import/import-order.js +41 -10
- package/build/plugin/rules/import/import-order.js.map +1 -1
- package/build/plugin/rules/import/import-order.spec.js +17 -1
- package/build/plugin/rules/import/import-order.spec.js.map +1 -1
- package/build/plugin/rules/prefer-enum-over-string-union.d.ts +4 -0
- package/build/plugin/rules/prefer-enum-over-string-union.d.ts.map +1 -0
- package/build/plugin/rules/prefer-enum-over-string-union.js +290 -0
- package/build/plugin/rules/prefer-enum-over-string-union.js.map +1 -0
- package/build/plugin/rules/prefer-enum-over-string-union.spec.d.ts +2 -0
- package/build/plugin/rules/prefer-enum-over-string-union.spec.d.ts.map +1 -0
- package/build/plugin/rules/prefer-enum-over-string-union.spec.js +505 -0
- package/build/plugin/rules/prefer-enum-over-string-union.spec.js.map +1 -0
- package/build/plugin/rules/prefer-interface-over-duplicate-types.d.ts +4 -0
- package/build/plugin/rules/prefer-interface-over-duplicate-types.d.ts.map +1 -0
- package/build/plugin/rules/prefer-interface-over-duplicate-types.js +231 -0
- package/build/plugin/rules/prefer-interface-over-duplicate-types.js.map +1 -0
- package/build/plugin/rules/prefer-interface-over-duplicate-types.spec.d.ts +2 -0
- package/build/plugin/rules/prefer-interface-over-duplicate-types.spec.d.ts.map +1 -0
- package/build/plugin/rules/prefer-interface-over-duplicate-types.spec.js +324 -0
- package/build/plugin/rules/prefer-interface-over-duplicate-types.spec.js.map +1 -0
- package/build/plugin/rules/require-jsdoc-description.d.ts +4 -0
- package/build/plugin/rules/require-jsdoc-description.d.ts.map +1 -0
- package/build/plugin/rules/require-jsdoc-description.js +379 -0
- package/build/plugin/rules/require-jsdoc-description.js.map +1 -0
- package/build/plugin/rules/require-jsdoc-description.spec.d.ts +2 -0
- package/build/plugin/rules/require-jsdoc-description.spec.d.ts.map +1 -0
- package/build/plugin/rules/require-jsdoc-description.spec.js +452 -0
- package/build/plugin/rules/require-jsdoc-description.spec.js.map +1 -0
- package/build/plugin/rules/require-test-description-prefix.d.ts +4 -0
- package/build/plugin/rules/require-test-description-prefix.d.ts.map +1 -0
- package/build/plugin/rules/require-test-description-prefix.js +135 -0
- package/build/plugin/rules/require-test-description-prefix.js.map +1 -0
- package/build/plugin/rules/require-test-description-prefix.spec.d.ts +2 -0
- package/build/plugin/rules/require-test-description-prefix.spec.d.ts.map +1 -0
- package/build/plugin/rules/require-test-description-prefix.spec.js +371 -0
- package/build/plugin/rules/require-test-description-prefix.spec.js.map +1 -0
- package/futdevpro-dynamo-eslint-1.14.8.tgz +0 -0
- package/package.json +1 -1
- package/src/configs/base.ts +12 -1
- package/src/plugin/index.ts +12 -0
- package/src/plugin/rules/explicit-types.ts +2 -2
- package/src/plugin/rules/import/import-order.spec.ts +17 -1
- package/src/plugin/rules/import/import-order.ts +47 -10
- package/src/plugin/rules/prefer-enum-over-string-union.spec.ts +583 -0
- package/src/plugin/rules/prefer-enum-over-string-union.ts +333 -0
- package/src/plugin/rules/prefer-interface-over-duplicate-types.spec.ts +374 -0
- package/src/plugin/rules/prefer-interface-over-duplicate-types.ts +276 -0
- package/src/plugin/rules/require-jsdoc-description.spec.ts +542 -0
- package/src/plugin/rules/require-jsdoc-description.ts +436 -0
- package/src/plugin/rules/require-test-description-prefix.spec.ts +459 -0
- package/src/plugin/rules/require-test-description-prefix.ts +153 -0
- package/futdevpro-dynamo-eslint-1.14.6.tgz +0 -0
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const rule = {
|
|
4
|
+
meta: {
|
|
5
|
+
type: 'suggestion',
|
|
6
|
+
docs: {
|
|
7
|
+
description: 'Suggest using enums instead of union types of string literals',
|
|
8
|
+
recommended: true,
|
|
9
|
+
},
|
|
10
|
+
schema: [
|
|
11
|
+
{
|
|
12
|
+
type: 'object',
|
|
13
|
+
properties: {
|
|
14
|
+
minValues: {
|
|
15
|
+
type: 'number',
|
|
16
|
+
minimum: 2,
|
|
17
|
+
default: 3,
|
|
18
|
+
},
|
|
19
|
+
allowTypeAliases: {
|
|
20
|
+
type: 'boolean',
|
|
21
|
+
default: false,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
additionalProperties: false,
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
messages: {
|
|
28
|
+
preferEnum: 'Consider using an enum instead of a union type of {{count}} string literals.',
|
|
29
|
+
},
|
|
30
|
+
fixable: 'code',
|
|
31
|
+
},
|
|
32
|
+
create(context) {
|
|
33
|
+
const options = context.options[0] || {};
|
|
34
|
+
const minValues = options.minValues || 3;
|
|
35
|
+
const allowTypeAliases = options.allowTypeAliases || false;
|
|
36
|
+
/**
|
|
37
|
+
* Check if a union type is composed solely of string literals
|
|
38
|
+
*/
|
|
39
|
+
function isStringLiteralUnion(node) {
|
|
40
|
+
if (node.type !== 'TSUnionType') {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
if (!node.types || !Array.isArray(node.types)) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
return node.types.every((type) => type.type === 'TSLiteralType' &&
|
|
47
|
+
typeof type.literal?.value === 'string');
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Check if a property is an Angular component input
|
|
51
|
+
*/
|
|
52
|
+
function isAngularInput(node) {
|
|
53
|
+
try {
|
|
54
|
+
// Check for @Input() decorator (old style)
|
|
55
|
+
if (node.decorators && Array.isArray(node.decorators)) {
|
|
56
|
+
const hasInputDecorator = node.decorators.some((decorator) => {
|
|
57
|
+
const expression = decorator.expression;
|
|
58
|
+
return expression?.type === 'CallExpression' &&
|
|
59
|
+
expression.callee?.name === 'Input';
|
|
60
|
+
});
|
|
61
|
+
if (hasInputDecorator) {
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// Check for input() or input.required() signal (new style)
|
|
66
|
+
if (node.value?.type === 'CallExpression') {
|
|
67
|
+
const callee = node.value.callee;
|
|
68
|
+
// Direct call: input()
|
|
69
|
+
if (callee?.name === 'input') {
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
// Member call: input.required()
|
|
73
|
+
if (callee?.object?.name === 'input' && callee?.property?.name === 'required') {
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
console.error('[prefer-enum-over-string-union] Error checking Angular input:', error);
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Check if a union type meets the minimum threshold
|
|
86
|
+
*/
|
|
87
|
+
function meetsThreshold(node) {
|
|
88
|
+
if (node.type !== 'TSUnionType' || !node.types) {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
const stringLiteralCount = node.types.filter((type) => type.type === 'TSLiteralType' &&
|
|
92
|
+
typeof type.literal?.value === 'string').length;
|
|
93
|
+
return stringLiteralCount >= minValues;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Generate enum name suggestion based on context
|
|
97
|
+
*/
|
|
98
|
+
function generateEnumName(node, parent) {
|
|
99
|
+
try {
|
|
100
|
+
// For type aliases, use the type name
|
|
101
|
+
if (parent?.type === 'TSTypeAliasDeclaration' && parent.id?.name) {
|
|
102
|
+
return parent.id.name;
|
|
103
|
+
}
|
|
104
|
+
// For properties, use property name + "Enum"
|
|
105
|
+
if (node.type === 'TSPropertySignature' && node.key?.name) {
|
|
106
|
+
return `${node.key.name.charAt(0).toUpperCase() + node.key.name.slice(1)}Enum`;
|
|
107
|
+
}
|
|
108
|
+
// For class properties, use property name + "Enum"
|
|
109
|
+
if (parent?.type === 'PropertyDefinition' && parent.key?.name) {
|
|
110
|
+
return `${parent.key.name.charAt(0).toUpperCase() + parent.key.name.slice(1)}Enum`;
|
|
111
|
+
}
|
|
112
|
+
// Default fallback
|
|
113
|
+
return 'StatusEnum';
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
console.error('[prefer-enum-over-string-union] Error generating enum name:', error);
|
|
117
|
+
return 'StatusEnum';
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Generate enum values from string literals
|
|
122
|
+
*/
|
|
123
|
+
function generateEnumValues(node) {
|
|
124
|
+
if (node.type !== 'TSUnionType' || !node.types) {
|
|
125
|
+
return [];
|
|
126
|
+
}
|
|
127
|
+
return node.types
|
|
128
|
+
.filter((type) => type.type === 'TSLiteralType' &&
|
|
129
|
+
typeof type.literal?.value === 'string')
|
|
130
|
+
.map((type) => {
|
|
131
|
+
const value = type.literal.value;
|
|
132
|
+
// Convert to PascalCase for enum key
|
|
133
|
+
return value
|
|
134
|
+
.split(/[-_\s]+/)
|
|
135
|
+
.map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
|
|
136
|
+
.join('');
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Report violation with enum suggestion
|
|
141
|
+
*/
|
|
142
|
+
function reportViolation(node, parent, unionNode) {
|
|
143
|
+
const stringLiteralCount = unionNode.types.filter((type) => type.type === 'TSLiteralType' &&
|
|
144
|
+
typeof type.literal?.value === 'string').length;
|
|
145
|
+
const enumName = generateEnumName(node, parent);
|
|
146
|
+
const enumValues = generateEnumValues(unionNode);
|
|
147
|
+
context.report({
|
|
148
|
+
node: unionNode,
|
|
149
|
+
messageId: 'preferEnum',
|
|
150
|
+
data: {
|
|
151
|
+
count: stringLiteralCount.toString(),
|
|
152
|
+
},
|
|
153
|
+
fix(fixer) {
|
|
154
|
+
try {
|
|
155
|
+
const enumDeclaration = `enum ${enumName} {\n ${enumValues.map((key, index) => {
|
|
156
|
+
const value = unionNode.types[index].literal.value;
|
|
157
|
+
return `${key} = '${value}'`;
|
|
158
|
+
}).join(',\n ')}\n}`;
|
|
159
|
+
// For type aliases, replace the entire declaration
|
|
160
|
+
if (parent?.type === 'TSTypeAliasDeclaration') {
|
|
161
|
+
const typeText = context.sourceCode.getText(parent);
|
|
162
|
+
const newText = typeText.replace(/=.*/, `= ${enumName};`);
|
|
163
|
+
return fixer.replaceText(parent, newText);
|
|
164
|
+
}
|
|
165
|
+
// For other cases, suggest enum creation (no auto-fix for now)
|
|
166
|
+
return null;
|
|
167
|
+
}
|
|
168
|
+
catch (fixError) {
|
|
169
|
+
console.error('[prefer-enum-over-string-union] Error in fix function:', fixError);
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
return {
|
|
176
|
+
// Type aliases
|
|
177
|
+
TSTypeAliasDeclaration(node) {
|
|
178
|
+
try {
|
|
179
|
+
if (allowTypeAliases) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
if (isStringLiteralUnion(node.typeAnnotation) && meetsThreshold(node.typeAnnotation)) {
|
|
183
|
+
reportViolation(node.typeAnnotation, node, node.typeAnnotation);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
catch (error) {
|
|
187
|
+
console.error('[prefer-enum-over-string-union] Error in TSTypeAliasDeclaration visitor:', error);
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
// Interface/type properties
|
|
191
|
+
TSPropertySignature(node) {
|
|
192
|
+
try {
|
|
193
|
+
if (isAngularInput(node)) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
if (node.typeAnnotation &&
|
|
197
|
+
isStringLiteralUnion(node.typeAnnotation.typeAnnotation) &&
|
|
198
|
+
meetsThreshold(node.typeAnnotation.typeAnnotation)) {
|
|
199
|
+
reportViolation(node, node.parent, node.typeAnnotation.typeAnnotation);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
catch (error) {
|
|
203
|
+
console.error('[prefer-enum-over-string-union] Error in TSPropertySignature visitor:', error);
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
// Class properties
|
|
207
|
+
PropertyDefinition(node) {
|
|
208
|
+
try {
|
|
209
|
+
if (isAngularInput(node)) {
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
if (node.typeAnnotation &&
|
|
213
|
+
isStringLiteralUnion(node.typeAnnotation.typeAnnotation) &&
|
|
214
|
+
meetsThreshold(node.typeAnnotation.typeAnnotation)) {
|
|
215
|
+
reportViolation(node, node.parent, node.typeAnnotation.typeAnnotation);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
catch (error) {
|
|
219
|
+
console.error('[prefer-enum-over-string-union] Error in PropertyDefinition visitor:', error);
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
// Function parameters
|
|
223
|
+
FunctionDeclaration(node) {
|
|
224
|
+
try {
|
|
225
|
+
if (node.params && Array.isArray(node.params)) {
|
|
226
|
+
node.params.forEach((param) => {
|
|
227
|
+
if (param.typeAnnotation &&
|
|
228
|
+
isStringLiteralUnion(param.typeAnnotation.typeAnnotation) &&
|
|
229
|
+
meetsThreshold(param.typeAnnotation.typeAnnotation)) {
|
|
230
|
+
reportViolation(param, node, param.typeAnnotation.typeAnnotation);
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
catch (error) {
|
|
236
|
+
console.error('[prefer-enum-over-string-union] Error in FunctionDeclaration visitor:', error);
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
// Arrow function parameters
|
|
240
|
+
ArrowFunctionExpression(node) {
|
|
241
|
+
try {
|
|
242
|
+
if (node.params && Array.isArray(node.params)) {
|
|
243
|
+
node.params.forEach((param) => {
|
|
244
|
+
if (param.typeAnnotation &&
|
|
245
|
+
isStringLiteralUnion(param.typeAnnotation.typeAnnotation) &&
|
|
246
|
+
meetsThreshold(param.typeAnnotation.typeAnnotation)) {
|
|
247
|
+
reportViolation(param, node, param.typeAnnotation.typeAnnotation);
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
catch (error) {
|
|
253
|
+
console.error('[prefer-enum-over-string-union] Error in ArrowFunctionExpression visitor:', error);
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
// Variable declarations
|
|
257
|
+
VariableDeclarator(node) {
|
|
258
|
+
try {
|
|
259
|
+
if (node.typeAnnotation &&
|
|
260
|
+
isStringLiteralUnion(node.typeAnnotation.typeAnnotation) &&
|
|
261
|
+
meetsThreshold(node.typeAnnotation.typeAnnotation)) {
|
|
262
|
+
reportViolation(node, node.parent, node.typeAnnotation.typeAnnotation);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
catch (error) {
|
|
266
|
+
console.error('[prefer-enum-over-string-union] Error in VariableDeclarator visitor:', error);
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
// Method signatures
|
|
270
|
+
TSMethodSignature(node) {
|
|
271
|
+
try {
|
|
272
|
+
if (node.params && Array.isArray(node.params)) {
|
|
273
|
+
node.params.forEach((param) => {
|
|
274
|
+
if (param.typeAnnotation &&
|
|
275
|
+
isStringLiteralUnion(param.typeAnnotation.typeAnnotation) &&
|
|
276
|
+
meetsThreshold(param.typeAnnotation.typeAnnotation)) {
|
|
277
|
+
reportViolation(param, node, param.typeAnnotation.typeAnnotation);
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
catch (error) {
|
|
283
|
+
console.error('[prefer-enum-over-string-union] Error in TSMethodSignature visitor:', error);
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
};
|
|
287
|
+
},
|
|
288
|
+
};
|
|
289
|
+
exports.default = rule;
|
|
290
|
+
//# sourceMappingURL=prefer-enum-over-string-union.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prefer-enum-over-string-union.js","sourceRoot":"","sources":["../../../src/plugin/rules/prefer-enum-over-string-union.ts"],"names":[],"mappings":";;AAOA,MAAM,IAAI,GAAoB;IAC5B,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACJ,WAAW,EAAE,+DAA+D;YAC5E,WAAW,EAAE,IAAI;SAClB;QACD,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,SAAS,EAAE;wBACT,IAAI,EAAE,QAAQ;wBACd,OAAO,EAAE,CAAC;wBACV,OAAO,EAAE,CAAC;qBACX;oBACD,gBAAgB,EAAE;wBAChB,IAAI,EAAE,SAAS;wBACf,OAAO,EAAE,KAAK;qBACf;iBACF;gBACD,oBAAoB,EAAE,KAAK;aAC5B;SACF;QACD,QAAQ,EAAE;YACR,UAAU,EAAE,8EAA8E;SAC3F;QACD,OAAO,EAAE,MAAM;KAChB;IACD,MAAM,CAAC,OAAO;QACZ,MAAM,OAAO,GAAgB,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QACtD,MAAM,SAAS,GAAW,OAAO,CAAC,SAAS,IAAI,CAAC,CAAC;QACjD,MAAM,gBAAgB,GAAY,OAAO,CAAC,gBAAgB,IAAI,KAAK,CAAC;QAEpE;;WAEG;QACH,SAAS,oBAAoB,CAAC,IAAS;YACrC,IAAI,IAAI,CAAC,IAAI,KAAK,aAAa,EAAE,CAAC;gBAChC,OAAO,KAAK,CAAC;YACf,CAAC;YAED,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAA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CAAC;gCACzD,cAAc,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,CAAC;gCACxD,eAAe,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;4BACpE,CAAC;wBACH,CAAC,CAAC,CAAC;oBACL,CAAC;gBACH,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,OAAO,CAAC,KAAK,CAAC,qEAAqE,EAAE,KAAK,CAAC,CAAC;gBAC9F,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,kBAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prefer-enum-over-string-union.spec.d.ts","sourceRoot":"","sources":["../../../src/plugin/rules/prefer-enum-over-string-union.spec.ts"],"names":[],"mappings":""}
|