@futdevpro/dynamo-eslint 1.20.3 → 1.20.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +304 -304
  3. package/build/plugin/rules/ts/no-as-cast.d.ts.map +1 -1
  4. package/build/plugin/rules/ts/no-as-cast.js +43 -0
  5. package/build/plugin/rules/ts/no-as-cast.js.map +1 -1
  6. package/package.json +14 -7
  7. package/.c8rc.json +0 -26
  8. package/.cursor/rules/__assistant_guide.mdc +0 -30
  9. package/.cursor/rules/__main.mdc +0 -64
  10. package/.cursor/rules/_ag_backend-structure.mdc +0 -86
  11. package/.cursor/rules/_ag_backend.mdc +0 -16
  12. package/.cursor/rules/_ag_debug.mdc +0 -8
  13. package/.cursor/rules/_ag_documentation_writing_rules.mdc +0 -372
  14. package/.cursor/rules/_ag_file-refactoring.mdc +0 -113
  15. package/.cursor/rules/_ag_fixes_rules.mdc +0 -6
  16. package/.cursor/rules/_ag_frontend-structure.mdc +0 -87
  17. package/.cursor/rules/_ag_frontend.mdc +0 -40
  18. package/.cursor/rules/_ag_import-rules.mdc +0 -45
  19. package/.cursor/rules/_ag_naming.mdc +0 -116
  20. package/.cursor/rules/_ag_running_commands.mdc +0 -5
  21. package/.cursor/rules/_ag_server-controller.mdc +0 -6
  22. package/.cursor/rules/_ag_should-be.mdc +0 -7
  23. package/.cursor/rules/_ag_swearing.mdc +0 -47
  24. package/.cursor/rules/ai_development_guide.md +0 -61
  25. package/.cursor/rules/ai_directives.md +0 -114
  26. package/.cursor/rules/cursor-rules.md +0 -160
  27. package/.cursor/rules/default-command.mdc +0 -465
  28. package/.cursor/rules/error_code_pattern.md +0 -40
  29. package/.cursor/rules/saved rule mcp server use.md +0 -16
  30. package/.dynamo/pipeline.cicd.config.json +0 -184
  31. package/.dynamo/version-bump.config.json +0 -5
  32. package/.eslintrc.json +0 -4
  33. package/.github/workflows/main.yml +0 -436
  34. package/.husky/pre-commit +0 -2
  35. package/.vscode/settings.json +0 -11
  36. package/__documentations/2026-04-18-ccap-review-integration.md +0 -173
  37. package/__documentations/2026-08-18-bfr-ctm-005-eslint9-validator-report.md +0 -45
  38. package/__documentations/2026-08-22-angular-20-phase2-release.md +0 -83
  39. package/eslint.config.js +0 -15
  40. package/pnpm-workspace.yaml +0 -2
  41. package/samples/.vscode/settings.json +0 -13
  42. package/samples/base/.eslintrc.json +0 -6
  43. package/samples/base/eslint.config.js +0 -3
  44. package/samples/fsm/.eslintrc.json +0 -4
  45. package/samples/fsm/eslint.config.js +0 -3
  46. package/samples/ngx/.eslintrc.json +0 -6
  47. package/samples/ngx/eslint.config.js +0 -3
  48. package/samples/ngx-package/.eslintrc.json +0 -4
  49. package/samples/ngx-package/eslint.config.js +0 -3
  50. package/samples/nts/.eslintrc.json +0 -6
  51. package/samples/nts/eslint.config.js +0 -3
  52. package/samples/nts-package/.eslintrc.json +0 -4
  53. package/samples/nts-package/eslint.config.js +0 -3
  54. package/samples/package.json.example +0 -22
  55. package/samples/poc-sample.ts +0 -38
  56. package/samples/poc-violations.ts +0 -54
  57. package/scripts/run-coverage-tests.js +0 -24
  58. package/spec/support/helpers/ts-node-helper.js +0 -9
  59. package/spec/support/jasmine.coverage.json +0 -23
  60. package/spec/support/jasmine.json +0 -24
  61. package/src/configs/angular20-compatibility.spec.ts +0 -73
  62. package/src/configs/base.ts +0 -156
  63. package/src/configs/fsm.ts +0 -10
  64. package/src/configs/ngx-package.ts +0 -10
  65. package/src/configs/ngx.ts +0 -93
  66. package/src/configs/nts-package.ts +0 -20
  67. package/src/configs/nts.ts +0 -34
  68. package/src/index.ts +0 -4
  69. package/src/plugin/index.ts +0 -86
  70. package/src/plugin/rules/angular/angular-for-track-logic.spec.ts +0 -44
  71. package/src/plugin/rules/angular/angular-for-track-logic.ts +0 -88
  72. package/src/plugin/rules/angular/effect-signal-loop.spec.ts +0 -89
  73. package/src/plugin/rules/angular/effect-signal-loop.ts +0 -125
  74. package/src/plugin/rules/angular/no-async-ngoninit.spec.ts +0 -50
  75. package/src/plugin/rules/angular/no-async-ngoninit.ts +0 -43
  76. package/src/plugin/rules/angular/no-component-direct-api.spec.ts +0 -78
  77. package/src/plugin/rules/angular/no-component-direct-api.ts +0 -82
  78. package/src/plugin/rules/angular/no-method-call-in-template.spec.ts +0 -63
  79. package/src/plugin/rules/angular/no-method-call-in-template.ts +0 -89
  80. package/src/plugin/rules/angular/no-ngfor-directive.spec.ts +0 -44
  81. package/src/plugin/rules/angular/no-ngfor-directive.ts +0 -62
  82. package/src/plugin/rules/angular/no-ngif-directive.spec.ts +0 -44
  83. package/src/plugin/rules/angular/no-ngif-directive.ts +0 -62
  84. package/src/plugin/rules/explicit-types.spec.ts +0 -190
  85. package/src/plugin/rules/explicit-types.ts +0 -186
  86. package/src/plugin/rules/import/import-order.spec.ts +0 -219
  87. package/src/plugin/rules/import/import-order.ts +0 -197
  88. package/src/plugin/rules/import/no-import-type.spec.ts +0 -69
  89. package/src/plugin/rules/import/no-import-type.ts +0 -46
  90. package/src/plugin/rules/import/no-js-import.spec.ts +0 -82
  91. package/src/plugin/rules/import/no-js-import.ts +0 -45
  92. package/src/plugin/rules/naming-patterns.spec.ts +0 -189
  93. package/src/plugin/rules/naming-patterns.ts +0 -426
  94. package/src/plugin/rules/no-getter-logic.spec.ts +0 -591
  95. package/src/plugin/rules/no-getter-logic.ts +0 -220
  96. package/src/plugin/rules/prefer-enum-over-string-union.spec.ts +0 -583
  97. package/src/plugin/rules/prefer-enum-over-string-union.ts +0 -333
  98. package/src/plugin/rules/prefer-interface-over-duplicate-types.spec.ts +0 -404
  99. package/src/plugin/rules/prefer-interface-over-duplicate-types.ts +0 -314
  100. package/src/plugin/rules/require-jsdoc-description.spec.ts +0 -779
  101. package/src/plugin/rules/require-jsdoc-description.ts +0 -572
  102. package/src/plugin/rules/require-test-description-prefix.spec.ts +0 -459
  103. package/src/plugin/rules/require-test-description-prefix.ts +0 -154
  104. package/src/plugin/rules/ts/data-model-extends.spec.ts +0 -84
  105. package/src/plugin/rules/ts/data-model-extends.ts +0 -100
  106. package/src/plugin/rules/ts/no-any-type.spec.ts +0 -28
  107. package/src/plugin/rules/ts/no-any-type.ts +0 -36
  108. package/src/plugin/rules/ts/no-as-cast.spec.ts +0 -51
  109. package/src/plugin/rules/ts/no-as-cast.ts +0 -51
  110. package/src/plugin/rules/ts/no-dynamic-imports.spec.ts +0 -54
  111. package/src/plugin/rules/ts/no-dynamic-imports.ts +0 -49
  112. package/src/plugin/rules/ts/no-native-browser-dialogs.spec.ts +0 -54
  113. package/src/plugin/rules/ts/no-native-browser-dialogs.ts +0 -84
  114. package/src/plugin/rules/ts/no-plain-function-export.spec.ts +0 -72
  115. package/src/plugin/rules/ts/no-plain-function-export.ts +0 -73
  116. package/src/plugin/rules/ts/one-export-per-file.spec.ts +0 -64
  117. package/src/plugin/rules/ts/one-export-per-file.ts +0 -77
  118. package/src/scripts/dynamo-fix.ts +0 -172
  119. package/src/scripts/eslintrc-audit.ts +0 -116
  120. package/src/scripts/fix-return-types.spec.ts +0 -65
  121. package/src/scripts/fix-return-types.ts +0 -289
  122. package/src/scripts/validate-imports.ts +0 -292
  123. package/src/scripts/validate-naming.ts +0 -213
  124. package/src/scripts/validator-cli.integration.spec.ts +0 -99
  125. package/tsconfig.json +0 -32
