eslint-plugin-jsdoc 44.2.3 → 44.2.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 (120) hide show
  1. package/dist/WarnSettings.js +0 -1
  2. package/dist/WarnSettings.js.map +1 -1
  3. package/dist/alignTransform.js +87 -5
  4. package/dist/alignTransform.js.map +1 -1
  5. package/dist/bin/generateRule.js +4 -3
  6. package/dist/bin/generateRule.js.map +1 -1
  7. package/dist/exportParser.js +272 -71
  8. package/dist/exportParser.js.map +1 -1
  9. package/dist/generateRule.js +4 -3
  10. package/dist/generateRule.js.map +1 -1
  11. package/dist/iterateJsdoc.js +921 -357
  12. package/dist/iterateJsdoc.js.map +1 -1
  13. package/dist/jsdocUtils.js +270 -168
  14. package/dist/jsdocUtils.js.map +1 -1
  15. package/dist/rules/checkAlignment.js +6 -0
  16. package/dist/rules/checkAlignment.js.map +1 -1
  17. package/dist/rules/checkExamples.js +73 -9
  18. package/dist/rules/checkExamples.js.map +1 -1
  19. package/dist/rules/checkIndentation.js +12 -2
  20. package/dist/rules/checkIndentation.js.map +1 -1
  21. package/dist/rules/checkLineAlignment.js +71 -7
  22. package/dist/rules/checkLineAlignment.js.map +1 -1
  23. package/dist/rules/checkParamNames.js +29 -11
  24. package/dist/rules/checkParamNames.js.map +1 -1
  25. package/dist/rules/checkPropertyNames.js +13 -7
  26. package/dist/rules/checkPropertyNames.js.map +1 -1
  27. package/dist/rules/checkTagNames.js +45 -9
  28. package/dist/rules/checkTagNames.js.map +1 -1
  29. package/dist/rules/checkTypes.js +98 -41
  30. package/dist/rules/checkTypes.js.map +1 -1
  31. package/dist/rules/checkValues.js +7 -7
  32. package/dist/rules/checkValues.js.map +1 -1
  33. package/dist/rules/emptyTags.js +8 -1
  34. package/dist/rules/emptyTags.js.map +1 -1
  35. package/dist/rules/informativeDocs.js +27 -8
  36. package/dist/rules/informativeDocs.js.map +1 -1
  37. package/dist/rules/matchDescription.js +18 -1
  38. package/dist/rules/matchDescription.js.map +1 -1
  39. package/dist/rules/matchName.js +2 -2
  40. package/dist/rules/matchName.js.map +1 -1
  41. package/dist/rules/multilineBlocks.js +12 -1
  42. package/dist/rules/multilineBlocks.js.map +1 -1
  43. package/dist/rules/noBadBlocks.js +4 -6
  44. package/dist/rules/noBadBlocks.js.map +1 -1
  45. package/dist/rules/noBlankBlockDescriptions.js +2 -0
  46. package/dist/rules/noBlankBlockDescriptions.js.map +1 -1
  47. package/dist/rules/noMissingSyntax.js +53 -16
  48. package/dist/rules/noMissingSyntax.js.map +1 -1
  49. package/dist/rules/noMultiAsterisks.js +1 -6
  50. package/dist/rules/noMultiAsterisks.js.map +1 -1
  51. package/dist/rules/noRestrictedSyntax.js +12 -5
  52. package/dist/rules/noRestrictedSyntax.js.map +1 -1
  53. package/dist/rules/noTypes.js +3 -0
  54. package/dist/rules/noTypes.js.map +1 -1
  55. package/dist/rules/noUndefinedTypes.js +65 -27
  56. package/dist/rules/noUndefinedTypes.js.map +1 -1
  57. package/dist/rules/requireAsteriskPrefix.js +20 -0
  58. package/dist/rules/requireAsteriskPrefix.js.map +1 -1
  59. package/dist/rules/requireDescription.js +6 -2
  60. package/dist/rules/requireDescription.js.map +1 -1
  61. package/dist/rules/requireDescriptionCompleteSentence.js +75 -12
  62. package/dist/rules/requireDescriptionCompleteSentence.js.map +1 -1
  63. package/dist/rules/requireFileOverview.js +9 -4
  64. package/dist/rules/requireFileOverview.js.map +1 -1
  65. package/dist/rules/requireHyphenBeforeParamDescription.js +21 -7
  66. package/dist/rules/requireHyphenBeforeParamDescription.js.map +1 -1
  67. package/dist/rules/requireJsdoc.js +150 -29
  68. package/dist/rules/requireJsdoc.js.map +1 -1
  69. package/dist/rules/requireParam.js +116 -10
  70. package/dist/rules/requireParam.js.map +1 -1
  71. package/dist/rules/requireProperty.js +1 -1
  72. package/dist/rules/requireProperty.js.map +1 -1
  73. package/dist/rules/requireReturns.js +2 -3
  74. package/dist/rules/requireReturns.js.map +1 -1
  75. package/dist/rules/requireReturnsCheck.js +9 -2
  76. package/dist/rules/requireReturnsCheck.js.map +1 -1
  77. package/dist/rules/requireThrows.js +2 -3
  78. package/dist/rules/requireThrows.js.map +1 -1
  79. package/dist/rules/requireYields.js +9 -3
  80. package/dist/rules/requireYields.js.map +1 -1
  81. package/dist/rules/requireYieldsCheck.js +19 -5
  82. package/dist/rules/requireYieldsCheck.js.map +1 -1
  83. package/dist/rules/sortTags.js +67 -9
  84. package/dist/rules/sortTags.js.map +1 -1
  85. package/dist/rules/tagLines.js +22 -3
  86. package/dist/rules/tagLines.js.map +1 -1
  87. package/dist/rules/textEscaping.js +18 -4
  88. package/dist/rules/textEscaping.js.map +1 -1
  89. package/dist/rules/validTypes.js +26 -9
  90. package/dist/rules/validTypes.js.map +1 -1
  91. package/dist/tagNames.js +0 -2
  92. package/dist/tagNames.js.map +1 -1
  93. package/dist/utils/hasReturnValue.js +77 -48
  94. package/dist/utils/hasReturnValue.js.map +1 -1
  95. package/docs/rules/check-line-alignment.md +7 -0
  96. package/docs/rules/check-tag-names.md +15 -0
  97. package/docs/rules/no-missing-syntax.md +6 -0
  98. package/docs/rules/no-undefined-types.md +6 -0
  99. package/docs/rules/require-description-complete-sentence.md +525 -289
  100. package/docs/rules/require-description.md +289 -525
  101. package/docs/rules/require-file-overview.md +7 -0
  102. package/docs/rules/require-jsdoc.md +1 -1
  103. package/docs/rules/require-param-description.md +116 -1694
  104. package/docs/rules/require-param-name.md +58 -133
  105. package/docs/rules/require-param-type.md +119 -55
  106. package/docs/rules/require-param.md +1704 -111
  107. package/docs/rules/require-property-description.md +39 -79
  108. package/docs/rules/require-property-name.md +21 -30
  109. package/docs/rules/require-property-type.md +21 -21
  110. package/docs/rules/require-property.md +82 -33
  111. package/docs/rules/require-returns-check.md +636 -747
  112. package/docs/rules/require-returns-description.md +61 -933
  113. package/docs/rules/require-returns-type.md +42 -79
  114. package/docs/rules/require-returns.md +1081 -61
  115. package/docs/rules/require-yields-check.md +238 -517
  116. package/docs/rules/require-yields.md +517 -238
  117. package/docs/rules/valid-types.md +1 -1
  118. package/docs/settings.md +3 -1
  119. package/package.json +10 -9
  120. package/tsconfig.json +2 -3
