@futdevpro/dynamo-eslint 1.15.25 → 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.
Files changed (194) hide show
  1. package/.c8rc.json +26 -26
  2. package/.cursor/rules/__assistant_guide.mdc +30 -30
  3. package/.cursor/rules/__main.mdc +64 -64
  4. package/.cursor/rules/_ag_backend-structure.mdc +85 -85
  5. package/.cursor/rules/_ag_backend.mdc +16 -16
  6. package/.cursor/rules/_ag_debug.mdc +7 -7
  7. package/.cursor/rules/_ag_documentation_writing_rules.mdc +372 -372
  8. package/.cursor/rules/_ag_file-refactoring.mdc +113 -113
  9. package/.cursor/rules/_ag_fixes_rules.mdc +5 -5
  10. package/.cursor/rules/_ag_frontend-structure.mdc +86 -86
  11. package/.cursor/rules/_ag_frontend.mdc +39 -39
  12. package/.cursor/rules/_ag_import-rules.mdc +44 -44
  13. package/.cursor/rules/_ag_naming.mdc +115 -115
  14. package/.cursor/rules/_ag_running_commands.mdc +4 -4
  15. package/.cursor/rules/_ag_server-controller.mdc +5 -5
  16. package/.cursor/rules/_ag_should-be.mdc +6 -6
  17. package/.cursor/rules/_ag_swearing.mdc +47 -47
  18. package/.cursor/rules/ai_development_guide.md +60 -60
  19. package/.cursor/rules/ai_directives.md +114 -114
  20. package/.cursor/rules/cursor-rules.md +160 -160
  21. package/.cursor/rules/default-command.mdc +464 -464
  22. package/.cursor/rules/error_code_pattern.md +39 -39
  23. package/.cursor/rules/saved rule mcp server use.md +15 -15
  24. package/.dynamo/pipeline.cicd.config.json +184 -184
  25. package/.dynamo/version-bump.config.json +5 -5
  26. package/.eslintrc.json +4 -4
  27. package/.github/workflows/main.yml +436 -436
  28. package/.husky/pre-commit +2 -2
  29. package/.vscode/settings.json +11 -11
  30. package/README.md +319 -319
  31. package/__documentations/2026-04-18-ccap-review-integration.md +173 -173
  32. package/__documentations/2026-08-18-bfr-ctm-005-eslint9-validator-report.md +45 -0
  33. package/build/configs/base.d.ts +9 -9
  34. package/build/configs/base.js +150 -150
  35. package/build/configs/fsm.d.ts +1 -1
  36. package/build/configs/fsm.js +7 -7
  37. package/build/configs/ngx-package.d.ts +1 -1
  38. package/build/configs/ngx-package.js +7 -7
  39. package/build/configs/ngx.d.ts +4 -4
  40. package/build/configs/ngx.js +91 -91
  41. package/build/configs/nts-package.d.ts +1 -1
  42. package/build/configs/nts-package.js +17 -17
  43. package/build/configs/nts.d.ts +1 -1
  44. package/build/configs/nts.js +31 -31
  45. package/build/index.d.ts +1 -1
  46. package/build/index.js +2 -2
  47. package/build/plugin/index.d.ts +52 -52
  48. package/build/plugin/index.js +80 -80
  49. package/build/plugin/rules/angular/angular-for-track-logic.d.ts +7 -7
  50. package/build/plugin/rules/angular/angular-for-track-logic.js +81 -81
  51. package/build/plugin/rules/angular/effect-signal-loop.d.ts +9 -9
  52. package/build/plugin/rules/angular/effect-signal-loop.js +112 -112
  53. package/build/plugin/rules/angular/no-async-ngoninit.d.ts +8 -8
  54. package/build/plugin/rules/angular/no-async-ngoninit.js +42 -42
  55. package/build/plugin/rules/angular/no-component-direct-api.d.ts +9 -9
  56. package/build/plugin/rules/angular/no-component-direct-api.js +75 -75
  57. package/build/plugin/rules/angular/no-method-call-in-template.d.ts +8 -8
  58. package/build/plugin/rules/angular/no-method-call-in-template.js +79 -79
  59. package/build/plugin/rules/angular/no-ngfor-directive.d.ts +7 -7
  60. package/build/plugin/rules/angular/no-ngfor-directive.js +59 -59
  61. package/build/plugin/rules/angular/no-ngif-directive.d.ts +7 -7
  62. package/build/plugin/rules/angular/no-ngif-directive.js +59 -59
  63. package/build/plugin/rules/explicit-types.d.ts +3 -3
  64. package/build/plugin/rules/explicit-types.js +178 -178
  65. package/build/plugin/rules/import/import-order.d.ts +3 -3
  66. package/build/plugin/rules/import/import-order.js +154 -154
  67. package/build/plugin/rules/import/no-import-type.d.ts +3 -3
  68. package/build/plugin/rules/import/no-import-type.js +45 -45
  69. package/build/plugin/rules/import/no-js-import.d.ts +3 -3
  70. package/build/plugin/rules/import/no-js-import.js +40 -40
  71. package/build/plugin/rules/naming-patterns.d.ts +7 -7
  72. package/build/plugin/rules/naming-patterns.js +366 -366
  73. package/build/plugin/rules/no-getter-logic.d.ts +3 -3
  74. package/build/plugin/rules/no-getter-logic.js +194 -194
  75. package/build/plugin/rules/prefer-enum-over-string-union.d.ts +3 -3
  76. package/build/plugin/rules/prefer-enum-over-string-union.js +289 -289
  77. package/build/plugin/rules/prefer-interface-over-duplicate-types.d.ts +3 -3
  78. package/build/plugin/rules/prefer-interface-over-duplicate-types.js +264 -264
  79. package/build/plugin/rules/require-jsdoc-description.d.ts +3 -3
  80. package/build/plugin/rules/require-jsdoc-description.js +496 -496
  81. package/build/plugin/rules/require-test-description-prefix.d.ts +3 -3
  82. package/build/plugin/rules/require-test-description-prefix.js +135 -135
  83. package/build/plugin/rules/ts/data-model-extends.d.ts +8 -8
  84. package/build/plugin/rules/ts/data-model-extends.js +94 -94
  85. package/build/plugin/rules/ts/no-any-type.d.ts +8 -8
  86. package/build/plugin/rules/ts/no-any-type.js +36 -36
  87. package/build/plugin/rules/ts/no-as-cast.d.ts +8 -8
  88. package/build/plugin/rules/ts/no-as-cast.js +49 -49
  89. package/build/plugin/rules/ts/no-dynamic-imports.d.ts +8 -8
  90. package/build/plugin/rules/ts/no-dynamic-imports.js +50 -50
  91. package/build/plugin/rules/ts/no-native-browser-dialogs.d.ts +8 -8
  92. package/build/plugin/rules/ts/no-native-browser-dialogs.js +78 -78
  93. package/build/plugin/rules/ts/no-plain-function-export.d.ts +9 -9
  94. package/build/plugin/rules/ts/no-plain-function-export.js +69 -69
  95. package/build/plugin/rules/ts/one-export-per-file.d.ts +8 -8
  96. package/build/plugin/rules/ts/one-export-per-file.js +73 -73
  97. package/build/scripts/dynamo-fix.d.ts +26 -26
  98. package/build/scripts/dynamo-fix.js +146 -146
  99. package/build/scripts/eslintrc-audit.d.ts +26 -26
  100. package/build/scripts/eslintrc-audit.js +100 -100
  101. package/build/scripts/fix-return-types.d.ts +74 -74
  102. package/build/scripts/fix-return-types.js +226 -226
  103. package/build/scripts/validate-imports.d.ts +26 -26
  104. package/build/scripts/validate-imports.js +157 -146
  105. package/build/scripts/validate-imports.js.map +1 -1
  106. package/build/scripts/validate-naming.d.ts +26 -26
  107. package/build/scripts/validate-naming.js +157 -131
  108. package/build/scripts/validate-naming.js.map +1 -1
  109. package/eslint.config.js +15 -15
  110. package/package.json +105 -105
  111. package/samples/.vscode/settings.json +13 -13
  112. package/samples/base/.eslintrc.json +6 -6
  113. package/samples/base/eslint.config.js +3 -3
  114. package/samples/fsm/.eslintrc.json +4 -4
  115. package/samples/fsm/eslint.config.js +3 -3
  116. package/samples/ngx/.eslintrc.json +6 -6
  117. package/samples/ngx/eslint.config.js +3 -3
  118. package/samples/ngx-package/.eslintrc.json +4 -4
  119. package/samples/ngx-package/eslint.config.js +3 -3
  120. package/samples/nts/.eslintrc.json +6 -6
  121. package/samples/nts/eslint.config.js +3 -3
  122. package/samples/nts-package/.eslintrc.json +4 -4
  123. package/samples/nts-package/eslint.config.js +3 -3
  124. package/samples/package.json.example +26 -26
  125. package/samples/poc-sample.ts +38 -38
  126. package/samples/poc-violations.ts +54 -54
  127. package/scripts/run-coverage-tests.js +24 -24
  128. package/spec/support/helpers/ts-node-helper.js +9 -9
  129. package/spec/support/jasmine.coverage.json +23 -23
  130. package/spec/support/jasmine.json +24 -24
  131. package/src/configs/base.ts +157 -157
  132. package/src/configs/fsm.ts +10 -10
  133. package/src/configs/ngx-package.ts +10 -10
  134. package/src/configs/ngx.ts +96 -96
  135. package/src/configs/nts-package.ts +20 -20
  136. package/src/configs/nts.ts +34 -34
  137. package/src/index.ts +4 -4
  138. package/src/plugin/index.ts +86 -86
  139. package/src/plugin/rules/angular/angular-for-track-logic.spec.ts +44 -44
  140. package/src/plugin/rules/angular/angular-for-track-logic.ts +88 -88
  141. package/src/plugin/rules/angular/effect-signal-loop.spec.ts +89 -89
  142. package/src/plugin/rules/angular/effect-signal-loop.ts +125 -125
  143. package/src/plugin/rules/angular/no-async-ngoninit.spec.ts +50 -50
  144. package/src/plugin/rules/angular/no-async-ngoninit.ts +43 -43
  145. package/src/plugin/rules/angular/no-component-direct-api.spec.ts +78 -78
  146. package/src/plugin/rules/angular/no-component-direct-api.ts +82 -82
  147. package/src/plugin/rules/angular/no-method-call-in-template.spec.ts +63 -63
  148. package/src/plugin/rules/angular/no-method-call-in-template.ts +89 -89
  149. package/src/plugin/rules/angular/no-ngfor-directive.spec.ts +44 -44
  150. package/src/plugin/rules/angular/no-ngfor-directive.ts +62 -62
  151. package/src/plugin/rules/angular/no-ngif-directive.spec.ts +44 -44
  152. package/src/plugin/rules/angular/no-ngif-directive.ts +62 -62
  153. package/src/plugin/rules/explicit-types.spec.ts +190 -190
  154. package/src/plugin/rules/explicit-types.ts +186 -186
  155. package/src/plugin/rules/import/import-order.spec.ts +219 -219
  156. package/src/plugin/rules/import/import-order.ts +197 -197
  157. package/src/plugin/rules/import/no-import-type.spec.ts +69 -69
  158. package/src/plugin/rules/import/no-import-type.ts +46 -46
  159. package/src/plugin/rules/import/no-js-import.spec.ts +82 -82
  160. package/src/plugin/rules/import/no-js-import.ts +45 -45
  161. package/src/plugin/rules/naming-patterns.spec.ts +189 -189
  162. package/src/plugin/rules/naming-patterns.ts +426 -426
  163. package/src/plugin/rules/no-getter-logic.spec.ts +591 -591
  164. package/src/plugin/rules/no-getter-logic.ts +220 -220
  165. package/src/plugin/rules/prefer-enum-over-string-union.spec.ts +583 -583
  166. package/src/plugin/rules/prefer-enum-over-string-union.ts +333 -333
  167. package/src/plugin/rules/prefer-interface-over-duplicate-types.spec.ts +404 -404
  168. package/src/plugin/rules/prefer-interface-over-duplicate-types.ts +314 -314
  169. package/src/plugin/rules/require-jsdoc-description.spec.ts +779 -779
  170. package/src/plugin/rules/require-jsdoc-description.ts +572 -572
  171. package/src/plugin/rules/require-test-description-prefix.spec.ts +459 -459
  172. package/src/plugin/rules/require-test-description-prefix.ts +154 -154
  173. package/src/plugin/rules/ts/data-model-extends.spec.ts +84 -84
  174. package/src/plugin/rules/ts/data-model-extends.ts +100 -100
  175. package/src/plugin/rules/ts/no-any-type.spec.ts +28 -28
  176. package/src/plugin/rules/ts/no-any-type.ts +36 -36
  177. package/src/plugin/rules/ts/no-as-cast.spec.ts +51 -51
  178. package/src/plugin/rules/ts/no-as-cast.ts +51 -51
  179. package/src/plugin/rules/ts/no-dynamic-imports.spec.ts +54 -54
  180. package/src/plugin/rules/ts/no-dynamic-imports.ts +49 -49
  181. package/src/plugin/rules/ts/no-native-browser-dialogs.spec.ts +54 -54
  182. package/src/plugin/rules/ts/no-native-browser-dialogs.ts +84 -84
  183. package/src/plugin/rules/ts/no-plain-function-export.spec.ts +72 -72
  184. package/src/plugin/rules/ts/no-plain-function-export.ts +73 -73
  185. package/src/plugin/rules/ts/one-export-per-file.spec.ts +64 -64
  186. package/src/plugin/rules/ts/one-export-per-file.ts +77 -77
  187. package/src/scripts/dynamo-fix.ts +172 -172
  188. package/src/scripts/eslintrc-audit.ts +116 -116
  189. package/src/scripts/fix-return-types.spec.ts +65 -65
  190. package/src/scripts/fix-return-types.ts +288 -288
  191. package/src/scripts/validate-imports.ts +278 -261
  192. package/src/scripts/validate-naming.ts +204 -187
  193. package/src/scripts/validator-cli.integration.spec.ts +96 -0
  194. package/tsconfig.json +31 -31
