eslint-plugin-jsdoc 44.2.4 → 44.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/dist/WarnSettings.js +0 -1
  2. package/dist/WarnSettings.js.map +1 -1
  3. package/dist/alignTransform.js +1 -1
  4. package/dist/alignTransform.js.map +1 -1
  5. package/dist/bin/generateRule.js +5 -4
  6. package/dist/bin/generateRule.js.map +1 -1
  7. package/dist/exportParser.js +206 -135
  8. package/dist/exportParser.js.map +1 -1
  9. package/dist/generateRule.js +5 -4
  10. package/dist/generateRule.js.map +1 -1
  11. package/dist/iterateJsdoc.js +21 -48
  12. package/dist/iterateJsdoc.js.map +1 -1
  13. package/dist/jsdocUtils.js +126 -92
  14. package/dist/jsdocUtils.js.map +1 -1
  15. package/dist/rules/checkAccess.js +1 -1
  16. package/dist/rules/checkAccess.js.map +1 -1
  17. package/dist/rules/checkAlignment.js +1 -1
  18. package/dist/rules/checkAlignment.js.map +1 -1
  19. package/dist/rules/checkExamples.js +4 -4
  20. package/dist/rules/checkExamples.js.map +1 -1
  21. package/dist/rules/checkIndentation.js +2 -2
  22. package/dist/rules/checkIndentation.js.map +1 -1
  23. package/dist/rules/checkLineAlignment.js +4 -4
  24. package/dist/rules/checkLineAlignment.js.map +1 -1
  25. package/dist/rules/checkParamNames.js +18 -5
  26. package/dist/rules/checkParamNames.js.map +1 -1
  27. package/dist/rules/checkPropertyNames.js +1 -1
  28. package/dist/rules/checkPropertyNames.js.map +1 -1
  29. package/dist/rules/checkSyntax.js +1 -1
  30. package/dist/rules/checkSyntax.js.map +1 -1
  31. package/dist/rules/checkTagNames.js +3 -7
  32. package/dist/rules/checkTagNames.js.map +1 -1
  33. package/dist/rules/checkTypes.js +2 -6
  34. package/dist/rules/checkTypes.js.map +1 -1
  35. package/dist/rules/checkValues.js +2 -2
  36. package/dist/rules/checkValues.js.map +1 -1
  37. package/dist/rules/emptyTags.js +1 -1
  38. package/dist/rules/emptyTags.js.map +1 -1
  39. package/dist/rules/implementsOnClasses.js +1 -1
  40. package/dist/rules/implementsOnClasses.js.map +1 -1
  41. package/dist/rules/informativeDocs.js +1 -1
  42. package/dist/rules/informativeDocs.js.map +1 -1
  43. package/dist/rules/matchDescription.js +1 -1
  44. package/dist/rules/matchDescription.js.map +1 -1
  45. package/dist/rules/matchName.js +1 -1
  46. package/dist/rules/matchName.js.map +1 -1
  47. package/dist/rules/multilineBlocks.js +1 -1
  48. package/dist/rules/multilineBlocks.js.map +1 -1
  49. package/dist/rules/noBadBlocks.js +2 -2
  50. package/dist/rules/noBadBlocks.js.map +1 -1
  51. package/dist/rules/noBlankBlockDescriptions.js +1 -1
  52. package/dist/rules/noBlankBlockDescriptions.js.map +1 -1
  53. package/dist/rules/noBlankBlocks.js +1 -1
  54. package/dist/rules/noBlankBlocks.js.map +1 -1
  55. package/dist/rules/noDefaults.js +1 -1
  56. package/dist/rules/noDefaults.js.map +1 -1
  57. package/dist/rules/noMissingSyntax.js +4 -10
  58. package/dist/rules/noMissingSyntax.js.map +1 -1
  59. package/dist/rules/noMultiAsterisks.js +1 -1
  60. package/dist/rules/noMultiAsterisks.js.map +1 -1
  61. package/dist/rules/noRestrictedSyntax.js +4 -10
  62. package/dist/rules/noRestrictedSyntax.js.map +1 -1
  63. package/dist/rules/noTypes.js +1 -1
  64. package/dist/rules/noTypes.js.map +1 -1
  65. package/dist/rules/noUndefinedTypes.js +6 -9
  66. package/dist/rules/noUndefinedTypes.js.map +1 -1
  67. package/dist/rules/requireDescription.js +1 -1
  68. package/dist/rules/requireDescription.js.map +1 -1
  69. package/dist/rules/requireDescriptionCompleteSentence.js +4 -4
  70. package/dist/rules/requireDescriptionCompleteSentence.js.map +1 -1
  71. package/dist/rules/requireExample.js +1 -1
  72. package/dist/rules/requireExample.js.map +1 -1
  73. package/dist/rules/requireFileOverview.js +1 -1
  74. package/dist/rules/requireFileOverview.js.map +1 -1
  75. package/dist/rules/requireHyphenBeforeParamDescription.js +4 -7
  76. package/dist/rules/requireHyphenBeforeParamDescription.js.map +1 -1
  77. package/dist/rules/requireJsdoc.js +13 -8
  78. package/dist/rules/requireJsdoc.js.map +1 -1
  79. package/dist/rules/requireParam.js +84 -22
  80. package/dist/rules/requireParam.js.map +1 -1
  81. package/dist/rules/requireParamDescription.js +1 -1
  82. package/dist/rules/requireParamDescription.js.map +1 -1
  83. package/dist/rules/requireParamName.js +1 -1
  84. package/dist/rules/requireParamName.js.map +1 -1
  85. package/dist/rules/requireParamType.js +1 -1
  86. package/dist/rules/requireParamType.js.map +1 -1
  87. package/dist/rules/requireProperty.js +1 -1
  88. package/dist/rules/requireProperty.js.map +1 -1
  89. package/dist/rules/requirePropertyDescription.js +1 -1
  90. package/dist/rules/requirePropertyDescription.js.map +1 -1
  91. package/dist/rules/requirePropertyName.js +1 -1
  92. package/dist/rules/requirePropertyName.js.map +1 -1
  93. package/dist/rules/requirePropertyType.js +1 -1
  94. package/dist/rules/requirePropertyType.js.map +1 -1
  95. package/dist/rules/requireReturns.js +1 -2
  96. package/dist/rules/requireReturns.js.map +1 -1
  97. package/dist/rules/requireReturnsCheck.js +1 -1
  98. package/dist/rules/requireReturnsCheck.js.map +1 -1
  99. package/dist/rules/requireReturnsDescription.js +1 -1
  100. package/dist/rules/requireReturnsDescription.js.map +1 -1
  101. package/dist/rules/requireReturnsType.js +1 -1
  102. package/dist/rules/requireReturnsType.js.map +1 -1
  103. package/dist/rules/requireThrows.js +1 -2
  104. package/dist/rules/requireThrows.js.map +1 -1
  105. package/dist/rules/requireYields.js +1 -2
  106. package/dist/rules/requireYields.js.map +1 -1
  107. package/dist/rules/requireYieldsCheck.js +1 -1
  108. package/dist/rules/requireYieldsCheck.js.map +1 -1
  109. package/dist/rules/sortTags.js +2 -2
  110. package/dist/rules/sortTags.js.map +1 -1
  111. package/dist/rules/tagLines.js +1 -1
  112. package/dist/rules/tagLines.js.map +1 -1
  113. package/dist/rules/textEscaping.js +3 -3
  114. package/dist/rules/textEscaping.js.map +1 -1
  115. package/dist/rules/validTypes.js +2 -2
  116. package/dist/rules/validTypes.js.map +1 -1
  117. package/dist/tagNames.js +0 -2
  118. package/dist/tagNames.js.map +1 -1
  119. package/dist/utils/hasReturnValue.js +0 -5
  120. package/dist/utils/hasReturnValue.js.map +1 -1
  121. package/docs/rules/check-line-alignment.md +7 -0
  122. package/docs/rules/no-undefined-types.md +6 -0
  123. package/docs/rules/require-param.md +4 -0
  124. package/docs/settings.md +2 -0
  125. package/package.json +9 -9