@@ -8,26 +8,64 @@ var _jsdoccomment = require("@es-joy/jsdoccomment");
8
8
  var _debug = _interopRequireDefault(require("debug"));
9
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
10
  const debug = (0, _debug.default)('requireExportJsdoc');
11
+
12
+ /**
13
+ * @typedef {{
14
+ * value: string
15
+ * }} ValueObject
16
+ */
17
+
18
+ /**
19
+ * @typedef {{
20
+ * type?: string,
21
+ * value?: ValueObject|import('eslint').Rule.Node,
22
+ * props: {
23
+ * [key: string]: CreatedNode|null,
24
+ * },
25
+ * special?: true,
26
+ * globalVars?: CreatedNode,
27
+ * exported?: boolean,
28
+ * ANONYMOUS_DEFAULT?: import('eslint').Rule.Node
29
+ * }} CreatedNode
30
+ */
31
+
32
+ /**
33
+ * @returns {CreatedNode}
34
+ */
11
35
  const createNode = function () {
12
36
  return {
13
37
  props: {}
14
38
  };
15
39
  };
40
+
41
+ /**
42
+ * @param {CreatedNode|null} symbol
43
+ * @returns {string|null}
44
+ */
16
45
  const getSymbolValue = function (symbol) {
17
- /* istanbul ignore next */
46
+ /* istanbul ignore if */
18
47
  if (!symbol) {
19
- /* istanbul ignore next */
20
48
  return null;
21
49
  }
22
50
 
23
- /* istanbul ignore next */
51
+ /* istanbul ignore else */
24
52
  if (symbol.type === 'literal') {
25
- return symbol.value.value;
53
+ return (/** @type {ValueObject} */symbol.value.value
54
+ );
26
55
  }
27
56
 
28
57
  /* istanbul ignore next */
29
58
  return null;
30
59
  };
