@futdevpro/dynamo-eslint 1.15.22 → 1.15.28
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/.c8rc.json +26 -26
- package/.cursor/rules/__assistant_guide.mdc +30 -30
- package/.cursor/rules/__main.mdc +64 -64
- package/.cursor/rules/_ag_backend-structure.mdc +85 -85
- package/.cursor/rules/_ag_backend.mdc +16 -16
- package/.cursor/rules/_ag_debug.mdc +7 -7
- package/.cursor/rules/_ag_documentation_writing_rules.mdc +372 -372
- package/.cursor/rules/_ag_file-refactoring.mdc +113 -113
- package/.cursor/rules/_ag_fixes_rules.mdc +5 -5
- package/.cursor/rules/_ag_frontend-structure.mdc +86 -86
- package/.cursor/rules/_ag_frontend.mdc +39 -39
- package/.cursor/rules/_ag_import-rules.mdc +44 -44
- package/.cursor/rules/_ag_naming.mdc +115 -115
- package/.cursor/rules/_ag_running_commands.mdc +4 -4
- package/.cursor/rules/_ag_server-controller.mdc +5 -5
- package/.cursor/rules/_ag_should-be.mdc +6 -6
- package/.cursor/rules/_ag_swearing.mdc +47 -47
- package/.cursor/rules/ai_development_guide.md +60 -60
- package/.cursor/rules/ai_directives.md +114 -114
- package/.cursor/rules/cursor-rules.md +160 -160
- package/.cursor/rules/default-command.mdc +464 -464
- package/.cursor/rules/error_code_pattern.md +39 -39
- package/.cursor/rules/saved rule mcp server use.md +15 -15
- package/.dynamo/pipeline.cicd.config.json +184 -184
- package/.dynamo/version-bump.config.json +5 -5
- package/.eslintrc.json +4 -4
- package/.github/workflows/main.yml +436 -436
- package/.husky/pre-commit +2 -2
- package/.vscode/settings.json +11 -11
- package/README.md +319 -319
- package/__documentations/2026-04-18-ccap-review-integration.md +173 -173
- package/__documentations/2026-08-18-bfr-ctm-005-eslint9-validator-report.md +45 -0
- package/build/configs/base.d.ts +9 -9
- package/build/configs/base.js +150 -150
- package/build/configs/fsm.d.ts +1 -1
- package/build/configs/fsm.js +7 -7
- package/build/configs/ngx-package.d.ts +1 -1
- package/build/configs/ngx-package.js +7 -7
- package/build/configs/ngx.d.ts +4 -4
- package/build/configs/ngx.js +91 -91
- package/build/configs/nts-package.d.ts +1 -1
- package/build/configs/nts-package.js +17 -17
- package/build/configs/nts.d.ts +1 -1
- package/build/configs/nts.js +31 -31
- package/build/index.d.ts +1 -1
- package/build/index.js +2 -2
- package/build/plugin/index.d.ts +52 -52
- package/build/plugin/index.js +80 -80
- package/build/plugin/rules/angular/angular-for-track-logic.d.ts +7 -7
- package/build/plugin/rules/angular/angular-for-track-logic.js +81 -81
- package/build/plugin/rules/angular/effect-signal-loop.d.ts +9 -9
- package/build/plugin/rules/angular/effect-signal-loop.js +112 -112
- package/build/plugin/rules/angular/no-async-ngoninit.d.ts +8 -8
- package/build/plugin/rules/angular/no-async-ngoninit.js +42 -42
- package/build/plugin/rules/angular/no-component-direct-api.d.ts +9 -9
- package/build/plugin/rules/angular/no-component-direct-api.js +75 -75
- package/build/plugin/rules/angular/no-method-call-in-template.d.ts +8 -8
- package/build/plugin/rules/angular/no-method-call-in-template.js +79 -79
- package/build/plugin/rules/angular/no-ngfor-directive.d.ts +7 -7
- package/build/plugin/rules/angular/no-ngfor-directive.js +59 -59
- package/build/plugin/rules/angular/no-ngif-directive.d.ts +7 -7
- package/build/plugin/rules/angular/no-ngif-directive.js +59 -59
- package/build/plugin/rules/explicit-types.d.ts +3 -3
- package/build/plugin/rules/explicit-types.js +178 -178
- package/build/plugin/rules/import/import-order.d.ts +3 -3
- package/build/plugin/rules/import/import-order.js +154 -154
- package/build/plugin/rules/import/no-import-type.d.ts +3 -3
- package/build/plugin/rules/import/no-import-type.js +45 -45
- package/build/plugin/rules/import/no-js-import.d.ts +3 -3
- package/build/plugin/rules/import/no-js-import.js +40 -40
- package/build/plugin/rules/naming-patterns.d.ts +7 -7
- package/build/plugin/rules/naming-patterns.d.ts.map +1 -1
- package/build/plugin/rules/naming-patterns.js +366 -350
- package/build/plugin/rules/naming-patterns.js.map +1 -1
- package/build/plugin/rules/no-getter-logic.d.ts +3 -3
- package/build/plugin/rules/no-getter-logic.js +194 -194
- package/build/plugin/rules/prefer-enum-over-string-union.d.ts +3 -3
- package/build/plugin/rules/prefer-enum-over-string-union.js +289 -289
- package/build/plugin/rules/prefer-interface-over-duplicate-types.d.ts +3 -3
- package/build/plugin/rules/prefer-interface-over-duplicate-types.js +264 -264
- package/build/plugin/rules/require-jsdoc-description.d.ts +3 -3
- package/build/plugin/rules/require-jsdoc-description.js +496 -496
- package/build/plugin/rules/require-test-description-prefix.d.ts +3 -3
- package/build/plugin/rules/require-test-description-prefix.js +135 -135
- package/build/plugin/rules/ts/data-model-extends.d.ts +8 -8
- package/build/plugin/rules/ts/data-model-extends.js +94 -94
- package/build/plugin/rules/ts/no-any-type.d.ts +8 -8
- package/build/plugin/rules/ts/no-any-type.js +36 -36
- package/build/plugin/rules/ts/no-as-cast.d.ts +8 -8
- package/build/plugin/rules/ts/no-as-cast.js +49 -49
- package/build/plugin/rules/ts/no-dynamic-imports.d.ts +8 -8
- package/build/plugin/rules/ts/no-dynamic-imports.js +50 -50
- package/build/plugin/rules/ts/no-native-browser-dialogs.d.ts +8 -8
- package/build/plugin/rules/ts/no-native-browser-dialogs.js +78 -78
- package/build/plugin/rules/ts/no-plain-function-export.d.ts +9 -9
- package/build/plugin/rules/ts/no-plain-function-export.js +69 -69
- package/build/plugin/rules/ts/one-export-per-file.d.ts +8 -8
- package/build/plugin/rules/ts/one-export-per-file.js +73 -73
- package/build/scripts/dynamo-fix.d.ts +26 -26
- package/build/scripts/dynamo-fix.js +146 -146
- package/build/scripts/dynamo-fix.js.map +1 -1
- package/build/scripts/eslintrc-audit.d.ts +26 -26
- package/build/scripts/eslintrc-audit.js +100 -100
- package/build/scripts/fix-return-types.d.ts +74 -74
- package/build/scripts/fix-return-types.js +226 -226
- package/build/scripts/validate-imports.d.ts +26 -26
- package/build/scripts/validate-imports.js +157 -137
- package/build/scripts/validate-imports.js.map +1 -1
- package/build/scripts/validate-naming.d.ts +26 -26
- package/build/scripts/validate-naming.js +157 -123
- package/build/scripts/validate-naming.js.map +1 -1
- package/eslint.config.js +15 -15
- package/package.json +105 -105
- package/samples/.vscode/settings.json +13 -13
- package/samples/base/.eslintrc.json +6 -6
- package/samples/base/eslint.config.js +3 -3
- package/samples/fsm/.eslintrc.json +4 -4
- package/samples/fsm/eslint.config.js +3 -3
- package/samples/ngx/.eslintrc.json +6 -6
- package/samples/ngx/eslint.config.js +3 -3
- package/samples/ngx-package/.eslintrc.json +4 -4
- package/samples/ngx-package/eslint.config.js +3 -3
- package/samples/nts/.eslintrc.json +6 -6
- package/samples/nts/eslint.config.js +3 -3
- package/samples/nts-package/.eslintrc.json +4 -4
- package/samples/nts-package/eslint.config.js +3 -3
- package/samples/package.json.example +26 -26
- package/samples/poc-sample.ts +38 -38
- package/samples/poc-violations.ts +54 -54
- package/scripts/run-coverage-tests.js +24 -24
- package/spec/support/helpers/ts-node-helper.js +9 -9
- package/spec/support/jasmine.coverage.json +23 -23
- package/spec/support/jasmine.json +24 -24
- package/src/configs/base.ts +157 -157
- package/src/configs/fsm.ts +10 -10
- package/src/configs/ngx-package.ts +10 -10
- package/src/configs/ngx.ts +96 -96
- package/src/configs/nts-package.ts +20 -20
- package/src/configs/nts.ts +34 -34
- package/src/index.ts +4 -4
- package/src/plugin/index.ts +86 -86
- package/src/plugin/rules/angular/angular-for-track-logic.spec.ts +44 -44
- package/src/plugin/rules/angular/angular-for-track-logic.ts +88 -88
- package/src/plugin/rules/angular/effect-signal-loop.spec.ts +89 -89
- package/src/plugin/rules/angular/effect-signal-loop.ts +125 -125
- package/src/plugin/rules/angular/no-async-ngoninit.spec.ts +50 -50
- package/src/plugin/rules/angular/no-async-ngoninit.ts +43 -43
- package/src/plugin/rules/angular/no-component-direct-api.spec.ts +78 -78
- package/src/plugin/rules/angular/no-component-direct-api.ts +82 -82
- package/src/plugin/rules/angular/no-method-call-in-template.spec.ts +63 -63
- package/src/plugin/rules/angular/no-method-call-in-template.ts +89 -89
- package/src/plugin/rules/angular/no-ngfor-directive.spec.ts +44 -44
- package/src/plugin/rules/angular/no-ngfor-directive.ts +62 -62
- package/src/plugin/rules/angular/no-ngif-directive.spec.ts +44 -44
- package/src/plugin/rules/angular/no-ngif-directive.ts +62 -62
- package/src/plugin/rules/explicit-types.spec.ts +190 -190
- package/src/plugin/rules/explicit-types.ts +186 -186
- package/src/plugin/rules/import/import-order.spec.ts +219 -219
- package/src/plugin/rules/import/import-order.ts +197 -197
- package/src/plugin/rules/import/no-import-type.spec.ts +69 -69
- package/src/plugin/rules/import/no-import-type.ts +46 -46
- package/src/plugin/rules/import/no-js-import.spec.ts +82 -82
- package/src/plugin/rules/import/no-js-import.ts +45 -45
- package/src/plugin/rules/naming-patterns.spec.ts +189 -127
- package/src/plugin/rules/naming-patterns.ts +426 -408
- package/src/plugin/rules/no-getter-logic.spec.ts +591 -591
- package/src/plugin/rules/no-getter-logic.ts +220 -220
- package/src/plugin/rules/prefer-enum-over-string-union.spec.ts +583 -583
- package/src/plugin/rules/prefer-enum-over-string-union.ts +333 -333
- package/src/plugin/rules/prefer-interface-over-duplicate-types.spec.ts +404 -404
- package/src/plugin/rules/prefer-interface-over-duplicate-types.ts +314 -314
- package/src/plugin/rules/require-jsdoc-description.spec.ts +779 -779
- package/src/plugin/rules/require-jsdoc-description.ts +572 -572
- package/src/plugin/rules/require-test-description-prefix.spec.ts +459 -459
- package/src/plugin/rules/require-test-description-prefix.ts +154 -154
- package/src/plugin/rules/ts/data-model-extends.spec.ts +84 -84
- package/src/plugin/rules/ts/data-model-extends.ts +100 -100
- package/src/plugin/rules/ts/no-any-type.spec.ts +28 -28
- package/src/plugin/rules/ts/no-any-type.ts +36 -36
- package/src/plugin/rules/ts/no-as-cast.spec.ts +51 -51
- package/src/plugin/rules/ts/no-as-cast.ts +51 -51
- package/src/plugin/rules/ts/no-dynamic-imports.spec.ts +54 -54
- package/src/plugin/rules/ts/no-dynamic-imports.ts +49 -49
- package/src/plugin/rules/ts/no-native-browser-dialogs.spec.ts +54 -54
- package/src/plugin/rules/ts/no-native-browser-dialogs.ts +84 -84
- package/src/plugin/rules/ts/no-plain-function-export.spec.ts +72 -72
- package/src/plugin/rules/ts/no-plain-function-export.ts +73 -73
- package/src/plugin/rules/ts/one-export-per-file.spec.ts +64 -64
- package/src/plugin/rules/ts/one-export-per-file.ts +77 -77
- package/src/scripts/dynamo-fix.ts +172 -172
- package/src/scripts/eslintrc-audit.ts +116 -116
- package/src/scripts/fix-return-types.spec.ts +65 -65
- package/src/scripts/fix-return-types.ts +288 -288
- package/src/scripts/validate-imports.ts +278 -249
- package/src/scripts/validate-naming.ts +204 -176
- package/src/scripts/validator-cli.integration.spec.ts +96 -0
- package/tsconfig.json +31 -31
|
@@ -1,408 +1,426 @@
|
|
|
1
|
-
import * as path from 'path';
|
|
2
|
-
import { Rule } from 'eslint';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Konfigurálható al-ellenőrzések — alapból minden bekapcsolva.
|
|
6
|
-
* Eredete: CCAP "naming/*" review-k (boolean-is-prefix, signal-postfix, rxjs-postfix,
|
|
7
|
-
* file-class-postfix, enum-value-format, service-property-postfix,
|
|
8
|
-
* file-class-name-consistency).
|
|
9
|
-
*/
|
|
10
|
-
interface NamingChecksOptions {
|
|
11
|
-
booleanIsPrefix?: boolean;
|
|
12
|
-
signalPostfix?: boolean;
|
|
13
|
-
rxjsPostfix?: boolean;
|
|
14
|
-
fileClassPostfix?: boolean;
|
|
15
|
-
enumValueFormat?: boolean;
|
|
16
|
-
servicePropertyPostfix?: boolean;
|
|
17
|
-
fileClassNameConsistency?: boolean;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Fájlminta → kötelező class postfix leképezés (CCAP file-class-postfix).
|
|
22
|
-
*/
|
|
23
|
-
const FILE_POSTFIX_MAP: { pattern: RegExp; classPostfix: string; entitySuffix: string }[] = [
|
|
24
|
-
{ pattern: /\.data-model\.ts$/, classPostfix: '_DataModel', entitySuffix: '.data-model.ts' },
|
|
25
|
-
{ pattern: /\.control-model\.ts$/, classPostfix: '_ControlModel', entitySuffix: '.control-model.ts' },
|
|
26
|
-
{ pattern: /\.control-service\.ts$/, classPostfix: '_ControlService', entitySuffix: '.control-service.ts' },
|
|
27
|
-
{ pattern: /\.data-service\.ts$/, classPostfix: '_DataService', entitySuffix: '.data-service.ts' },
|
|
28
|
-
{ pattern: /\.api-service\.ts$/, classPostfix: '_ApiService', entitySuffix: '.api-service.ts' },
|
|
29
|
-
{ pattern: /\.util-service\.ts$/, classPostfix: '_Util', entitySuffix: '.util-service.ts' },
|
|
30
|
-
{ pattern: /\.service-base\.ts$/, classPostfix: '_ServiceBase', entitySuffix: '.service-base.ts' },
|
|
31
|
-
{ pattern: /\.controller\.ts$/, classPostfix: '_Controller', entitySuffix: '.controller.ts' },
|
|
32
|
-
{ pattern: /\.component\.ts$/, classPostfix: '_Component', entitySuffix: '.component.ts' },
|
|
33
|
-
{ pattern: /\.pipe\.ts$/, classPostfix: '_Pipe', entitySuffix: '.pipe.ts' },
|
|
34
|
-
{ pattern: /\.directive\.ts$/, classPostfix: '_Directive', entitySuffix: '.directive.ts' },
|
|
35
|
-
{ pattern: /\.module\.ts$/, classPostfix: '_Module', entitySuffix: '.module.ts' },
|
|
36
|
-
];
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
];
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
*/
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
*
|
|
83
|
-
*/
|
|
84
|
-
function
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
return
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
1
|
+
import * as path from 'path';
|
|
2
|
+
import { Rule } from 'eslint';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Konfigurálható al-ellenőrzések — alapból minden bekapcsolva.
|
|
6
|
+
* Eredete: CCAP "naming/*" review-k (boolean-is-prefix, signal-postfix, rxjs-postfix,
|
|
7
|
+
* file-class-postfix, enum-value-format, service-property-postfix,
|
|
8
|
+
* file-class-name-consistency).
|
|
9
|
+
*/
|
|
10
|
+
interface NamingChecksOptions {
|
|
11
|
+
booleanIsPrefix?: boolean;
|
|
12
|
+
signalPostfix?: boolean;
|
|
13
|
+
rxjsPostfix?: boolean;
|
|
14
|
+
fileClassPostfix?: boolean;
|
|
15
|
+
enumValueFormat?: boolean;
|
|
16
|
+
servicePropertyPostfix?: boolean;
|
|
17
|
+
fileClassNameConsistency?: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Fájlminta → kötelező class postfix leképezés (CCAP file-class-postfix).
|
|
22
|
+
*/
|
|
23
|
+
const FILE_POSTFIX_MAP: { pattern: RegExp; classPostfix: string; entitySuffix: string }[] = [
|
|
24
|
+
{ pattern: /\.data-model\.ts$/, classPostfix: '_DataModel', entitySuffix: '.data-model.ts' },
|
|
25
|
+
{ pattern: /\.control-model\.ts$/, classPostfix: '_ControlModel', entitySuffix: '.control-model.ts' },
|
|
26
|
+
{ pattern: /\.control-service\.ts$/, classPostfix: '_ControlService', entitySuffix: '.control-service.ts' },
|
|
27
|
+
{ pattern: /\.data-service\.ts$/, classPostfix: '_DataService', entitySuffix: '.data-service.ts' },
|
|
28
|
+
{ pattern: /\.api-service\.ts$/, classPostfix: '_ApiService', entitySuffix: '.api-service.ts' },
|
|
29
|
+
{ pattern: /\.util-service\.ts$/, classPostfix: '_Util', entitySuffix: '.util-service.ts' },
|
|
30
|
+
{ pattern: /\.service-base\.ts$/, classPostfix: '_ServiceBase', entitySuffix: '.service-base.ts' },
|
|
31
|
+
{ pattern: /\.controller\.ts$/, classPostfix: '_Controller', entitySuffix: '.controller.ts' },
|
|
32
|
+
{ pattern: /\.component\.ts$/, classPostfix: '_Component', entitySuffix: '.component.ts' },
|
|
33
|
+
{ pattern: /\.pipe\.ts$/, classPostfix: '_Pipe', entitySuffix: '.pipe.ts' },
|
|
34
|
+
{ pattern: /\.directive\.ts$/, classPostfix: '_Directive', entitySuffix: '.directive.ts' },
|
|
35
|
+
{ pattern: /\.module\.ts$/, classPostfix: '_Module', entitySuffix: '.module.ts' },
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* BFR-ADVENTOR-018: kanonikus, a service-property-postfix kényszer ALÓL KIVETT property-nevek.
|
|
40
|
+
* Az `ls` a flotta bevett nyelv-service mintája (`readonly ls = inject(A_Language_ControlService)`;
|
|
41
|
+
* a template-ekben `{{ ls.llt.… }}`) — a szabály eddig a bedrock SAJÁT dokumentált
|
|
42
|
+
* konzumens-mintáját flagelte. Projekt-szinten bővíthető az `allowedPropertyNames` opcióval.
|
|
43
|
+
*/
|
|
44
|
+
const DEFAULT_ALLOWED_PROPERTY_NAMES: string[] = [ 'ls' ];
|
|
45
|
+
|
|
46
|
+
/** Service class postfix → kötelező inject property postfix leképezés (CCAP service-property-postfix). */
|
|
47
|
+
const SERVICE_INJECT_POSTFIX_MAP: { classPostfix: string; propertyPostfix: string }[] = [
|
|
48
|
+
{ classPostfix: '_DataService', propertyPostfix: '_DS' },
|
|
49
|
+
{ classPostfix: '_ControlService', propertyPostfix: '_CS' },
|
|
50
|
+
{ classPostfix: '_ApiService', propertyPostfix: '_AS' },
|
|
51
|
+
{ classPostfix: '_MasterService', propertyPostfix: '_MS' },
|
|
52
|
+
];
|
|
53
|
+
|
|
54
|
+
/** Signal factory függvény nevek (CCAP signal-postfix). */
|
|
55
|
+
const SIGNAL_FACTORY_NAMES: Set<string> = new Set<string>([ 'signal', 'computed', 'toSignal' ]);
|
|
56
|
+
|
|
57
|
+
/** RxJS típusnevek detektáláshoz. */
|
|
58
|
+
const RXJS_BEHAVIOR_SUBJECT_NAME: string = 'BehaviorSubject';
|
|
59
|
+
const RXJS_SUBJECT_NAME: string = 'Subject';
|
|
60
|
+
const RXJS_OBSERVABLE_NAME: string = 'Observable';
|
|
61
|
+
|
|
62
|
+
/** camelCase enum kulcs regex. */
|
|
63
|
+
const CAMEL_CASE_KEY_REGEX: RegExp = /^[a-z][a-zA-Z0-9]*$/;
|
|
64
|
+
|
|
65
|
+
/** kebab-case enum érték regex. */
|
|
66
|
+
const KEBAB_CASE_VALUE_REGEX: RegExp = /^[a-z0-9][a-z0-9-]*$/;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* PascalCase szót kebab-case-re konvertál (CCAP file-class-name-consistency).
|
|
70
|
+
*/
|
|
71
|
+
function pascalPartToKebab(str: string): string {
|
|
72
|
+
if (str === str.toUpperCase() && str.length > 1) {
|
|
73
|
+
return str.toLowerCase();
|
|
74
|
+
}
|
|
75
|
+
return str
|
|
76
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1-$2')
|
|
77
|
+
.replace(/([A-Z]+)([A-Z][a-z])/g, '$1-$2')
|
|
78
|
+
.toLowerCase();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Class entity nevet kebab-case fájlnév entity részére konvertál.
|
|
83
|
+
*/
|
|
84
|
+
function classEntityToKebab(classEntity: string): string {
|
|
85
|
+
const parts: string[] = classEntity.split('_').filter((p: string): boolean => p.length > 0);
|
|
86
|
+
return parts.map(pascalPartToKebab).join('-');
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Megnézi, hogy a property type-annotation `boolean`-e.
|
|
91
|
+
*/
|
|
92
|
+
function isBooleanType(typeAnnotation: any): boolean {
|
|
93
|
+
if (!typeAnnotation || !typeAnnotation.typeAnnotation) {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
return typeAnnotation.typeAnnotation.type === 'TSBooleanKeyword';
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Megnézi, hogy a property init signal/computed/toSignal hívás-e.
|
|
101
|
+
*/
|
|
102
|
+
function isSignalFactoryCall(init: any): boolean {
|
|
103
|
+
if (!init || init.type !== 'CallExpression') {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
const callee: any = init.callee;
|
|
107
|
+
if (!callee || callee.type !== 'Identifier') {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
return SIGNAL_FACTORY_NAMES.has(callee.name);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Detektálja az RxJS típust property type-annotation vagy `new XSubject()` init alapján.
|
|
115
|
+
*/
|
|
116
|
+
function detectRxjsKind(typeAnnotation: any, init: any): 'BS' | 'S' | 'OBS' | null {
|
|
117
|
+
const typeName: string | null = (() => {
|
|
118
|
+
if (!typeAnnotation || !typeAnnotation.typeAnnotation) {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
const t: any = typeAnnotation.typeAnnotation;
|
|
122
|
+
if (t.type !== 'TSTypeReference' || !t.typeName) {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
if (t.typeName.type === 'Identifier') {
|
|
126
|
+
return t.typeName.name;
|
|
127
|
+
}
|
|
128
|
+
return null;
|
|
129
|
+
})();
|
|
130
|
+
|
|
131
|
+
const newName: string | null = (() => {
|
|
132
|
+
if (!init || init.type !== 'NewExpression' || !init.callee || init.callee.type !== 'Identifier') {
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
return init.callee.name;
|
|
136
|
+
})();
|
|
137
|
+
|
|
138
|
+
const candidate: string | null = typeName ?? newName;
|
|
139
|
+
if (candidate === null) {
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
if (candidate === RXJS_BEHAVIOR_SUBJECT_NAME) {
|
|
143
|
+
return 'BS';
|
|
144
|
+
}
|
|
145
|
+
if (candidate === RXJS_SUBJECT_NAME) {
|
|
146
|
+
return 'S';
|
|
147
|
+
}
|
|
148
|
+
if (candidate === RXJS_OBSERVABLE_NAME) {
|
|
149
|
+
return 'OBS';
|
|
150
|
+
}
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Detektálja, hogy az init `inject(SomeService)` hívás-e — visszaadja a service nevet.
|
|
156
|
+
*/
|
|
157
|
+
function detectInjectedService(init: any): string | null {
|
|
158
|
+
if (!init || init.type !== 'CallExpression') {
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
if (!init.callee || init.callee.type !== 'Identifier' || init.callee.name !== 'inject') {
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
const arg: any = init.arguments && init.arguments[0];
|
|
165
|
+
if (!arg || arg.type !== 'Identifier') {
|
|
166
|
+
return null;
|
|
167
|
+
}
|
|
168
|
+
return arg.name;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Property kulcs név szöveggé alakítása.
|
|
173
|
+
*/
|
|
174
|
+
function getPropertyKeyName(node: any): string | null {
|
|
175
|
+
if (node.key && node.key.type === 'Identifier' && node.key.name) {
|
|
176
|
+
return node.key.name;
|
|
177
|
+
}
|
|
178
|
+
return null;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Naming-patterns szabály (CCAP-megerősített): 7 al-ellenőrzés a CCAP "naming/*" review-kből.
|
|
183
|
+
* Minden al-ellenőrzés külön-külön kapcsolható a `checks` schema option-nel.
|
|
184
|
+
*/
|
|
185
|
+
const rule: Rule.RuleModule = {
|
|
186
|
+
meta: {
|
|
187
|
+
type: 'suggestion',
|
|
188
|
+
docs: {
|
|
189
|
+
description: 'Enforce Dynamo naming conventions (CCAP-derived sub-checks).',
|
|
190
|
+
recommended: true,
|
|
191
|
+
},
|
|
192
|
+
schema: [
|
|
193
|
+
{
|
|
194
|
+
type: 'object',
|
|
195
|
+
properties: {
|
|
196
|
+
checks: {
|
|
197
|
+
type: 'object',
|
|
198
|
+
properties: {
|
|
199
|
+
booleanIsPrefix: { type: 'boolean' },
|
|
200
|
+
signalPostfix: { type: 'boolean' },
|
|
201
|
+
rxjsPostfix: { type: 'boolean' },
|
|
202
|
+
fileClassPostfix: { type: 'boolean' },
|
|
203
|
+
enumValueFormat: { type: 'boolean' },
|
|
204
|
+
servicePropertyPostfix: { type: 'boolean' },
|
|
205
|
+
fileClassNameConsistency: { type: 'boolean' },
|
|
206
|
+
},
|
|
207
|
+
additionalProperties: false,
|
|
208
|
+
},
|
|
209
|
+
allowedPropertyNames: {
|
|
210
|
+
type: 'array',
|
|
211
|
+
items: { type: 'string' },
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
additionalProperties: false,
|
|
215
|
+
},
|
|
216
|
+
],
|
|
217
|
+
messages: {
|
|
218
|
+
booleanIsPrefix: 'Boolean property `{{name}}` nem `is`-sel kezdődik.',
|
|
219
|
+
signalPostfix: 'Signal változó `{{name}}` nem végződik `_$`-re.',
|
|
220
|
+
rxjsBsPostfix: '`BehaviorSubject` mező `{{name}}` nem végződik `_BS`-re.',
|
|
221
|
+
rxjsSPostfix: '`Subject` mező `{{name}}` nem végződik `_S`-re.',
|
|
222
|
+
rxjsObsPostfix: '`Observable` mező `{{name}}` nem végződik `$`-re.',
|
|
223
|
+
fileClassPostfix:
|
|
224
|
+
'Osztály `{{className}}` nem végződik `{{requiredPostfix}}`-re (fájlminta: {{fileName}}).',
|
|
225
|
+
enumKeyCamel: 'Enum kulcs `{{keyName}}` nem camelCase.',
|
|
226
|
+
enumValueKebab: 'Enum érték `{{value}}` nem kebab-case.',
|
|
227
|
+
servicePropertyPostfix:
|
|
228
|
+
'Property `{{property}}` `{{service}}`-t inject-el, de nem végződik `{{requiredPostfix}}`-re.',
|
|
229
|
+
fileClassNameConsistency:
|
|
230
|
+
'Osztály `{{className}}` entity része `{{classEntity}}` → '
|
|
231
|
+
+ 'elvárt fájlnév entity: `{{expected}}`, de a tényleges: `{{actual}}`.',
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
create(context: Rule.RuleContext): Rule.RuleListener {
|
|
235
|
+
const filename: string = context.filename ?? '';
|
|
236
|
+
const baseName: string = path.basename(filename);
|
|
237
|
+
if (baseName.endsWith('.spec.ts') || baseName.endsWith('.test.ts') || baseName.endsWith('.d.ts')) {
|
|
238
|
+
return {};
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
const userOptions: { checks?: NamingChecksOptions; allowedPropertyNames?: string[] } =
|
|
242
|
+
(context.options[0] ?? {}) as { checks?: NamingChecksOptions; allowedPropertyNames?: string[] };
|
|
243
|
+
const checks: NamingChecksOptions = userOptions.checks ?? {};
|
|
244
|
+
const isOn = (key: keyof NamingChecksOptions): boolean => checks[key] !== false;
|
|
245
|
+
// BFR-ADVENTOR-018: beépített kanonikus kivételek + projekt-szintű bővítés
|
|
246
|
+
const allowedPropertyNames: string[] = [
|
|
247
|
+
...DEFAULT_ALLOWED_PROPERTY_NAMES,
|
|
248
|
+
...(userOptions.allowedPropertyNames ?? []),
|
|
249
|
+
];
|
|
250
|
+
|
|
251
|
+
const filePostfixRule: { pattern: RegExp; classPostfix: string; entitySuffix: string } | undefined =
|
|
252
|
+
FILE_POSTFIX_MAP.find(
|
|
253
|
+
(r: { pattern: RegExp; classPostfix: string; entitySuffix: string }): boolean =>
|
|
254
|
+
r.pattern.test(baseName),
|
|
255
|
+
);
|
|
256
|
+
|
|
257
|
+
return {
|
|
258
|
+
PropertyDefinition(node: any): void {
|
|
259
|
+
try {
|
|
260
|
+
const propName: string | null = getPropertyKeyName(node);
|
|
261
|
+
if (propName === null) {
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
if (
|
|
266
|
+
isOn('booleanIsPrefix')
|
|
267
|
+
&& isBooleanType(node.typeAnnotation)
|
|
268
|
+
&& !propName.startsWith('is')
|
|
269
|
+
&& !propName.endsWith('_$')
|
|
270
|
+
) {
|
|
271
|
+
context.report({
|
|
272
|
+
node: node.key,
|
|
273
|
+
messageId: 'booleanIsPrefix',
|
|
274
|
+
data: { name: propName },
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
if (
|
|
279
|
+
isOn('signalPostfix')
|
|
280
|
+
&& isSignalFactoryCall(node.value)
|
|
281
|
+
&& !propName.endsWith('_$')
|
|
282
|
+
) {
|
|
283
|
+
context.report({
|
|
284
|
+
node: node.key,
|
|
285
|
+
messageId: 'signalPostfix',
|
|
286
|
+
data: { name: propName },
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
if (isOn('rxjsPostfix')) {
|
|
291
|
+
const rxKind: 'BS' | 'S' | 'OBS' | null = detectRxjsKind(node.typeAnnotation, node.value);
|
|
292
|
+
if (rxKind === 'BS' && !propName.endsWith('_BS')) {
|
|
293
|
+
context.report({ node: node.key, messageId: 'rxjsBsPostfix', data: { name: propName } });
|
|
294
|
+
} else if (rxKind === 'S' && !propName.endsWith('_S') && !propName.endsWith('_BS')) {
|
|
295
|
+
context.report({ node: node.key, messageId: 'rxjsSPostfix', data: { name: propName } });
|
|
296
|
+
} else if (rxKind === 'OBS' && !propName.endsWith('$')) {
|
|
297
|
+
context.report({ node: node.key, messageId: 'rxjsObsPostfix', data: { name: propName } });
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
if (isOn('servicePropertyPostfix') && !allowedPropertyNames.includes(propName)) {
|
|
302
|
+
const injectedService: string | null = detectInjectedService(node.value);
|
|
303
|
+
if (injectedService !== null) {
|
|
304
|
+
for (const mapping of SERVICE_INJECT_POSTFIX_MAP) {
|
|
305
|
+
if (
|
|
306
|
+
injectedService.endsWith(mapping.classPostfix)
|
|
307
|
+
&& !propName.endsWith(mapping.propertyPostfix)
|
|
308
|
+
) {
|
|
309
|
+
context.report({
|
|
310
|
+
node: node.key,
|
|
311
|
+
messageId: 'servicePropertyPostfix',
|
|
312
|
+
data: {
|
|
313
|
+
property: propName,
|
|
314
|
+
service: injectedService,
|
|
315
|
+
requiredPostfix: mapping.propertyPostfix,
|
|
316
|
+
},
|
|
317
|
+
});
|
|
318
|
+
break;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
} catch (error) {
|
|
324
|
+
console.error('[naming-patterns] Error in PropertyDefinition visitor:', error);
|
|
325
|
+
}
|
|
326
|
+
},
|
|
327
|
+
|
|
328
|
+
ClassDeclaration(node: any): void {
|
|
329
|
+
try {
|
|
330
|
+
if (!node.id || !node.id.name || !filePostfixRule) {
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
const className: string = node.id.name;
|
|
334
|
+
|
|
335
|
+
if (isOn('fileClassPostfix') && !className.endsWith(filePostfixRule.classPostfix)) {
|
|
336
|
+
context.report({
|
|
337
|
+
node: node.id,
|
|
338
|
+
messageId: 'fileClassPostfix',
|
|
339
|
+
data: {
|
|
340
|
+
className: className,
|
|
341
|
+
requiredPostfix: filePostfixRule.classPostfix,
|
|
342
|
+
fileName: baseName,
|
|
343
|
+
},
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
if (isOn('fileClassNameConsistency') && className.endsWith(filePostfixRule.classPostfix)) {
|
|
348
|
+
const fileEntity: string = baseName.slice(
|
|
349
|
+
0,
|
|
350
|
+
baseName.length - filePostfixRule.entitySuffix.length,
|
|
351
|
+
);
|
|
352
|
+
const classEntity: string = className.slice(
|
|
353
|
+
0,
|
|
354
|
+
className.length - filePostfixRule.classPostfix.length,
|
|
355
|
+
);
|
|
356
|
+
const expectedFull: string = classEntityToKebab(classEntity);
|
|
357
|
+
const firstUnderscoreIdx: number = classEntity.indexOf('_');
|
|
358
|
+
const expectedWithoutPrefix: string = firstUnderscoreIdx > 0
|
|
359
|
+
? classEntityToKebab(classEntity.slice(firstUnderscoreIdx + 1))
|
|
360
|
+
: '';
|
|
361
|
+
const isMatch: boolean = expectedFull === fileEntity || expectedWithoutPrefix === fileEntity;
|
|
362
|
+
if (!isMatch && classEntity.length > 0) {
|
|
363
|
+
context.report({
|
|
364
|
+
node: node.id,
|
|
365
|
+
messageId: 'fileClassNameConsistency',
|
|
366
|
+
data: {
|
|
367
|
+
className: className,
|
|
368
|
+
classEntity: classEntity,
|
|
369
|
+
expected: expectedFull + (expectedWithoutPrefix ? ` vagy ${expectedWithoutPrefix}` : ''),
|
|
370
|
+
actual: fileEntity,
|
|
371
|
+
},
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
} catch (error) {
|
|
376
|
+
console.error('[naming-patterns] Error in ClassDeclaration visitor:', error);
|
|
377
|
+
}
|
|
378
|
+
},
|
|
379
|
+
|
|
380
|
+
TSEnumDeclaration(node: any): void {
|
|
381
|
+
try {
|
|
382
|
+
if (!isOn('enumValueFormat')) {
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
if (!baseName.endsWith('.type-enum.ts')) {
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
const members: any[] = node.members ?? [];
|
|
389
|
+
for (const member of members) {
|
|
390
|
+
const keyName: string | null = (member.id && member.id.name) ? member.id.name : null;
|
|
391
|
+
const initializer: any = member.initializer;
|
|
392
|
+
if (keyName === null) {
|
|
393
|
+
continue;
|
|
394
|
+
}
|
|
395
|
+
if (!CAMEL_CASE_KEY_REGEX.test(keyName)) {
|
|
396
|
+
context.report({
|
|
397
|
+
node: member.id,
|
|
398
|
+
messageId: 'enumKeyCamel',
|
|
399
|
+
data: { keyName: keyName },
|
|
400
|
+
});
|
|
401
|
+
continue;
|
|
402
|
+
}
|
|
403
|
+
if (
|
|
404
|
+
initializer
|
|
405
|
+
&& initializer.type === 'Literal'
|
|
406
|
+
&& typeof initializer.value === 'string'
|
|
407
|
+
) {
|
|
408
|
+
const value: string = initializer.value;
|
|
409
|
+
if (!KEBAB_CASE_VALUE_REGEX.test(value)) {
|
|
410
|
+
context.report({
|
|
411
|
+
node: initializer,
|
|
412
|
+
messageId: 'enumValueKebab',
|
|
413
|
+
data: { value: value },
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
} catch (error) {
|
|
419
|
+
console.error('[naming-patterns] Error in TSEnumDeclaration visitor:', error);
|
|
420
|
+
}
|
|
421
|
+
},
|
|
422
|
+
};
|
|
423
|
+
},
|
|
424
|
+
};
|
|
425
|
+
|
|
426
|
+
export default rule;
|