@@ -1,497 +1,497 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const rule = {
4
- meta: {
5
- type: 'suggestion',
6
- docs: {
7
- description: 'Require JSDoc comment blocks with description for functions, classes, interfaces, and enums',
8
- recommended: true,
9
- },
10
- schema: [
11
- {
12
- type: 'object',
13
- properties: {
14
- scope: {
15
- type: 'string',
16
- enum: ['public', 'all'],
17
- default: 'public',
18
- },
19
- },
20
- additionalProperties: false,
21
- },
22
- ],
23
- messages: {
24
- missingJSDoc: '{{type}} "{{name}}" must have a JSDoc comment with description.',
25
- emptyJSDoc: '{{type}} "{{name}}" JSDoc comment must contain description text.',
26
- invalidJSDocPosition: '{{type}} "{{name}}" JSDoc comment must be on the line immediately before.',
27
- },
28
- },
29
- create(context) {
30
- const options = context.options[0] || {};
31
- const scope = options.scope || 'public';
32
- const sourceCode = context.sourceCode;
33
- /**
34
- * Check if a node is public/exported (should be documented)
35
- */
36
- function isPublic(node) {
37
- try {
38
- // Check if node itself is exported
39
- if (node.parent && node.parent.type === 'ExportNamedDeclaration') {
40
- return true;
41
- }
42
- if (node.parent && node.parent.type === 'ExportDefaultDeclaration') {
43
- return true;
44
- }
45
- // Check for export keyword in declaration
46
- if (node.type === 'FunctionDeclaration' && node.parent &&
47
- node.parent.type === 'Program' && node.id) {
48
- // Top-level function - check if exported
49
- const program = node.parent;
50
- if (program.body && Array.isArray(program.body)) {
51
- for (const statement of program.body) {
52
- if (statement.type === 'ExportNamedDeclaration' &&
53
- statement.declaration === node) {
54
- return true;
55
- }
56
- }
57
- }
58
- }
59
- // For class members, check accessibility modifiers
60
- if (node.type === 'MethodDefinition' || node.type === 'PropertyDefinition') {
61
- // If has private modifier, it's not public
62
- if (node.accessibility === 'private') {
63
- return false;
64
- }
65
- // If has protected modifier, it's not public
66
- if (node.accessibility === 'protected') {
67
- return false;
68
- }
69
- // Default to public if no modifiers
70
- return true;
71
- }
72
- // For top-level declarations, check if they're exported
73
- if (node.parent && node.parent.type === 'Program') {
74
- // Check if this declaration is exported
75
- const program = node.parent;
76
- if (program.body && Array.isArray(program.body)) {
77
- for (const statement of program.body) {
78
- if (statement.type === 'ExportNamedDeclaration' &&
79
- statement.declaration === node) {
80
- return true;
81
- }
82
- if (statement.type === 'ExportDefaultDeclaration' &&
83
- statement.declaration === node) {
84
- return true;
85
- }
86
- }
87
- }
88
- return false; // Not exported
89
- }
90
- // Default to public for other cases
91
- return true;
92
- }
93
- catch (error) {
94
- console.error('[require-jsdoc-description] Error in isPublic:', error);
95
- return true; // Default to requiring documentation
96
- }
97
- }
98
- /**
99
- * Check if JSDoc comment is on the line immediately before the node
100
- */
101
- function isJSDocOnPreviousLine(node, jsdocComment) {
102
- try {
103
- const nodeStart = node.loc?.start?.line;
104
- const commentEnd = jsdocComment.loc?.end?.line;
105
- if (!nodeStart || !commentEnd) {
106
- return false;
107
- }
108
- // JSDoc should be on the line immediately before (no blank lines)
109
- // For multi-line comments, check if the last line of the comment is immediately before the node
110
- return commentEnd === nodeStart - 1;
111
- }
112
- catch (error) {
113
- console.error('[require-jsdoc-description] Error in isJSDocOnPreviousLine:', error);
114
- return false;
115
- }
116
- }
117
- /**
118
- * Extract description text from JSDoc comment
119
- */
120
- function extractDescription(jsdocComment) {
121
- try {
122
- if (!jsdocComment.value) {
123
- return '';
124
- }
125
- // The comment.value contains the text between /** and */
126
- // It may start with * and include newlines with * at the beginning of each line
127
- const lines = jsdocComment.value.split('\n');
128
- let description = '';
129
- for (const line of lines) {
130
- // Remove leading whitespace and * character (JSDoc format: " * text" or "* text")
131
- // Handle both formats: " * text" and "* text" and " *text"
132
- const cleanLine = line.replace(/^\s*\*+\s?/, '').trim();
133
- // Skip empty lines (after removing * and whitespace)
134
- if (!cleanLine) {
135
- continue;
136
- }
137
- // Stop at @tags (JSDoc tags like @param, @returns, etc.)
138
- if (cleanLine.startsWith('@')) {
139
- break;
140
- }
141
- // Add to description with space separator
142
- if (description) {
143
- description += ' ';
144
- }
145
- description += cleanLine;
146
- }
147
- return description.trim();
148
- }
149
- catch (error) {
150
- console.error('[require-jsdoc-description] Error in extractDescription:', error);
151
- return '';
152
- }
153
- }
154
- /**
155
- * Egy node "tartalmi" leading-comment-jenek megtalalasahoz fel kell masznunk a
156
- * szintaktikai burkokon, mert a JSDoc nem mindig a belso deklaracio ele kerul:
157
- * - `export class X` / `export interface Y` / `export type Z` / `export enum E`:
158
- * a JSDoc az ExportNamedDeclaration / ExportDefaultDeclaration ELE kerul, NEM
159
- * a belso deklaracio-node ele.
160
- * - arrow-const (`export const fn = () => {}`): a JSDoc a VariableDeclaration
161
- * (ill. annak export-wrapper-e) ele kerul, nem a VariableDeclarator ele.
162
- * - dekorator (pl. `@Component()`-tel annotalt class): a JSDoc a dekorator-stack
163
- * fole kerul, igy a belso class-node kozvetlen elott nincs comment.
164
- * Ez a helper visszaadja azokat a "horgony" node-okat, amik ele a
165
- * getCommentsBefore-t erdemes hivni — sorrendben a legkulso burkolotol befele.
166
- */
167
- function getCommentAnchors(node) {
168
- const anchors = [node];
169
- try {
170
- let climbed = node;
171
- // arrow-const: VariableDeclarator → VariableDeclaration
172
- if (climbed.parent && climbed.parent.type === 'VariableDeclaration') {
173
- climbed = climbed.parent;
174
- }
175
- // export-wrapper: <decl> → ExportNamedDeclaration / ExportDefaultDeclaration
176
- // (csak akkor maszunk fel, ha a wrapper tenyleg EZT a node-ot exportalja)
177
- if (climbed.parent
178
- && (climbed.parent.type === 'ExportNamedDeclaration' || climbed.parent.type === 'ExportDefaultDeclaration')
179
- && climbed.parent.declaration === climbed) {
180
- climbed = climbed.parent;
181
- }
182
- // a legkulso burkolo elore kerul (ott van a tartalmi JSDoc tipikusan)
183
- if (climbed !== node) {
184
- anchors.unshift(climbed);
185
- }
186
- // dekorator: a JSDoc a dekorator-stack fole is kerulhet
187
- if (Array.isArray(node.decorators) && node.decorators.length > 0) {
188
- anchors.push(node.decorators[0]);
189
- }
190
- }
191
- catch (error) {
192
- console.error('[require-jsdoc-description] Error in getCommentAnchors:', error);
193
- }
194
- return anchors;
195
- }
196
- /**
197
- * Az osszes szoba johheto "horgony" elott levo comment osszegyujtese. A
198
- * getLeadingComments a getCommentsBefore-t MINDEN anchor-ra meghivja es
199
- * osszefuzi az eredmenyt — a hasValidJSDoc utana az elso JSDoc-blokkot
200
- * keresi ki belole, igy mindegy hogy melyik burok elott talalja meg.
201
- */
202
- function getLeadingComments(node) {
203
- const all = [];
204
- for (const anchor of getCommentAnchors(node)) {
205
- const before = sourceCode.getCommentsBefore(anchor) || [];
206
- for (const comment of before) {
207
- all.push(comment);
208
- }
209
- }
210
- return all;
211
- }
212
- /**
213
- * Check if node has valid JSDoc comment
214
- */
215
- function hasValidJSDoc(node) {
216
- try {
217
- const comments = getLeadingComments(node);
218
- // Find JSDoc comment (/** ... */)
219
- // JSDoc comments are Block comments where the value (content between /** and */) starts with *
220
- const jsdocComment = comments.find((comment) => {
221
- if (comment.type !== 'Block') {
222
- return false;
223
- }
224
- const value = comment.value || '';
225
- // JSDoc comment value should start with * (the first character after /**)
226
- // Handle cases where there might be whitespace before the *
227
- return value.trim().startsWith('*');
228
- });
229
- if (!jsdocComment) {
230
- return { hasJSDoc: false, isValid: false, isOnPreviousLine: false };
231
- }
232
- const isOnPreviousLine = isJSDocOnPreviousLine(node, jsdocComment);
233
- const description = extractDescription(jsdocComment);
234
- const isValid = description.length > 0;
235
- return { hasJSDoc: true, isValid, isOnPreviousLine };
236
- }
237
- catch (error) {
238
- console.error('[require-jsdoc-description] Error in hasValidJSDoc:', error);
239
- return { hasJSDoc: false, isValid: false, isOnPreviousLine: false };
240
- }
241
- }
242
- /**
243
- * Get node name for error messages
244
- */
245
- function getNodeName(node) {
246
- try {
247
- if (node.id && node.id.name) {
248
- return node.id.name;
249
- }
250
- if (node.key && node.key.name) {
251
- return node.key.name;
252
- }
253
- if (node.name && node.name.name) {
254
- return node.name.name;
255
- }
256
- return 'anonymous';
257
- }
258
- catch (error) {
259
- console.error('[require-jsdoc-description] Error in getNodeName:', error);
260
- return 'unknown';
261
- }
262
- }
263
- /**
264
- * Get node name location for error reporting
265
- */
266
- function getNodeNameLoc(node) {
267
- try {
268
- // For MethodDefinition, use key.loc
269
- if (node.key && node.key.loc) {
270
- return node.key.loc;
271
- }
272
- // For declarations with id (FunctionDeclaration, ClassDeclaration, etc.)
273
- if (node.id && node.id.loc) {
274
- return node.id.loc;
275
- }
276
- // For VariableDeclarator
277
- if (node.id && node.id.loc) {
278
- return node.id.loc;
279
- }
280
- // Fallback to node location if name location not found
281
- if (node.loc) {
282
- return node.loc;
283
- }
284
- return null;
285
- }
286
- catch (error) {
287
- console.error('[require-jsdoc-description] Error in getNodeNameLoc:', error);
288
- return null;
289
- }
290
- }
291
- /**
292
- * Get node type for error messages
293
- */
294
- function getNodeType(node) {
295
- try {
296
- // Check if it's a VariableDeclarator with function expression
297
- if (node.type === 'VariableDeclarator' && node.init) {
298
- if (node.init.type === 'FunctionExpression' || node.init.type === 'ArrowFunctionExpression') {
299
- return 'Function';
300
- }
301
- }
302
- switch (node.type) {
303
- case 'FunctionDeclaration':
304
- return 'Function';
305
- case 'FunctionExpression':
306
- return 'Function';
307
- case 'ArrowFunctionExpression':
308
- return 'Function';
309
- case 'ClassDeclaration':
310
- return 'Class';
311
- case 'TSInterfaceDeclaration':
312
- return 'Interface';
313
- case 'TSEnumDeclaration':
314
- return 'Enum';
315
- case 'TSTypeAliasDeclaration':
316
- return 'Type';
317
- case 'MethodDefinition':
318
- return 'Method';
319
- case 'PropertyDefinition':
320
- return 'Property';
321
- default:
322
- return 'Declaration';
323
- }
324
- }
325
- catch (error) {
326
- console.error('[require-jsdoc-description] Error in getNodeType:', error);
327
- return 'Declaration';
328
- }
329
- }
330
- /**
331
- * Check if node should be documented based on scope
332
- */
333
- function shouldBeDocumented(node) {
334
- try {
335
- if (scope === 'all') {
336
- return true;
337
- }
338
- if (scope === 'public') {
339
- return isPublic(node);
340
- }
341
- return true; // Default to requiring documentation
342
- }
343
- catch (error) {
344
- console.error('[require-jsdoc-description] Error in shouldBeDocumented:', error);
345
- return true;
346
- }
347
- }
348
- /**
349
- * Report missing or invalid JSDoc
350
- */
351
- function reportJSDocIssue(node, jsdocResult) {
352
- try {
353
- const name = getNodeName(node);
354
- const type = getNodeType(node);
355
- const nameLoc = getNodeNameLoc(node);
356
- // Fallback to node location if name location not found
357
- const reportLoc = nameLoc || node.loc;
358
- if (!jsdocResult.hasJSDoc) {
359
- context.report({
360
- loc: reportLoc,
361
- messageId: 'missingJSDoc',
362
- data: { type, name },
363
- });
364
- }
365
- else if (!jsdocResult.isOnPreviousLine) {
366
- context.report({
367
- loc: reportLoc,
368
- messageId: 'invalidJSDocPosition',
369
- data: { type, name },
370
- });
371
- }
372
- else if (!jsdocResult.isValid) {
373
- context.report({
374
- loc: reportLoc,
375
- messageId: 'emptyJSDoc',
376
- data: { type, name },
377
- });
378
- }
379
- }
380
- catch (error) {
381
- console.error('[require-jsdoc-description] Error in reportJSDocIssue:', error);
382
- }
383
- }
384
- return {
385
- // Function declarations
386
- FunctionDeclaration(node, _context, _sourceCode) {
387
- try {
388
- if (!shouldBeDocumented(node)) {
389
- return;
390
- }
391
- const jsdocResult = hasValidJSDoc(node);
392
- if (!jsdocResult.hasJSDoc || !jsdocResult.isValid || !jsdocResult.isOnPreviousLine) {
393
- reportJSDocIssue(node, jsdocResult);
394
- }
395
- }
396
- catch (error) {
397
- console.error('[require-jsdoc-description] Error in FunctionDeclaration visitor:', error);
398
- }
399
- },
400
- // Function expressions (when assigned to variables)
401
- VariableDeclarator(node, _context, _sourceCode) {
402
- try {
403
- if (node.init &&
404
- (node.init.type === 'FunctionExpression' || node.init.type === 'ArrowFunctionExpression')) {
405
- if (!shouldBeDocumented(node)) {
406
- return;
407
- }
408
- const jsdocResult = hasValidJSDoc(node);
409
- if (!jsdocResult.hasJSDoc || !jsdocResult.isValid || !jsdocResult.isOnPreviousLine) {
410
- reportJSDocIssue(node, jsdocResult);
411
- }
412
- }
413
- }
414
- catch (error) {
415
- console.error('[require-jsdoc-description] Error in VariableDeclarator visitor:', error);
416
- }
417
- },
418
- // Class declarations
419
- ClassDeclaration(node, _context, _sourceCode) {
420
- try {
421
- if (!shouldBeDocumented(node)) {
422
- return;
423
- }
424
- const jsdocResult = hasValidJSDoc(node);
425
- if (!jsdocResult.hasJSDoc || !jsdocResult.isValid || !jsdocResult.isOnPreviousLine) {
426
- reportJSDocIssue(node, jsdocResult);
427
- }
428
- }
429
- catch (error) {
430
- console.error('[require-jsdoc-description] Error in ClassDeclaration visitor:', error);
431
- }
432
- },
433
- // Interface declarations
434
- TSInterfaceDeclaration(node, _context, _sourceCode) {
435
- try {
436
- if (!shouldBeDocumented(node)) {
437
- return;
438
- }
439
- const jsdocResult = hasValidJSDoc(node);
440
- if (!jsdocResult.hasJSDoc || !jsdocResult.isValid || !jsdocResult.isOnPreviousLine) {
441
- reportJSDocIssue(node, jsdocResult);
442
- }
443
- }
444
- catch (error) {
445
- console.error('[require-jsdoc-description] Error in TSInterfaceDeclaration visitor:', error);
446
- }
447
- },
448
- // Enum declarations
449
- TSEnumDeclaration(node, _context, _sourceCode) {
450
- try {
451
- if (!shouldBeDocumented(node)) {
452
- return;
453
- }
454
- const jsdocResult = hasValidJSDoc(node);
455
- if (!jsdocResult.hasJSDoc || !jsdocResult.isValid || !jsdocResult.isOnPreviousLine) {
456
- reportJSDocIssue(node, jsdocResult);
457
- }
458
- }
459
- catch (error) {
460
- console.error('[require-jsdoc-description] Error in TSEnumDeclaration visitor:', error);
461
- }
462
- },
463
- // Type alias declarations (CCAP-megerősítés: exportált `type X = …` kötelező JSDoc).
464
- TSTypeAliasDeclaration(node, _context, _sourceCode) {
465
- try {
466
- if (!shouldBeDocumented(node)) {
467
- return;
468
- }
469
- const jsdocResult = hasValidJSDoc(node);
470
- if (!jsdocResult.hasJSDoc || !jsdocResult.isValid || !jsdocResult.isOnPreviousLine) {
471
- reportJSDocIssue(node, jsdocResult);
472
- }
473
- }
474
- catch (error) {
475
- console.error('[require-jsdoc-description] Error in TSTypeAliasDeclaration visitor:', error);
476
- }
477
- },
478
- // Class methods
479
- MethodDefinition(node, _context, _sourceCode) {
480
- try {
481
- if (!shouldBeDocumented(node)) {
482
- return;
483
- }
484
- const jsdocResult = hasValidJSDoc(node);
485
- if (!jsdocResult.hasJSDoc || !jsdocResult.isValid || !jsdocResult.isOnPreviousLine) {
486
- reportJSDocIssue(node, jsdocResult);
487
- }
488
- }
489
- catch (error) {
490
- console.error('[require-jsdoc-description] Error in MethodDefinition visitor:', error);
491
- }
492
- },
493
- };
494
- },
495
- };
496
- exports.default = rule;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const rule = {
4
+ meta: {
5
+ type: 'suggestion',
6
+ docs: {
7
+ description: 'Require JSDoc comment blocks with description for functions, classes, interfaces, and enums',
8
+ recommended: true,
9
+ },
10
+ schema: [
11
+ {
12
+ type: 'object',
13
+ properties: {
14
+ scope: {
15
+ type: 'string',
16
+ enum: ['public', 'all'],
17
+ default: 'public',
18
+ },
19
+ },
20
+ additionalProperties: false,
21
+ },
22
+ ],
23
+ messages: {
24
+ missingJSDoc: '{{type}} "{{name}}" must have a JSDoc comment with description.',
25
+ emptyJSDoc: '{{type}} "{{name}}" JSDoc comment must contain description text.',
26
+ invalidJSDocPosition: '{{type}} "{{name}}" JSDoc comment must be on the line immediately before.',
27
+ },
28
+ },
29
+ create(context) {
30
+ const options = context.options[0] || {};
31
+ const scope = options.scope || 'public';
32
+ const sourceCode = context.sourceCode;
33
+ /**
34
+ * Check if a node is public/exported (should be documented)
35
+ */
36
+ function isPublic(node) {
37
+ try {
38
+ // Check if node itself is exported
39
+ if (node.parent && node.parent.type === 'ExportNamedDeclaration') {
40
+ return true;
41
+ }
42
+ if (node.parent && node.parent.type === 'ExportDefaultDeclaration') {
43
+ return true;
44
+ }
45
+ // Check for export keyword in declaration
46
+ if (node.type === 'FunctionDeclaration' && node.parent &&
47
+ node.parent.type === 'Program' && node.id) {
48
+ // Top-level function - check if exported
49
+ const program = node.parent;
50
+ if (program.body && Array.isArray(program.body)) {
51
+ for (const statement of program.body) {
52
+ if (statement.type === 'ExportNamedDeclaration' &&
53
+ statement.declaration === node) {
54
+ return true;
55
+ }
56
+ }
57
+ }
58
+ }
59
+ // For class members, check accessibility modifiers
60
+ if (node.type === 'MethodDefinition' || node.type === 'PropertyDefinition') {
61
+ // If has private modifier, it's not public
62
+ if (node.accessibility === 'private') {
63
+ return false;
64
+ }
65
+ // If has protected modifier, it's not public
66
+ if (node.accessibility === 'protected') {
67
+ return false;
68
+ }
69
+ // Default to public if no modifiers
70
+ return true;
71
+ }
72
+ // For top-level declarations, check if they're exported
73
+ if (node.parent && node.parent.type === 'Program') {
74
+ // Check if this declaration is exported
75
+ const program = node.parent;
76
+ if (program.body && Array.isArray(program.body)) {
77
+ for (const statement of program.body) {
78
+ if (statement.type === 'ExportNamedDeclaration' &&
79
+ statement.declaration === node) {
80
+ return true;
81
+ }
82
+ if (statement.type === 'ExportDefaultDeclaration' &&
83
+ statement.declaration === node) {
84
+ return true;
85
+ }
86
+ }
87
+ }
88
+ return false; // Not exported
89
+ }
90
+ // Default to public for other cases
91
+ return true;
92
+ }
93
+ catch (error) {
94
+ console.error('[require-jsdoc-description] Error in isPublic:', error);
95
+ return true; // Default to requiring documentation
96
+ }
97
+ }
98
+ /**
99
+ * Check if JSDoc comment is on the line immediately before the node
100
+ */
101
+ function isJSDocOnPreviousLine(node, jsdocComment) {
102
+ try {
103
+ const nodeStart = node.loc?.start?.line;
104
+ const commentEnd = jsdocComment.loc?.end?.line;
105
+ if (!nodeStart || !commentEnd) {
106
+ return false;
107
+ }
108
+ // JSDoc should be on the line immediately before (no blank lines)
109
+ // For multi-line comments, check if the last line of the comment is immediately before the node
110
+ return commentEnd === nodeStart - 1;
111
+ }
112
+ catch (error) {
113
+ console.error('[require-jsdoc-description] Error in isJSDocOnPreviousLine:', error);
114
+ return false;
115
+ }
116
+ }
117
+ /**
118
+ * Extract description text from JSDoc comment
119
+ */
120
+ function extractDescription(jsdocComment) {
121
+ try {
122
+ if (!jsdocComment.value) {
123
+ return '';
124
+ }
125
+ // The comment.value contains the text between /** and */
126
+ // It may start with * and include newlines with * at the beginning of each line
127
+ const lines = jsdocComment.value.split('\n');
128
+ let description = '';
129
+ for (const line of lines) {
130
+ // Remove leading whitespace and * character (JSDoc format: " * text" or "* text")
131
+ // Handle both formats: " * text" and "* text" and " *text"
132
+ const cleanLine = line.replace(/^\s*\*+\s?/, '').trim();
133
+ // Skip empty lines (after removing * and whitespace)
134
+ if (!cleanLine) {
135
+ continue;
136
+ }
137
+ // Stop at @tags (JSDoc tags like @param, @returns, etc.)
138
+ if (cleanLine.startsWith('@')) {
139
+ break;
140
+ }
141
+ // Add to description with space separator
142
+ if (description) {
143
+ description += ' ';
144
+ }
145
+ description += cleanLine;
146
+ }
147
+ return description.trim();
148
+ }
149
+ catch (error) {
150
+ console.error('[require-jsdoc-description] Error in extractDescription:', error);
151
+ return '';
152
+ }
153
+ }
154
+ /**
155
+ * Egy node "tartalmi" leading-comment-jenek megtalalasahoz fel kell masznunk a
156
+ * szintaktikai burkokon, mert a JSDoc nem mindig a belso deklaracio ele kerul:
157
+ * - `export class X` / `export interface Y` / `export type Z` / `export enum E`:
158
+ * a JSDoc az ExportNamedDeclaration / ExportDefaultDeclaration ELE kerul, NEM
159
+ * a belso deklaracio-node ele.
160
+ * - arrow-const (`export const fn = () => {}`): a JSDoc a VariableDeclaration
161
+ * (ill. annak export-wrapper-e) ele kerul, nem a VariableDeclarator ele.
162
+ * - dekorator (pl. `@Component()`-tel annotalt class): a JSDoc a dekorator-stack
163
+ * fole kerul, igy a belso class-node kozvetlen elott nincs comment.
164
+ * Ez a helper visszaadja azokat a "horgony" node-okat, amik ele a
165
+ * getCommentsBefore-t erdemes hivni — sorrendben a legkulso burkolotol befele.
166
+ */
167
+ function getCommentAnchors(node) {
168
+ const anchors = [node];
169
+ try {
170
+ let climbed = node;
171
+ // arrow-const: VariableDeclarator → VariableDeclaration
172
+ if (climbed.parent && climbed.parent.type === 'VariableDeclaration') {
173
+ climbed = climbed.parent;
174
+ }
175
+ // export-wrapper: <decl> → ExportNamedDeclaration / ExportDefaultDeclaration
176
+ // (csak akkor maszunk fel, ha a wrapper tenyleg EZT a node-ot exportalja)
177
+ if (climbed.parent
178
+ && (climbed.parent.type === 'ExportNamedDeclaration' || climbed.parent.type === 'ExportDefaultDeclaration')
179
+ && climbed.parent.declaration === climbed) {
180
+ climbed = climbed.parent;
181
+ }
182
+ // a legkulso burkolo elore kerul (ott van a tartalmi JSDoc tipikusan)
183
+ if (climbed !== node) {
184
+ anchors.unshift(climbed);
185
+ }
186
+ // dekorator: a JSDoc a dekorator-stack fole is kerulhet
187
+ if (Array.isArray(node.decorators) && node.decorators.length > 0) {
188
+ anchors.push(node.decorators[0]);
189
+ }
190
+ }
191
+ catch (error) {
192
+ console.error('[require-jsdoc-description] Error in getCommentAnchors:', error);
193
+ }
194
+ return anchors;
195
+ }
196
+ /**
197
+ * Az osszes szoba johheto "horgony" elott levo comment osszegyujtese. A
198
+ * getLeadingComments a getCommentsBefore-t MINDEN anchor-ra meghivja es
199
+ * osszefuzi az eredmenyt — a hasValidJSDoc utana az elso JSDoc-blokkot
200
+ * keresi ki belole, igy mindegy hogy melyik burok elott talalja meg.
201
+ */
202
+ function getLeadingComments(node) {
203
+ const all = [];
204
+ for (const anchor of getCommentAnchors(node)) {
205
+ const before = sourceCode.getCommentsBefore(anchor) || [];
206
+ for (const comment of before) {
207
+ all.push(comment);
208
+ }
209
+ }
210
+ return all;
211
+ }
212
+ /**
213
+ * Check if node has valid JSDoc comment
214
+ */
215
+ function hasValidJSDoc(node) {
216
+ try {
217
+ const comments = getLeadingComments(node);
218
+ // Find JSDoc comment (/** ... */)
219
+ // JSDoc comments are Block comments where the value (content between /** and */) starts with *
220
+ const jsdocComment = comments.find((comment) => {
221
+ if (comment.type !== 'Block') {
222
+ return false;
223
+ }
224
+ const value = comment.value || '';
225
+ // JSDoc comment value should start with * (the first character after /**)
226
+ // Handle cases where there might be whitespace before the *
227
+ return value.trim().startsWith('*');
228
+ });
229
+ if (!jsdocComment) {
230
+ return { hasJSDoc: false, isValid: false, isOnPreviousLine: false };
231
+ }
232
+ const isOnPreviousLine = isJSDocOnPreviousLine(node, jsdocComment);
233
+ const description = extractDescription(jsdocComment);
234
+ const isValid = description.length > 0;
235
+ return { hasJSDoc: true, isValid, isOnPreviousLine };
236
+ }
237
+ catch (error) {
238
+ console.error('[require-jsdoc-description] Error in hasValidJSDoc:', error);
239
+ return { hasJSDoc: false, isValid: false, isOnPreviousLine: false };
240
+ }
241
+ }
242
+ /**
243
+ * Get node name for error messages
244
+ */
245
+ function getNodeName(node) {
246
+ try {
247
+ if (node.id && node.id.name) {
248
+ return node.id.name;
249
+ }
250
+ if (node.key && node.key.name) {
251
+ return node.key.name;
252
+ }
253
+ if (node.name && node.name.name) {
254
+ return node.name.name;
255
+ }
256
+ return 'anonymous';
257
+ }
258
+ catch (error) {
259
+ console.error('[require-jsdoc-description] Error in getNodeName:', error);
260
+ return 'unknown';
261
+ }
262
+ }
263
+ /**
264
+ * Get node name location for error reporting
265
+ */
266
+ function getNodeNameLoc(node) {
267
+ try {
268
+ // For MethodDefinition, use key.loc
269
+ if (node.key && node.key.loc) {
270
+ return node.key.loc;
271
+ }
272
+ // For declarations with id (FunctionDeclaration, ClassDeclaration, etc.)
273
+ if (node.id && node.id.loc) {
274
+ return node.id.loc;
275
+ }
276
+ // For VariableDeclarator
277
+ if (node.id && node.id.loc) {
278
+ return node.id.loc;
279
+ }
280
+ // Fallback to node location if name location not found
281
+ if (node.loc) {
282
+ return node.loc;
283
+ }
284
+ return null;
285
+ }
286
+ catch (error) {
287
+ console.error('[require-jsdoc-description] Error in getNodeNameLoc:', error);
288
+ return null;
289
+ }
290
+ }
291
+ /**
292
+ * Get node type for error messages
293
+ */
294
+ function getNodeType(node) {
295
+ try {
296
+ // Check if it's a VariableDeclarator with function expression
297
+ if (node.type === 'VariableDeclarator' && node.init) {
298
+ if (node.init.type === 'FunctionExpression' || node.init.type === 'ArrowFunctionExpression') {
299
+ return 'Function';
300
+ }
301
+ }
302
+ switch (node.type) {
303
+ case 'FunctionDeclaration':
304
+ return 'Function';
305
+ case 'FunctionExpression':
306
+ return 'Function';
307
+ case 'ArrowFunctionExpression':
308
+ return 'Function';
309
+ case 'ClassDeclaration':
310
+ return 'Class';
311
+ case 'TSInterfaceDeclaration':
312
+ return 'Interface';
313
+ case 'TSEnumDeclaration':
314
+ return 'Enum';
315
+ case 'TSTypeAliasDeclaration':
316
+ return 'Type';
317
+ case 'MethodDefinition':
318
+ return 'Method';
319
+ case 'PropertyDefinition':
320
+ return 'Property';
321
+ default:
322
+ return 'Declaration';
323
+ }
324
+ }
325
+ catch (error) {
326
+ console.error('[require-jsdoc-description] Error in getNodeType:', error);
327
+ return 'Declaration';
328
+ }
329
+ }
330
+ /**
331
+ * Check if node should be documented based on scope
332
+ */
333
+ function shouldBeDocumented(node) {
334
+ try {
335
+ if (scope === 'all') {
336
+ return true;
337
+ }
338
+ if (scope === 'public') {
339
+ return isPublic(node);
340
+ }
341
+ return true; // Default to requiring documentation
342
+ }
343
+ catch (error) {
344
+ console.error('[require-jsdoc-description] Error in shouldBeDocumented:', error);
345
+ return true;
346
+ }
347
+ }
348
+ /**
349
+ * Report missing or invalid JSDoc
350
+ */
351
+ function reportJSDocIssue(node, jsdocResult) {
352
+ try {
353
+ const name = getNodeName(node);
354
+ const type = getNodeType(node);
355
+ const nameLoc = getNodeNameLoc(node);
356
+ // Fallback to node location if name location not found
357
+ const reportLoc = nameLoc || node.loc;
358
+ if (!jsdocResult.hasJSDoc) {
359
+ context.report({
360
+ loc: reportLoc,
361
+ messageId: 'missingJSDoc',
362
+ data: { type, name },
363
+ });
364
+ }
365
+ else if (!jsdocResult.isOnPreviousLine) {
366
+ context.report({
367
+ loc: reportLoc,
368
+ messageId: 'invalidJSDocPosition',
369
+ data: { type, name },
370
+ });
371
+ }
372
+ else if (!jsdocResult.isValid) {
373
+ context.report({
374
+ loc: reportLoc,
375
+ messageId: 'emptyJSDoc',
376
+ data: { type, name },
377
+ });
378
+ }
379
+ }
380
+ catch (error) {
381
+ console.error('[require-jsdoc-description] Error in reportJSDocIssue:', error);
382
+ }
383
+ }
384
+ return {
385
+ // Function declarations
386
+ FunctionDeclaration(node, _context, _sourceCode) {
387
+ try {
388
+ if (!shouldBeDocumented(node)) {
389
+ return;
390
+ }
391
+ const jsdocResult = hasValidJSDoc(node);
392
+ if (!jsdocResult.hasJSDoc || !jsdocResult.isValid || !jsdocResult.isOnPreviousLine) {
393
+ reportJSDocIssue(node, jsdocResult);
394
+ }
395
+ }
396
+ catch (error) {
397
+ console.error('[require-jsdoc-description] Error in FunctionDeclaration visitor:', error);
398
+ }
399
+ },
400
+ // Function expressions (when assigned to variables)
401
+ VariableDeclarator(node, _context, _sourceCode) {
402
+ try {
403
+ if (node.init &&
404
+ (node.init.type === 'FunctionExpression' || node.init.type === 'ArrowFunctionExpression')) {
405
+ if (!shouldBeDocumented(node)) {
406
+ return;
407
+ }
408
+ const jsdocResult = hasValidJSDoc(node);
409
+ if (!jsdocResult.hasJSDoc || !jsdocResult.isValid || !jsdocResult.isOnPreviousLine) {
410
+ reportJSDocIssue(node, jsdocResult);
411
+ }
412
+ }
413
+ }
414
+ catch (error) {
415
+ console.error('[require-jsdoc-description] Error in VariableDeclarator visitor:', error);
416
+ }
417
+ },
418
+ // Class declarations
419
+ ClassDeclaration(node, _context, _sourceCode) {
420
+ try {
421
+ if (!shouldBeDocumented(node)) {
422
+ return;
423
+ }
424
+ const jsdocResult = hasValidJSDoc(node);
425
+ if (!jsdocResult.hasJSDoc || !jsdocResult.isValid || !jsdocResult.isOnPreviousLine) {
426
+ reportJSDocIssue(node, jsdocResult);
427
+ }
428
+ }
429
+ catch (error) {
430
+ console.error('[require-jsdoc-description] Error in ClassDeclaration visitor:', error);
431
+ }
432
+ },
433
+ // Interface declarations
434
+ TSInterfaceDeclaration(node, _context, _sourceCode) {
435
+ try {
436
+ if (!shouldBeDocumented(node)) {
437
+ return;
438
+ }
439
+ const jsdocResult = hasValidJSDoc(node);
440
+ if (!jsdocResult.hasJSDoc || !jsdocResult.isValid || !jsdocResult.isOnPreviousLine) {
441
+ reportJSDocIssue(node, jsdocResult);
442
+ }
443
+ }
444
+ catch (error) {
445
+ console.error('[require-jsdoc-description] Error in TSInterfaceDeclaration visitor:', error);
446
+ }
447
+ },
448
+ // Enum declarations
449
+ TSEnumDeclaration(node, _context, _sourceCode) {
450
+ try {
451
+ if (!shouldBeDocumented(node)) {
452
+ return;
453
+ }
454
+ const jsdocResult = hasValidJSDoc(node);
455
+ if (!jsdocResult.hasJSDoc || !jsdocResult.isValid || !jsdocResult.isOnPreviousLine) {
456
+ reportJSDocIssue(node, jsdocResult);
457
+ }
458
+ }
459
+ catch (error) {
460
+ console.error('[require-jsdoc-description] Error in TSEnumDeclaration visitor:', error);
461
+ }
462
+ },
463
+ // Type alias declarations (CCAP-megerősítés: exportált `type X = …` kötelező JSDoc).
464
+ TSTypeAliasDeclaration(node, _context, _sourceCode) {
465
+ try {
466
+ if (!shouldBeDocumented(node)) {
467
+ return;
468
+ }
469
+ const jsdocResult = hasValidJSDoc(node);
470
+ if (!jsdocResult.hasJSDoc || !jsdocResult.isValid || !jsdocResult.isOnPreviousLine) {
471
+ reportJSDocIssue(node, jsdocResult);
472
+ }
473
+ }
474
+ catch (error) {
475
+ console.error('[require-jsdoc-description] Error in TSTypeAliasDeclaration visitor:', error);
476
+ }
477
+ },
478
+ // Class methods
479
+ MethodDefinition(node, _context, _sourceCode) {
480
+ try {
481
+ if (!shouldBeDocumented(node)) {
482
+ return;
483
+ }
484
+ const jsdocResult = hasValidJSDoc(node);
485
+ if (!jsdocResult.hasJSDoc || !jsdocResult.isValid || !jsdocResult.isOnPreviousLine) {
486
+ reportJSDocIssue(node, jsdocResult);
487
+ }
488
+ }
489
+ catch (error) {
490
+ console.error('[require-jsdoc-description] Error in MethodDefinition visitor:', error);
491
+ }
492
+ },
493
+ };
494
+ },
495
+ };
496
+ exports.default = rule;
497
497
  //# sourceMappingURL=require-jsdoc-description.js.map