60
+
61
+ /**
62
+ *
63
+ * @param {import('estree').Identifier} node
64
+ * @param {CreatedNode} globals
65
+ * @param {CreatedNode} scope
66
+ * @param {SymbolOptions} opts
67
+ * @returns {CreatedNode|null}
68
+ */
31
69
  const getIdentifier = function (node, globals, scope, opts) {
32
70
  if (opts.simpleIdentifier) {
33
71
  // Type is Identier for noncomputed properties
@@ -54,10 +92,38 @@ const getIdentifier = function (node, globals, scope, opts) {
54
92
  }
55
93
  return null;
56
94
  };
57
- let createSymbol = null;
58
95
 
59
- // eslint-disable-next-line complexity
96
+ /**
97
+ * @callback CreateSymbol
98
+ * @param {import('eslint').Rule.Node|null} node
99
+ * @param {CreatedNode} globals
100
+ * @param {import('eslint').Rule.Node|null} value
101
+ * @param {CreatedNode} [scope]
102
+ * @param {boolean|SymbolOptions} [isGlobal]
103
+ * @returns {CreatedNode|null}
104
+ */
105
+
106
+ /** @type {CreateSymbol} */
107
+ let createSymbol; // eslint-disable-line prefer-const
108
+
109
+ /* eslint-disable complexity -- Temporary */
110
+
111
+ /**
112
+ * @typedef {{
113
+ * simpleIdentifier?: boolean
114
+ * }} SymbolOptions
115
+ */
116
+
117
+ /**
118
+ *
119
+ * @param {import('eslint').Rule.Node} node
120
+ * @param {CreatedNode} globals
121
+ * @param {CreatedNode} scope
122
+ * @param {SymbolOptions} [opt]
123
+ * @returns {CreatedNode|null}
124
+ */
60
125
  const getSymbol = function (node, globals, scope, opt) {
126
+ /* eslint-enable complexity -- Temporary */
61
127
  const opts = opt || {};
62
128
  /* istanbul ignore next */
63
129
  // eslint-disable-next-line default-case
@@ -68,13 +134,15 @@ const getSymbol = function (node, globals, scope, opt) {
68
134
  }
69
135
  case 'MemberExpression':
70
136
  {
71
- const obj = getSymbol(node.object, globals, scope, opts);
72
- const propertySymbol = getSymbol(node.property, globals, scope, {
137
+ const obj = getSymbol( /** @type {import('eslint').Rule.Node} */
138
+ node.object, globals, scope, opts);
139
+ const propertySymbol = getSymbol( /** @type {import('eslint').Rule.Node} */
140
+ node.property, globals, scope, {
73
141
  simpleIdentifier: !node.computed
74
142
  });
75
143
  const propertyValue = getSymbolValue(propertySymbol);
76
144
 
77
- /* istanbul ignore next */
145
+ /* istanbul ignore else */
78
146
  if (obj && propertyValue && obj.props[propertyValue]) {
79
147
  const block = obj.props[propertyValue];
80
148
  return block;
@@ -87,16 +155,22 @@ const getSymbol = function (node, globals, scope, opt) {
87
155
  }
88
156
  */
89
157
  /* istanbul ignore next */
90
- debug(`MemberExpression: Missing property ${node.property.name}`);
158
+ debug(`MemberExpression: Missing property ${
159
+ /** @type {import('estree').PrivateIdentifier} */node.property.name}`);
91
160
 
92
161
  /* istanbul ignore next */
93
162
  return null;
94
163
  }
95
164
  case 'ClassExpression':
96
165
  {
97
- return getSymbol(node.body, globals, scope, opts);
166
+ return getSymbol( /** @type {import('eslint').Rule.Node} */
167
+ node.body, globals, scope, opts);
98
168
  }
169
+
170
+ // @ts-expect-error TS OK
99
171
  case 'TSTypeAliasDeclaration':
172
+ // @ts-expect-error TS OK
173
+ // Fallthrough
100
174
  case 'TSEnumDeclaration':
101
175
  case 'TSInterfaceDeclaration':
102
176
  case 'ClassDeclaration':
@@ -113,15 +187,20 @@ const getSymbol = function (node, globals, scope, opt) {
113
187
  }
114
188
  case 'AssignmentExpression':
115
189
  {
116
- return createSymbol(node.left, globals, node.right, scope, opts);
190
+ return createSymbol( /** @type {import('eslint').Rule.Node} */
191
+ node.left, globals, /** @type {import('eslint').Rule.Node} */
192
+ node.right, scope, opts);
117
193
  }
118
194
  case 'ClassBody':
119
195
  {
120
196
  const val = createNode();
121
197
  for (const method of node.body) {
122
- val.props[method.key.name] = createNode();
123
- val.props[method.key.name].type = 'object';
124
- val.props[method.key.name].value = method.value;
198
+ val.props[/** @type {import('estree').Identifier} */ /** @type {import('estree').MethodDefinition} */method.key.name] = createNode();
199
+ /** @type {{[key: string]: CreatedNode}} */
200
+ val.props[/** @type {import('estree').Identifier} */ /** @type {import('estree').MethodDefinition} */method.key.name].type = 'object';
201
+ /** @type {{[key: string]: CreatedNode}} */
202
+ val.props[/** @type {import('estree').Identifier} */ /** @type {import('estree').MethodDefinition} */method.key.name].value = /** @type {import('eslint').Rule.Node} */
203
+ /** @type {import('estree').MethodDefinition} */method.value;
125
204
  }
126
205
  val.type = 'object';
127
206
  val.value = node.parent;
@@ -139,10 +218,13 @@ const getSymbol = function (node, globals, scope, opt) {
139
218
  'ExperimentalSpreadProperty'].includes(prop.type)) {
140
219
  continue;
141
220
  }
142
- const propVal = getSymbol(prop.value, globals, scope, opts);
143
- /* istanbul ignore next */
221
+ const propVal = getSymbol( /** @type {import('eslint').Rule.Node} */
222
+ /** @type {import('estree').Property} */
223
+ prop.value, globals, scope, opts);
224
+ /* istanbul ignore if */
144
225
  if (propVal) {
145
- val.props[prop.key.name] = propVal;
226
+ val.props[/** @type {import('estree').PrivateIdentifier} */
227
+ /** @type {import('estree').Property} */prop.key.name] = propVal;
146
228
  }
147
229
  }
148
230
  return val;
@@ -159,6 +241,16 @@ const getSymbol = function (node, globals, scope, opt) {
159
241
  /* istanbul ignore next */
160
242
  return null;
161
243
  };
244
+
245
+ /**
246
+ *
247
+ * @param {CreatedNode} block
248
+ * @param {string} name
249
+ * @param {CreatedNode|null} value
250
+ * @param {CreatedNode} globals
251
+ * @param {boolean|SymbolOptions|undefined} isGlobal
252
+ * @returns {void}
253
+ */
162
254
  const createBlockSymbol = function (block, name, value, globals, isGlobal) {
163
255
  block.props[name] = value;
164
256
  if (isGlobal && globals.props.window && globals.props.window.special) {
@@ -167,22 +259,29 @@ const createBlockSymbol = function (block, name, value, globals, isGlobal) {
167
259
  };
168
260
  createSymbol = function (node, globals, value, scope, isGlobal) {
169
261
  const block = scope || globals;
262
+ /* istanbul ignore if */
263
+ if (!node) {
264
+ return null;
265
+ }
170
266
  let symbol;
171
267
  // eslint-disable-next-line default-case
172
268
  switch (node.type) {
173
269
  case 'FunctionDeclaration':
174
270
  /* istanbul ignore next */
271
+ // @ts-expect-error TS OK
175
272
  // Fall through
176
273
  case 'TSEnumDeclaration':
177
274
  case 'TSInterfaceDeclaration':
178
275
  /* istanbul ignore next */
276
+ // @ts-expect-error TS OK
179
277
  // Fall through
180
278
  case 'TSTypeAliasDeclaration':
181
279
  case 'ClassDeclaration':
182
280
  {
183
- /* istanbul ignore next */
184
- if (node.id && node.id.type === 'Identifier') {
185
- return createSymbol(node.id, globals, node, globals);
281
+ const nde = /** @type {import('estree').ClassDeclaration} */node;
282
+ /* istanbul ignore else */
283
+ if (nde.id && nde.id.type === 'Identifier') {
284
+ return createSymbol( /** @type {import('eslint').Rule.Node} */nde.id, globals, node, globals);
186
285
  }
187
286
 
188
287
  /* istanbul ignore next */
@@ -190,19 +289,20 @@ createSymbol = function (node, globals, value, scope, isGlobal) {
190
289
  }
191
290
  case 'Identifier':
192
291
  {
292
+ const nde = /** @type {import('estree').Identifier} */node;
193
293
  if (value) {
194
294
  const valueSymbol = getSymbol(value, globals, block);
195
- /* istanbul ignore next */
295
+ /* istanbul ignore else */
196
296
  if (valueSymbol) {
197
- createBlockSymbol(block, node.name, valueSymbol, globals, isGlobal);
198
- return block.props[node.name];
297
+ createBlockSymbol(block, nde.name, valueSymbol, globals, isGlobal);
298
+ return block.props[nde.name];
199
299
  }
200
300
 
201
301
  /* istanbul ignore next */
202
- debug('Identifier: Missing value symbol for %s', node.name);
302
+ debug('Identifier: Missing value symbol for %s', nde.name);
203
303
  } else {
204
- createBlockSymbol(block, node.name, createNode(), globals, isGlobal);
205
- return block.props[node.name];
304
+ createBlockSymbol(block, nde.name, createNode(), globals, isGlobal);
305
+ return block.props[nde.name];
206
306
  }
207
307
 
208
308
  /* istanbul ignore next */
@@ -210,48 +310,58 @@ createSymbol = function (node, globals, value, scope, isGlobal) {
210
310
  }
211
311
  case 'MemberExpression':
212
312
  {
213
- symbol = getSymbol(node.object, globals, block);
214
- const propertySymbol = getSymbol(node.property, globals, block, {
215
- simpleIdentifier: !node.computed
313
+ const nde = /** @type {import('estree').MemberExpression} */node;
314
+ symbol = getSymbol( /** @type {import('eslint').Rule.Node} */nde.object, globals, block);
315
+ const propertySymbol = getSymbol( /** @type {import('eslint').Rule.Node} */nde.property, globals, block, {
316
+ simpleIdentifier: !nde.computed
216
317
  });
217
318
  const propertyValue = getSymbolValue(propertySymbol);
218
319
  if (symbol && propertyValue) {
219
- createBlockSymbol(symbol, propertyValue, getSymbol(value, globals, block), globals, isGlobal);
320
+ createBlockSymbol(symbol, propertyValue, getSymbol( /** @type {import('eslint').Rule.Node} */
321
+ value, globals, block), globals, isGlobal);
220
322
  return symbol.props[propertyValue];
221
323
  }
222
-
223
- /* istanbul ignore next */
224
- debug('MemberExpression: Missing symbol: %s', node.property.name);
324
+ debug('MemberExpression: Missing symbol: %s', /** @type {import('estree').Identifier} */nde.property.name);
225
325
  break;
226
326
  }
227
327
  }
228
328
  return null;
229
329
  };
230
330
 
231
- // Creates variables from variable definitions
331
+ /**
332
+ * Creates variables from variable definitions
333
+ * @param {import('eslint').Rule.Node} node
334
+ * @param {CreatedNode} globals
335
+ * @param {import('./rules/requireJsdoc.js').RequireJsdocOpts} opts
336
+ * @returns {void}
337
+ */
232
338
  const initVariables = function (node, globals, opts) {
233
339
  // eslint-disable-next-line default-case
234
340
  switch (node.type) {
235
341
  case 'Program':
236
342
  {
237
343
  for (const childNode of node.body) {
238
- initVariables(childNode, globals, opts);
344
+ initVariables( /** @type {import('eslint').Rule.Node} */
345
+ childNode, globals, opts);
239
346
  }
240
347
  break;
241
348
  }
242
349
  case 'ExpressionStatement':
243
350
  {
244
- initVariables(node.expression, globals, opts);
351
+ initVariables( /** @type {import('eslint').Rule.Node} */
352
+ node.expression, globals, opts);
245
353
  break;
246
354
  }
247
355
  case 'VariableDeclaration':
248
356
  {
249
357
  for (const declaration of node.declarations) {
250
358
  // let and const
251
- const symbol = createSymbol(declaration.id, globals, null, globals);
359
+ const symbol = createSymbol( /** @type {import('eslint').Rule.Node} */
360
+ declaration.id, globals, null, globals);
252
361
  if (opts.initWindow && node.kind === 'var' && globals.props.window) {
253
362
  // If var, also add to window
254
- globals.props.window.props[declaration.id.name] = symbol;
363
+ globals.props.window.props[/** @type {import('estree').Identifier} */
364
+ declaration.id.name] = symbol;
255
365
  }
256
366
  }
257
367
  break;
@@ -259,16 +369,26 @@ const initVariables = function (node, globals, opts) {
259
369
  case 'ExportNamedDeclaration':
260
370
  {
261
371
  if (node.declaration) {
262
- initVariables(node.declaration, globals, opts);
372
+ initVariables( /** @type {import('eslint').Rule.Node} */
373
+ node.declaration, globals, opts);
263
374
  }
264
375
  break;
265
376
  }
266
377
  }
267
378
  };
268
379
 
269
- // Populates variable maps using AST
270
- // eslint-disable-next-line complexity
380
+ /* eslint-disable complexity -- Temporary */
381
+
382
+ /**
383
+ * Populates variable maps using AST
384
+ * @param {import('eslint').Rule.Node} node
385
+ * @param {CreatedNode} globals
386
+ * @param {import('./rules/requireJsdoc.js').RequireJsdocOpts} opt
387
+ * @param {true} [isExport]
388
+ * @returns {boolean}
389
+ */
271
390
  const mapVariables = function (node, globals, opt, isExport) {
391
+ /* eslint-enable complexity -- Temporary */
272
392
  /* istanbul ignore next */
273
393
  const opts = opt || {};
274
394
  /* istanbul ignore next */
@@ -279,25 +399,31 @@ const mapVariables = function (node, globals, opt, isExport) {
279
399
  return false;
280
400
  }
281
401
  for (const childNode of node.body) {
282
- mapVariables(childNode, globals, opts);
402
+ mapVariables( /** @type {import('eslint').Rule.Node} */
403
+ childNode, globals, opts);
283
404
  }
284
405
  break;
285
406
  }
286
407
  case 'ExpressionStatement':
287
408
  {
288
- mapVariables(node.expression, globals, opts);
409
+ mapVariables( /** @type {import('eslint').Rule.Node} */
410
+ node.expression, globals, opts);
289
411
  break;
290
412
  }
291
413
  case 'AssignmentExpression':
292
414
  {
293
- createSymbol(node.left, globals, node.right);
415
+ createSymbol( /** @type {import('eslint').Rule.Node} */
416
+ node.left, globals, /** @type {import('eslint').Rule.Node} */
417
+ node.right);
294
418
  break;
295
419
  }
296
420
  case 'VariableDeclaration':
297
421
  {
298
422
  for (const declaration of node.declarations) {
299
- const isGlobal = opts.initWindow && node.kind === 'var' && globals.props.window;
300
- const symbol = createSymbol(declaration.id, globals, declaration.init, globals, isGlobal);
423
+ const isGlobal = Boolean(opts.initWindow && node.kind === 'var' && globals.props.window);
424
+ const symbol = createSymbol( /** @type {import('eslint').Rule.Node} */
425
+ declaration.id, globals, /** @type {import('eslint').Rule.Node} */
426
+ declaration.init, globals, isGlobal);
301
427
  if (symbol && isExport) {
302
428
  symbol.exported = true;
303
429
  }
@@ -306,19 +432,24 @@ const mapVariables = function (node, globals, opt, isExport) {
306
432
  }
307
433
  case 'FunctionDeclaration':
308
434
  {
309
- /* istanbul ignore next */
310
- if (node.id.type === 'Identifier') {
311
- createSymbol(node.id, globals, node, globals, true);
435
+ /* istanbul ignore if */
436
+ if ( /** @type {import('estree').Identifier} */node.id.type === 'Identifier') {
437
+ createSymbol( /** @type {import('eslint').Rule.Node} */
438
+ node.id, globals, node, globals, true);
312
439
  }
313
440
  break;
314
441
  }
315
442
  case 'ExportDefaultDeclaration':
316
443
  {
317
- const symbol = createSymbol(node.declaration, globals, node.declaration);
444
+ const symbol = createSymbol( /** @type {import('eslint').Rule.Node} */
445
+ node.declaration, globals, /** @type {import('eslint').Rule.Node} */
446
+ node.declaration);
318
447
  if (symbol) {
319
448
  symbol.exported = true;
320
- } else if (!node.id) {
321
- globals.ANONYMOUS_DEFAULT = node.declaration;
449
+ } else {
450
+ // if (!node.id) {
451
+ globals.ANONYMOUS_DEFAULT = /** @type {import('eslint').Rule.Node} */
452
+ node.declaration;
322
453
  }
323
454
  break;
324
455
  }
@@ -326,24 +457,29 @@ const mapVariables = function (node, globals, opt, isExport) {
326
457
  {
327
458
  if (node.declaration) {
328
459
  if (node.declaration.type === 'VariableDeclaration') {
329
- mapVariables(node.declaration, globals, opts, true);
460
+ mapVariables( /** @type {import('eslint').Rule.Node} */
461
+ node.declaration, globals, opts, true);
330
462
  } else {
331
- const symbol = createSymbol(node.declaration, globals, node.declaration);
332
- /* istanbul ignore next */
463
+ const symbol = createSymbol( /** @type {import('eslint').Rule.Node} */
464
+ node.declaration, globals, /** @type {import('eslint').Rule.Node} */
465
+ node.declaration);
466
+ /* istanbul ignore if */
333
467
  if (symbol) {
334
468
  symbol.exported = true;
335
469
  }
336
470
  }
337
471
  }
338
472
  for (const specifier of node.specifiers) {
339
- mapVariables(specifier, globals, opts);
473
+ mapVariables( /** @type {import('eslint').Rule.Node} */
474
+ specifier, globals, opts);
340
475
  }
341
476
  break;
342
477
  }
343
478
  case 'ExportSpecifier':
344
479
  {
345
- const symbol = getSymbol(node.local, globals, globals);
346
- /* istanbul ignore next */
480
+ const symbol = getSymbol( /** @type {import('eslint').Rule.Node} */
481
+ node.local, globals, globals);
482
+ /* istanbul ignore if */
347
483
  if (symbol) {
348
484
  symbol.exported = true;
349
485
  }
@@ -351,7 +487,7 @@ const mapVariables = function (node, globals, opt, isExport) {
351
487
  }
352
488
  case 'ClassDeclaration':
353
489
  {
354
- createSymbol(node.id, globals, node.body, globals);
490
+ createSymbol( /** @type {import('eslint').Rule.Node|null} */node.id, globals, /** @type {import('eslint').Rule.Node} */node.body, globals);
355
491
  break;
356
492
  }
357
493
  default:
@@ -362,20 +498,30 @@ const mapVariables = function (node, globals, opt, isExport) {
362
498
  }
363
499
  return true;
364
500
  };
501
+
502
+ /**
503
+ *
504
+ * @param {import('eslint').Rule.Node} node
505
+ * @param {CreatedNode|ValueObject|string|undefined|
506
+ * import('eslint').Rule.Node} block
507
+ * @param {(CreatedNode|ValueObject|string|
508
+ * import('eslint').Rule.Node)[]} [cache]
509
+ * @returns {boolean}
510
+ */
365
511
  const findNode = function (node, block, cache) {
366
512
  let blockCache = cache || [];
367
- /* istanbul ignore next */
368
513
  if (!block || blockCache.includes(block)) {
369
514
  return false;
370
515
  }
371
516
  blockCache = blockCache.slice();
372
517
  blockCache.push(block);
373
- if ((block.type === 'object' || block.type === 'MethodDefinition') && block.value === node) {
518
+ if (typeof block === 'object' && 'type' in block && (block.type === 'object' || block.type === 'MethodDefinition') && block.value === node) {
374
519
  return true;
375
520
  }
376
- const {
377
- props = block.body
378
- } = block;
521
+ if (typeof block !== 'object') {
522
+ return false;
523
+ }
524
+ const props = 'props' in block && block.props || 'body' in block && block.body;
379
525
  for (const propval of Object.values(props || {})) {
380
526
  if (Array.isArray(propval)) {
381
527
  /* istanbul ignore if */
@@ -392,6 +538,11 @@ const findNode = function (node, block, cache) {
392
538
  };
393
539
  const exportTypes = new Set(['ExportNamedDeclaration', 'ExportDefaultDeclaration']);
394
540
  const ignorableNestedTypes = new Set(['FunctionDeclaration', 'ArrowFunctionExpression', 'FunctionExpression']);
541
+
542
+ /**
543
+ * @param {import('eslint').Rule.Node} nde
544
+ * @returns {import('eslint').Rule.Node|false}
545
+ */
395
546
  const getExportAncestor = function (nde) {
396
547
  let node = nde;
397
548
  let idx = 0;
@@ -411,6 +562,11 @@ const getExportAncestor = function (nde) {
411
562
  };
412
563
  const canBeExportedByAncestorType = new Set(['TSPropertySignature', 'TSMethodSignature', 'ClassProperty', 'PropertyDefinition', 'Method']);
413
564
  const canExportChildrenType = new Set(['TSInterfaceBody', 'TSInterfaceDeclaration', 'TSTypeLiteral', 'TSTypeAliasDeclaration', 'ClassDeclaration', 'ClassBody', 'ClassDefinition', 'ClassExpression', 'Program']);
565
+
566
+ /**
567
+ * @param {import('eslint').Rule.Node} nde
568
+ * @returns {false|import('eslint').Rule.Node}
569
+ */
414
570
  const isExportByAncestor = function (nde) {
415
571
  if (!canBeExportedByAncestorType.has(nde.type)) {
416
572
  return false;
@@ -427,8 +583,16 @@ const isExportByAncestor = function (nde) {
427
583
  }
428
584
  return false;
429
585
  };
586
+
587
+ /**
588
+ *
589
+ * @param {CreatedNode} block
590
+ * @param {import('eslint').Rule.Node} node
591
+ * @param {CreatedNode[]} [cache] Currently unused
592
+ * @returns {boolean}
593
+ */
430
594
  const findExportedNode = function (block, node, cache) {
431
- /* istanbul ignore next */
595
+ /* istanbul ignore if */
432
596
  if (block === null) {
433
597
  return false;
434
598
  }
@@ -437,8 +601,9 @@ const findExportedNode = function (block, node, cache) {
437
601
  props
438
602
  } = block;
439
603
  for (const propval of Object.values(props)) {
440
- blockCache.push(propval);
441
- if (propval.exported && (node === propval.value || findNode(node, propval.value))) {
604
+ const pval = /** @type {CreatedNode} */propval;
605
+ blockCache.push(pval);
606
+ if (pval.exported && (node === pval.value || findNode(node, pval.value))) {
442
607
  return true;
443
608
  }
444
609
 
@@ -448,6 +613,14 @@ const findExportedNode = function (block, node, cache) {
448
613
 
449
614
  return false;
450
615
  };
616
+
617
+ /**
618
+ *
619
+ * @param {import('eslint').Rule.Node} node
620
+ * @param {CreatedNode} globals
621
+ * @param {import('./rules/requireJsdoc.js').RequireJsdocOpts} opt
622
+ * @returns {boolean}
623
+ */
451
624
  const isNodeExported = function (node, globals, opt) {
452
625
  var _globals$props$module, _globals$props$module2;
453
626
  const moduleExports = (_globals$props$module = globals.props.module) === null || _globals$props$module === void 0 ? void 0 : (_globals$props$module2 = _globals$props$module.props) === null || _globals$props$module2 === void 0 ? void 0 : _globals$props$module2.exports;
@@ -462,6 +635,14 @@ const isNodeExported = function (node, globals, opt) {
462
635
  }
463
636
  return false;
464
637
  };
638
+
639
+ /**
640
+ *
641
+ * @param {import('eslint').Rule.Node} node
642
+ * @param {CreatedNode} globalVars
643
+ * @param {import('./rules/requireJsdoc.js').RequireJsdocOpts} opts
644
+ * @returns {boolean}
645
+ */
465
646
  const parseRecursive = function (node, globalVars, opts) {
466
647
  // Iterate from top using recursion - stop at first processed node from top
467
648
  if (node.parent && parseRecursive(node.parent, globalVars, opts)) {
@@ -469,6 +650,14 @@ const parseRecursive = function (node, globalVars, opts) {
469
650
  }
470
651
  return mapVariables(node, globalVars, opts);
471
652
  };
653
+
654
+ /**
655
+ *
656
+ * @param {import('eslint').Rule.Node} ast
657
+ * @param {import('eslint').Rule.Node} node
658
+ * @param {import('./rules/requireJsdoc.js').RequireJsdocOpts} opt
659
+ * @returns {CreatedNode}
660
+ */
472
661
  const parse = function (ast, node, opt) {
473
662
  /* istanbul ignore next */
474
663
  const opts = opt || {
@@ -494,9 +683,19 @@ const parse = function (ast, node, opt) {
494
683
  mapVariables(ast, globalVars, opts);
495
684
  }
496
685
  return {
497
- globalVars
686
+ globalVars,
687
+ props: {}
498
688
  };
499
689
  };
690
+
691
+ /**
692
+ *
693
+ * @param {import('eslint').Rule.Node} node
694
+ * @param {import('eslint').SourceCode} sourceCode
695
+ * @param {import('./rules/requireJsdoc.js').RequireJsdocOpts} opt
696
+ * @param {import('./iterateJsdoc.js').Settings} settings
697
+ * @returns {boolean}
698
+ */
500
699
  const isUncommentedExport = function (node, sourceCode, opt, settings) {
501
700
  // console.log({node});
502
701
  // Optimize with ancestor check for esm
@@ -515,8 +714,10 @@ const isUncommentedExport = function (node, sourceCode, opt, settings) {
515
714
  return true;
516
715
  }
517
716
  }
518
- const parseResult = parse(sourceCode.ast, node, opt);
519
- return isNodeExported(node, parseResult.globalVars, opt);
717
+ const ast = /** @type {unknown} */sourceCode.ast;
718
+ const parseResult = parse( /** @type {import('eslint').Rule.Node} */
719
+ ast, node, opt);
720
+ return isNodeExported(node, /** @type {CreatedNode} */parseResult.globalVars, opt);
520
721
  };
521
722
  var _default = {
522
723
  isUncommentedExport,