@@ -1,314 +0,0 @@
1
- import { Rule } from 'eslint';
2
-
3
- interface TypeUsage {
4
- node: any;
5
- signature: string;
6
- interfaceName?: string;
7
- }
8
-
9
- interface RuleOptions {
10
- threshold?: number;
11
- }
12
-
13
- const rule: Rule.RuleModule = {
14
- meta: {
15
- type: 'suggestion',
16
- docs: {
17
- description: 'Suggest creating interfaces for object types used more than the threshold number of times',
18
- recommended: true,
19
- },
20
- schema: [
21
- {
22
- type: 'object',
23
- properties: {
24
- threshold: {
25
- type: 'number',
26
- minimum: 2,
27
- default: 3,
28
- },
29
- },
30
- additionalProperties: false,
31
- },
32
- ],
33
- messages: {
34
- preferInterface: 'Object type used {{count}} times. Consider creating interface "{{interfaceName}}"}}',
35
- },
36
- // BFR-ADVENTOR-009 (2. lépcső): a fixer forrás-szöveg-megőrzőre átírva (`sourceCode.getText` per property)
37
- // → a komplex/union/qualified/function típusok EXAKT megőrződnek, a generált interface ÉRVÉNYES TS. Ezért
38
- // az auto-fix (`fixable:'code'`) VISSZA — a bulk `eslint --fix` biztonságosan futtathatja (nem generál
39
- // többé `reference`/`complex` literál-hibát). (1. lépcső: suggestion-degrade, most feloldva.)
40
- fixable: 'code',
41
- },
42
- create(context) {
43
- const options: RuleOptions = context.options[0] || {};
44
- const threshold = options.threshold || 3;
45
- const sourceCode = context.sourceCode;
46
-
47
- // Map to track type signatures and their usages
48
- const typeUsages = new Map<string, TypeUsage[]>();
49
- const allTypeLiterals: any[] = [];
50
-
51
- /**
52
- * Normalize object type to a signature string for comparison
53
- */
54
- function normalizeObjectType(node: any): string {
55
- if (!node || node.type !== 'TSTypeLiteral') {
56
- return '';
57
- }
58
-
59
- if (!node.members || !Array.isArray(node.members)) {
60
- return '';
61
- }
62
-
63
- // Extract and sort properties
64
- const properties = node.members
65
- .filter((member: any) => member.type === 'TSPropertySignature')
66
- .map((member: any) => {
67
- const key = member.key?.name || member.key?.value || 'unknown';
68
- const type = getTypeString(member.typeAnnotation);
69
- const optional = member.optional ? '?' : '';
70
- const readonly = member.readonly ? 'readonly ' : '';
71
-
72
- return `${readonly}${key}${optional}:${type}`;
73
- })
74
- .sort(); // Sort alphabetically
75
-
76
- return properties.join(';');
77
- }
78
-
79
- /**
80
- * Get string representation of a type annotation
81
- */
82
- function getTypeString(typeAnnotation: any): string {
83
- if (!typeAnnotation || !typeAnnotation.typeAnnotation) {
84
- return 'any';
85
- }
86
-
87
- const type = typeAnnotation.typeAnnotation;
88
-
89
- switch (type.type) {
90
- case 'TSStringKeyword':
91
- return 'string';
92
- case 'TSNumberKeyword':
93
- return 'number';
94
- case 'TSBooleanKeyword':
95
- return 'boolean';
96
- case 'TSVoidKeyword':
97
- return 'void';
98
- case 'TSNullKeyword':
99
- return 'null';
100
- case 'TSUndefinedKeyword':
101
- return 'undefined';
102
- case 'TSAnyKeyword':
103
- return 'any';
104
- case 'TSUnknownKeyword':
105
- return 'unknown';
106
- case 'TSNeverKeyword':
107
- return 'never';
108
- case 'TSObjectKeyword':
109
- return 'object';
110
- case 'TSLiteralType':
111
- return type.literal?.value?.toString() || 'literal';
112
- case 'TSArrayType':
113
- return `${getTypeString({ typeAnnotation: type.elementType })}[]`;
114
- case 'TSTypeReference':
115
- return type.typeName?.name || 'reference';
116
- case 'TSTypeLiteral':
117
- return normalizeObjectType(type);
118
- case 'TSUnionType':
119
- return type.types?.map((t: any) => getTypeString({ typeAnnotation: t })).join('|') || 'union';
120
- case 'TSIntersectionType':
121
- return type.types?.map((t: any) => getTypeString({ typeAnnotation: t })).join('&') || 'intersection';
122
-
123
- default:
124
- return 'complex';
125
- }
126
- }
127
-
128
- /**
129
- * Generate interface name based on context
130
- */
131
- function generateInterfaceName(signature: string, usageCount: number): string {
132
- // Try to extract meaningful name from signature
133
- const properties = signature.split(';');
134
-
135
- if (properties.length === 1) {
136
- const prop = properties[0].split(':')[0].replace('readonly ', '').replace('?', '');
137
-
138
- if (prop && prop !== 'unknown') {
139
- return `${prop.charAt(0).toUpperCase() + prop.slice(1)}Interface`;
140
- }
141
- }
142
-
143
- // Fallback to generic name
144
- return `GeneratedInterface${usageCount}`;
145
- }
146
-
147
- /**
148
- * Check if interface name conflicts with existing identifiers
149
- */
150
- function isNameConflict(name: string): boolean {
151
- try {
152
- const scope = context.sourceCode.getScope(context.sourceCode.ast);
153
-
154
- return scope.variables.some(variable => variable.name === name);
155
- } catch {
156
- return false;
157
- }
158
- }
159
-
160
- /**
161
- * Generate unique interface name
162
- */
163
- function generateUniqueInterfaceName(baseName: string): string {
164
- let name = baseName;
165
- let counter = 1;
166
-
167
- while (isNameConflict(name)) {
168
- name = `${baseName}${counter}`;
169
- counter++;
170
- }
171
-
172
- return name;
173
- }
174
-
175
- /**
176
- * BFR-ADVENTOR-009 (2. lépcső): az interface-törzs a FORRÁS-SZÖVEGBŐL épül (sourceCode.getText per
177
- * member), NEM a lossy normalizált signature-ből → a komplex/union/qualified/function típusok EXAKT
178
- * megőrződnek (a korábbi `reference`/`complex`/`union` literál-hibák megszűnnek). A `getText` az eredeti
179
- * property-szöveget adja (pl. `onError: (e: Error) => void`); a záró `;`/`,`-t normalizáljuk.
180
- */
181
- function buildInterfaceBody(node: any): string {
182
- const members: any[] = Array.isArray(node?.members) ? node.members : [];
183
-
184
- return members
185
- .map((member: any): string => {
186
- const text: string = sourceCode.getText(member).trim().replace(/[;,]\s*$/, '');
187
- return ` ${text};`;
188
- })
189
- .join('\n');
190
- }
191
-
192
- /**
193
- * Beszédes interface-név a property-kulcsokból (BFR-ADVENTOR-009): a nem-beszédes, ütköző
194
- * `GeneratedInterfaceN` helyett az első 1-3 kulcsból PascalCase + `Params_Interface` (a projekt-konvenció).
195
- */
196
- function deriveInterfaceName(node: any): string {
197
- const members: any[] = Array.isArray(node?.members) ? node.members : [];
198
- const keys: string[] = members
199
- .filter((m: any): boolean => m.type === 'TSPropertySignature')
200
- .map((m: any): string => String(m.key?.name ?? m.key?.value ?? ''))
201
- .filter((k: string): boolean => !!k)
202
- .slice(0, 3);
203
-
204
- if (!keys.length) {
205
- return 'Generated_Interface';
206
- }
207
-
208
- const pascal: string = keys
209
- .map((k: string): string => k.charAt(0).toUpperCase() + k.slice(1))
210
- .join('');
211
-
212
- return `${pascal}_Interface`;
213
- }
214
-
215
- return {
216
- TSTypeLiteral(node: any): void {
217
- try {
218
- const signature = normalizeObjectType(node);
219
-
220
- if (!signature) {
221
- return;
222
- }
223
-
224
- allTypeLiterals.push(node);
225
-
226
- if (!typeUsages.has(signature)) {
227
- typeUsages.set(signature, []);
228
- }
229
-
230
- typeUsages.get(signature)!.push({
231
- node,
232
- signature,
233
- });
234
- } catch (error) {
235
- console.error('[prefer-interface-over-duplicate-types] Error in TSTypeLiteral visitor:', error);
236
- }
237
- },
238
-
239
- 'Program:exit'(node: any): void {
240
- try {
241
- // Process all collected type usages
242
- for (const [ signature, usages ] of typeUsages) {
243
- if (usages.length >= threshold) {
244
- // beszédes név a property-kulcsokból (ütközés-mentesre pontosítva)
245
- const interfaceName = generateUniqueInterfaceName(
246
- deriveInterfaceName(usages[0].node)
247
- );
248
-
249
- // a törzs a FORRÁS-SZÖVEGBŐL (getText) — a komplex/union/qualified típusok EXAKT megőrződnek
250
- const interfaceBody: string = buildInterfaceBody(usages[0].node);
251
-
252
- // Report on each usage
253
- for (const usage of usages) {
254
- context.report({
255
- node: usage.node,
256
- messageId: 'preferInterface',
257
- data: {
258
- count: usages.length.toString(),
259
- interfaceName,
260
- },
261
- fix(fixer) {
262
- try {
263
- const interfaceDeclaration = `interface ${interfaceName} {\n${interfaceBody}\n}`;
264
-
265
- // Find insertion point (after imports, before other code)
266
- const firstNode = sourceCode.ast.body[0];
267
- let insertPosition = 0;
268
-
269
- if (firstNode && firstNode.type === 'ImportDeclaration') {
270
- // Find last import
271
- let lastImport = firstNode;
272
-
273
- for (const node of sourceCode.ast.body) {
274
- if (node.type === 'ImportDeclaration') {
275
- lastImport = node;
276
- } else {
277
- break;
278
- }
279
- }
280
- insertPosition = lastImport.range![1];
281
- }
282
-
283
- // Add interface declaration
284
- const fixes = [
285
- fixer.insertTextAfterRange([ insertPosition, insertPosition ], `\n\n${interfaceDeclaration}\n`),
286
- ];
287
-
288
- // Replace all usages with interface reference
289
- for (const usage of usages) {
290
- fixes.push(
291
- fixer.replaceText(usage.node, interfaceName)
292
- );
293
- }
294
-
295
- return fixes;
296
- } catch (fixError) {
297
- console.error('[prefer-interface-over-duplicate-types] Error in fix function:', fixError);
298
-
299
- return null;
300
- }
301
- },
302
- });
303
- }
304
- }
305
- }
306
- } catch (error) {
307
- console.error('[prefer-interface-over-duplicate-types] Error in Program:exit visitor:', error);
308
- }
309
- },
310
- };
311
- },
312
- };
313
-
314
- export default rule;