@@ -10,9 +10,27 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
10
10
  const debug = (0, _debug.default)('requireExportJsdoc');
11
11
 
12
12
  /**
13
- * @returns {{
14
- * props: object
15
- * }}
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}
16
34
  */
17
35
  const createNode = function () {
18
36
  return {
@@ -21,19 +39,19 @@ const createNode = function () {
21
39
  };
22
40
 
23
41
  /**
24
- * @param {} symbol
25
- * @returns {null}
42
+ * @param {CreatedNode|null} symbol
43
+ * @returns {string|null}
26
44
  */
27
45
  const getSymbolValue = function (symbol) {
28
- /* istanbul ignore next */
46
+ /* istanbul ignore if */
29
47
  if (!symbol) {
30
- /* istanbul ignore next */
31
48
  return null;
32
49
  }
33
50
 
34
- /* istanbul ignore next */
51
+ /* istanbul ignore else */
35
52
  if (symbol.type === 'literal') {
36
- return symbol.value.value;
53
+ return (/** @type {ValueObject} */symbol.value.value
54
+ );
37
55
  }
38
56
 
39
57
  /* istanbul ignore next */
@@ -42,11 +60,11 @@ const getSymbolValue = function (symbol) {
42
60
 
43
61
  /**
44
62
  *
45
- * @param {} node
46
- * @param {} globals
47
- * @param {} scope
48
- * @param {} opts
49
- * @returns {}
63
+ * @param {import('estree').Identifier} node
64
+ * @param {CreatedNode} globals
65
+ * @param {CreatedNode} scope
66
+ * @param {SymbolOptions} opts
67
+ * @returns {CreatedNode|null}
50
68
  */
51
69
  const getIdentifier = function (node, globals, scope, opts) {
52
70
  if (opts.simpleIdentifier) {
@@ -74,17 +92,35 @@ const getIdentifier = function (node, globals, scope, opts) {
74
92
  }
75
93
  return null;
76
94
  };
77
- let createSymbol = null;
95
+
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
78
108
 
79
109
  /* eslint-disable complexity -- Temporary */
80
110
 
111
+ /**
112
+ * @typedef {{
113
+ * simpleIdentifier?: boolean
114
+ * }} SymbolOptions
115
+ */
116
+
81
117
  /**
82
118
  *
83
- * @param {} node
84
- * @param {} globals
85
- * @param {} scope
86
- * @param {} opt
87
- * @returns {}
119
+ * @param {import('eslint').Rule.Node} node
120
+ * @param {CreatedNode} globals
121
+ * @param {CreatedNode} scope
122
+ * @param {SymbolOptions} [opt]
123
+ * @returns {CreatedNode|null}
88
124
  */
89
125
  const getSymbol = function (node, globals, scope, opt) {
90
126
  /* eslint-enable complexity -- Temporary */
@@ -98,13 +134,15 @@ const getSymbol = function (node, globals, scope, opt) {
98
134
  }
99
135
  case 'MemberExpression':
100
136
  {
101
- const obj = getSymbol(node.object, globals, scope, opts);
102
- 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, {
103
141
  simpleIdentifier: !node.computed
104
142
  });
105
143
  const propertyValue = getSymbolValue(propertySymbol);
106
144
 
107
- /* istanbul ignore next */
145
+ /* istanbul ignore else */
108
146
  if (obj && propertyValue && obj.props[propertyValue]) {
109
147
  const block = obj.props[propertyValue];
110
148
  return block;
@@ -117,16 +155,22 @@ const getSymbol = function (node, globals, scope, opt) {
117
155
  }
118
156
  */
119
157
  /* istanbul ignore next */
120
- debug(`MemberExpression: Missing property ${node.property.name}`);
158
+ debug(`MemberExpression: Missing property ${
159
+ /** @type {import('estree').PrivateIdentifier} */node.property.name}`);
121
160
 
122
161
  /* istanbul ignore next */
123
162
  return null;
124
163
  }
125
164
  case 'ClassExpression':
126
165
  {
127
- return getSymbol(node.body, globals, scope, opts);
166
+ return getSymbol( /** @type {import('eslint').Rule.Node} */
167
+ node.body, globals, scope, opts);
128
168
  }
169
+
170
+ // @ts-expect-error TS OK
129
171
  case 'TSTypeAliasDeclaration':
172
+ // @ts-expect-error TS OK
173
+ // Fallthrough
130
174
  case 'TSEnumDeclaration':
131
175
  case 'TSInterfaceDeclaration':
132
176
  case 'ClassDeclaration':
@@ -143,15 +187,20 @@ const getSymbol = function (node, globals, scope, opt) {
143
187
  }
144
188
  case 'AssignmentExpression':
145
189
  {
146
- 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);
147
193
  }
148
194
  case 'ClassBody':
149
195
  {
150
196
  const val = createNode();
151
197
  for (const method of node.body) {
152
- val.props[method.key.name] = createNode();
153
- val.props[method.key.name].type = 'object';
154
- 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;
155
204
  }
156
205
  val.type = 'object';
157
206
  val.value = node.parent;
@@ -169,10 +218,13 @@ const getSymbol = function (node, globals, scope, opt) {
169
218
  'ExperimentalSpreadProperty'].includes(prop.type)) {
170
219
  continue;
171
220
  }
172
- const propVal = getSymbol(prop.value, globals, scope, opts);
173
- /* 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 */
174
225
  if (propVal) {
175
- val.props[prop.key.name] = propVal;
226
+ val.props[/** @type {import('estree').PrivateIdentifier} */
227
+ /** @type {import('estree').Property} */prop.key.name] = propVal;
176
228
  }
177
229
  }
178
230
  return val;
@@ -192,11 +244,11 @@ const getSymbol = function (node, globals, scope, opt) {
192
244
 
193
245
  /**
194
246
  *
195
- * @param {} block
196
- * @param {} name
197
- * @param {} value
198
- * @param {} globals
199
- * @param {} isGlobal
247
+ * @param {CreatedNode} block
248
+ * @param {string} name
249
+ * @param {CreatedNode|null} value
250
+ * @param {CreatedNode} globals
251
+ * @param {boolean|SymbolOptions|undefined} isGlobal
200
252
  * @returns {void}
201
253
  */
202
254
  const createBlockSymbol = function (block, name, value, globals, isGlobal) {
@@ -205,34 +257,31 @@ const createBlockSymbol = function (block, name, value, globals, isGlobal) {
205
257
  globals.props.window.props[name] = value;
206
258
  }
207
259
  };
208
-
209
- /**
210
- *
211
- * @param {} node
212
- * @param {} globals
213
- * @param {} value
214
- * @param {} scope
215
- * @param {} isGlobal
216
- * @returns {null}
217
- */
218
260
  createSymbol = function (node, globals, value, scope, isGlobal) {
219
261
  const block = scope || globals;
262
+ /* istanbul ignore if */
263
+ if (!node) {
264
+ return null;
265
+ }
220
266
  let symbol;
221
267
  // eslint-disable-next-line default-case
222
268
  switch (node.type) {
223
269
  case 'FunctionDeclaration':
224
270
  /* istanbul ignore next */
271
+ // @ts-expect-error TS OK
225
272
  // Fall through
226
273
  case 'TSEnumDeclaration':
227
274
  case 'TSInterfaceDeclaration':
228
275
  /* istanbul ignore next */
276
+ // @ts-expect-error TS OK
229
277
  // Fall through
230
278
  case 'TSTypeAliasDeclaration':
231
279
  case 'ClassDeclaration':
232
280
  {
233
- /* istanbul ignore next */
234
- if (node.id && node.id.type === 'Identifier') {
235
- 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);
236
285
  }
237
286
 
238
287
  /* istanbul ignore next */
@@ -240,19 +289,20 @@ createSymbol = function (node, globals, value, scope, isGlobal) {
240
289
  }
241
290
  case 'Identifier':
242
291
  {
292
+ const nde = /** @type {import('estree').Identifier} */node;
243
293
  if (value) {
244
294
  const valueSymbol = getSymbol(value, globals, block);
245
- /* istanbul ignore next */
295
+ /* istanbul ignore else */
246
296
  if (valueSymbol) {
247
- createBlockSymbol(block, node.name, valueSymbol, globals, isGlobal);
248
- return block.props[node.name];
297
+ createBlockSymbol(block, nde.name, valueSymbol, globals, isGlobal);
298
+ return block.props[nde.name];
249
299
  }
250
300
 
251
301
  /* istanbul ignore next */
252
- debug('Identifier: Missing value symbol for %s', node.name);
302
+ debug('Identifier: Missing value symbol for %s', nde.name);
253
303
  } else {
254
- createBlockSymbol(block, node.name, createNode(), globals, isGlobal);
255
- return block.props[node.name];
304
+ createBlockSymbol(block, nde.name, createNode(), globals, isGlobal);
305
+ return block.props[nde.name];
256
306
  }
257
307
 
258
308
  /* istanbul ignore next */
@@ -260,18 +310,18 @@ createSymbol = function (node, globals, value, scope, isGlobal) {
260
310
  }
261
311
  case 'MemberExpression':
262
312
  {
263
- symbol = getSymbol(node.object, globals, block);
264
- const propertySymbol = getSymbol(node.property, globals, block, {
265
- 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
266
317
  });
267
318
  const propertyValue = getSymbolValue(propertySymbol);
268
319
  if (symbol && propertyValue) {
269
- 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);
270
322
  return symbol.props[propertyValue];
271
323
  }
272
-
273
- /* istanbul ignore next */
274
- debug('MemberExpression: Missing symbol: %s', node.property.name);
324
+ debug('MemberExpression: Missing symbol: %s', /** @type {import('estree').Identifier} */nde.property.name);
275
325
  break;
276
326
  }
277
327
  }
@@ -280,11 +330,10 @@ createSymbol = function (node, globals, value, scope, isGlobal) {
280
330
 
281
331
  /**
282
332
  * Creates variables from variable definitions
283
- *
284
- * @param {} node
285
- * @param {} globals
286
- * @param {} opts
287
- * @returns {}
333
+ * @param {import('eslint').Rule.Node} node
334
+ * @param {CreatedNode} globals
335
+ * @param {import('./rules/requireJsdoc.js').RequireJsdocOpts} opts
336
+ * @returns {void}
288
337
  */
289
338
  const initVariables = function (node, globals, opts) {
290
339
  // eslint-disable-next-line default-case
@@ -292,23 +341,27 @@ const initVariables = function (node, globals, opts) {
292
341
  case 'Program':
293
342
  {
294
343
  for (const childNode of node.body) {
295
- initVariables(childNode, globals, opts);
344
+ initVariables( /** @type {import('eslint').Rule.Node} */
345
+ childNode, globals, opts);
296
346
  }
297
347
  break;
298
348
  }
299
349
  case 'ExpressionStatement':
300
350
  {
301
- initVariables(node.expression, globals, opts);
351
+ initVariables( /** @type {import('eslint').Rule.Node} */
352
+ node.expression, globals, opts);
302
353
  break;
303
354
  }
304
355
  case 'VariableDeclaration':
305
356
  {
306
357
  for (const declaration of node.declarations) {
307
358
  // let and const
308
- const symbol = createSymbol(declaration.id, globals, null, globals);
359
+ const symbol = createSymbol( /** @type {import('eslint').Rule.Node} */
360
+ declaration.id, globals, null, globals);
309
361
  if (opts.initWindow && node.kind === 'var' && globals.props.window) {
310
362
  // If var, also add to window
311
- globals.props.window.props[declaration.id.name] = symbol;
363
+ globals.props.window.props[/** @type {import('estree').Identifier} */
364
+ declaration.id.name] = symbol;
312
365
  }
313
366
  }
314
367
  break;
@@ -316,7 +369,8 @@ const initVariables = function (node, globals, opts) {
316
369
  case 'ExportNamedDeclaration':
317
370
  {
318
371
  if (node.declaration) {
319
- initVariables(node.declaration, globals, opts);
372
+ initVariables( /** @type {import('eslint').Rule.Node} */
373
+ node.declaration, globals, opts);
320
374
  }
321
375
  break;
322
376
  }
@@ -327,11 +381,10 @@ const initVariables = function (node, globals, opts) {
327
381
 
328
382
  /**
329
383
  * Populates variable maps using AST
330
- *
331
- * @param {} node
332
- * @param {} globals
333
- * @param {} opt
334
- * @param {} isExport
384
+ * @param {import('eslint').Rule.Node} node
385
+ * @param {CreatedNode} globals
386
+ * @param {import('./rules/requireJsdoc.js').RequireJsdocOpts} opt
387
+ * @param {true} [isExport]
335
388
  * @returns {boolean}
336
389
  */
337
390
  const mapVariables = function (node, globals, opt, isExport) {
@@ -346,25 +399,31 @@ const mapVariables = function (node, globals, opt, isExport) {
346
399
  return false;
347
400
  }
348
401
  for (const childNode of node.body) {
349
- mapVariables(childNode, globals, opts);
402
+ mapVariables( /** @type {import('eslint').Rule.Node} */
403
+ childNode, globals, opts);
350
404
  }
351
405
  break;
352
406
  }
353
407
  case 'ExpressionStatement':
354
408
  {
355
- mapVariables(node.expression, globals, opts);
409
+ mapVariables( /** @type {import('eslint').Rule.Node} */
410
+ node.expression, globals, opts);
356
411
  break;
357
412
  }
358
413
  case 'AssignmentExpression':
359
414
  {
360
- 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);
361
418
  break;
362
419
  }
363
420
  case 'VariableDeclaration':
364
421
  {
365
422
  for (const declaration of node.declarations) {
366
- const isGlobal = opts.initWindow && node.kind === 'var' && globals.props.window;
367
- 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);
368
427
  if (symbol && isExport) {
369
428
  symbol.exported = true;
370
429
  }
@@ -373,19 +432,24 @@ const mapVariables = function (node, globals, opt, isExport) {
373
432
  }
374
433
  case 'FunctionDeclaration':
375
434
  {
376
- /* istanbul ignore next */
377
- if (node.id.type === 'Identifier') {
378
- 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);
379
439
  }
380
440
  break;
381
441
  }
382
442
  case 'ExportDefaultDeclaration':
383
443
  {
384
- 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);
385
447
  if (symbol) {
386
448
  symbol.exported = true;
387
- } else if (!node.id) {
388
- globals.ANONYMOUS_DEFAULT = node.declaration;
449
+ } else {
450
+ // if (!node.id) {
451
+ globals.ANONYMOUS_DEFAULT = /** @type {import('eslint').Rule.Node} */
452
+ node.declaration;
389
453
  }
390
454
  break;
391
455
  }
@@ -393,24 +457,29 @@ const mapVariables = function (node, globals, opt, isExport) {
393
457
  {
394
458
  if (node.declaration) {
395
459
  if (node.declaration.type === 'VariableDeclaration') {
396
- mapVariables(node.declaration, globals, opts, true);
460
+ mapVariables( /** @type {import('eslint').Rule.Node} */
461
+ node.declaration, globals, opts, true);
397
462
  } else {
398
- const symbol = createSymbol(node.declaration, globals, node.declaration);
399
- /* 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 */
400
467
  if (symbol) {
401
468
  symbol.exported = true;
402
469
  }
403
470
  }
404
471
  }
405
472
  for (const specifier of node.specifiers) {
406
- mapVariables(specifier, globals, opts);
473
+ mapVariables( /** @type {import('eslint').Rule.Node} */
474
+ specifier, globals, opts);
407
475
  }
408
476
  break;
409
477
  }
410
478
  case 'ExportSpecifier':
411
479
  {
412
- const symbol = getSymbol(node.local, globals, globals);
413
- /* istanbul ignore next */
480
+ const symbol = getSymbol( /** @type {import('eslint').Rule.Node} */
481
+ node.local, globals, globals);
482
+ /* istanbul ignore if */
414
483
  if (symbol) {
415
484
  symbol.exported = true;
416
485
  }
@@ -418,7 +487,7 @@ const mapVariables = function (node, globals, opt, isExport) {
418
487
  }
419
488
  case 'ClassDeclaration':
420
489
  {
421
- 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);
422
491
  break;
423
492
  }
424
493
  default:
@@ -432,25 +501,27 @@ const mapVariables = function (node, globals, opt, isExport) {
432
501
 
433
502
  /**
434
503
  *
435
- * @param {} node
436
- * @param {} block
437
- * @param {} cache
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]
438
509
  * @returns {boolean}
439
510
  */
440
511
  const findNode = function (node, block, cache) {
441
512
  let blockCache = cache || [];
442
- /* istanbul ignore next */
443
513
  if (!block || blockCache.includes(block)) {
444
514
  return false;
445
515
  }
446
516
  blockCache = blockCache.slice();
447
517
  blockCache.push(block);
448
- 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) {
449
519
  return true;
450
520
  }
451
- const {
452
- props = block.body
453
- } = block;
521
+ if (typeof block !== 'object') {
522
+ return false;
523
+ }
524
+ const props = 'props' in block && block.props || 'body' in block && block.body;
454
525
  for (const propval of Object.values(props || {})) {
455
526
  if (Array.isArray(propval)) {
456
527
  /* istanbul ignore if */
@@ -469,8 +540,8 @@ const exportTypes = new Set(['ExportNamedDeclaration', 'ExportDefaultDeclaration
469
540
  const ignorableNestedTypes = new Set(['FunctionDeclaration', 'ArrowFunctionExpression', 'FunctionExpression']);
470
541
 
471
542
  /**
472
- * @param {} nde
473
- * @returns {}
543
+ * @param {import('eslint').Rule.Node} nde
544
+ * @returns {import('eslint').Rule.Node|false}
474
545
  */
475
546
  const getExportAncestor = function (nde) {
476
547
  let node = nde;
@@ -493,8 +564,8 @@ const canBeExportedByAncestorType = new Set(['TSPropertySignature', 'TSMethodSig
493
564
  const canExportChildrenType = new Set(['TSInterfaceBody', 'TSInterfaceDeclaration', 'TSTypeLiteral', 'TSTypeAliasDeclaration', 'ClassDeclaration', 'ClassBody', 'ClassDefinition', 'ClassExpression', 'Program']);
494
565
 
495
566
  /**
496
- * @param {} nde
497
- * @returns {}
567
+ * @param {import('eslint').Rule.Node} nde
568
+ * @returns {false|import('eslint').Rule.Node}
498
569
  */
499
570
  const isExportByAncestor = function (nde) {
500
571
  if (!canBeExportedByAncestorType.has(nde.type)) {
@@ -515,13 +586,13 @@ const isExportByAncestor = function (nde) {
515
586
 
516
587
  /**
517
588
  *
518
- * @param {} block
519
- * @param {} node
520
- * @param {} cache
589
+ * @param {CreatedNode} block
590
+ * @param {import('eslint').Rule.Node} node
591
+ * @param {CreatedNode[]} [cache] Currently unused
521
592
  * @returns {boolean}
522
593
  */
523
594
  const findExportedNode = function (block, node, cache) {
524
- /* istanbul ignore next */
595
+ /* istanbul ignore if */
525
596
  if (block === null) {
526
597
  return false;
527
598
  }
@@ -530,8 +601,9 @@ const findExportedNode = function (block, node, cache) {
530
601
  props
531
602
  } = block;
532
603
  for (const propval of Object.values(props)) {
533
- blockCache.push(propval);
534
- 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))) {
535
607
  return true;
536
608
  }
537
609
 
@@ -544,9 +616,9 @@ const findExportedNode = function (block, node, cache) {
544
616
 
545
617
  /**
546
618
  *
547
- * @param {} node
548
- * @param {} globals
549
- * @param {} opt
619
+ * @param {import('eslint').Rule.Node} node
620
+ * @param {CreatedNode} globals
621
+ * @param {import('./rules/requireJsdoc.js').RequireJsdocOpts} opt
550
622
  * @returns {boolean}
551
623
  */
552
624
  const isNodeExported = function (node, globals, opt) {
@@ -566,9 +638,9 @@ const isNodeExported = function (node, globals, opt) {
566
638
 
567
639
  /**
568
640
  *
569
- * @param {} node
570
- * @param {} globalVars
571
- * @param {} opts
641
+ * @param {import('eslint').Rule.Node} node
642
+ * @param {CreatedNode} globalVars
643
+ * @param {import('./rules/requireJsdoc.js').RequireJsdocOpts} opts
572
644
  * @returns {boolean}
573
645
  */
574
646
  const parseRecursive = function (node, globalVars, opts) {
@@ -581,14 +653,10 @@ const parseRecursive = function (node, globalVars, opts) {
581
653
 
582
654
  /**
583
655
  *
584
- * @param {} ast
585
- * @param {} node
586
- * @param {} opt
587
- * @returns {{
588
- * globalVars: {
589
- * props: {};
590
- * };
591
- * }}
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}
592
660
  */
593
661
  const parse = function (ast, node, opt) {
594
662
  /* istanbul ignore next */
@@ -615,16 +683,17 @@ const parse = function (ast, node, opt) {
615
683
  mapVariables(ast, globalVars, opts);
616
684
  }
617
685
  return {
618
- globalVars
686
+ globalVars,
687
+ props: {}
619
688
  };
620
689
  };
621
690
 
622
691
  /**
623
692
  *
624
- * @param {} node
625
- * @param {} sourceCode
626
- * @param {} opt
627
- * @param {} settings
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
628
697
  * @returns {boolean}
629
698
  */
630
699
  const isUncommentedExport = function (node, sourceCode, opt, settings) {
@@ -645,8 +714,10 @@ const isUncommentedExport = function (node, sourceCode, opt, settings) {
645
714
  return true;
646
715
  }
647
716
  }
648
- const parseResult = parse(sourceCode.ast, node, opt);
649
- 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);
650
721
  };
651
722
  var _default = {
652
723
  isUncommentedExport,