eslint-plugin-jsdoc 44.2.2 → 44.2.3

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.
@@ -10,22 +10,53 @@ var _getDefaultTagStructureForMode = _interopRequireDefault(require("./getDefaul
10
10
  var _tagNames = require("./tagNames");
11
11
  var _hasReturnValue = require("./utils/hasReturnValue");
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
- /* eslint-disable jsdoc/no-undefined-types */
14
-
15
13
  /**
16
- * @typedef {"jsdoc"|"typescript"|"closure"} ParserMode
14
+ * @typedef {number} Integer
15
+ */
16
+ /**
17
+ * @typedef {import('./utils/hasReturnValue.js').ESTreeOrTypeScriptNode} ESTreeOrTypeScriptNode
17
18
  */
18
19
 
20
+ /**
21
+ * @typedef {"jsdoc"|"typescript"|"closure"|"permissive"} ParserMode
22
+ */
23
+ /**
24
+ * @type {import('./getDefaultTagStructureForMode.js').TagStructure}
25
+ */
19
26
  let tagStructure;
27
+
28
+ /**
29
+ * @param {ParserMode} mode
30
+ * @returns {void}
31
+ */
20
32
  const setTagStructure = mode => {
21
33
  tagStructure = (0, _getDefaultTagStructureForMode.default)(mode);
22
34
  };
23
35
 
24
- // Given a nested array of property names, reduce them to a single array,
25
- // appending the name of the root element along the way if present.
36
+ /**
37
+ * @typedef {{
38
+ * hasPropertyRest: boolean,
39
+ * hasRestElement: boolean,
40
+ * names: string[],
41
+ * rests: boolean[],
42
+ * }} FlattendRootInfo
43
+ */
44
+
45
+ /**
46
+ * Given a nested array of property names, reduce them to a single array,
47
+ * appending the name of the root element along the way if present.
48
+ *
49
+ * @param {} params
50
+ * @param {string} root
51
+ * @returns {FlattendRootInfo}
52
+ */
26
53
  const flattenRoots = (params, root = '') => {
27
54
  let hasRestElement = false;
28
55
  let hasPropertyRest = false;
56
+
57
+ /**
58
+ * @type {boolean[]}
59
+ */
29
60
  const rests = [];
30
61
  const names = params.reduce((acc, cur) => {
31
62
  if (Array.isArray(cur)) {
@@ -78,7 +109,7 @@ const flattenRoots = (params, root = '') => {
78
109
  };
79
110
 
80
111
  /**
81
- * @param {object} propSignature
112
+ * @param {ESTreeOrTypeScriptNode} propSignature
82
113
  * @returns {undefined|Array|string}
83
114
  */
84
115
  const getPropertiesFromPropertySignature = propSignature => {
@@ -94,15 +125,28 @@ const getPropertiesFromPropertySignature = propSignature => {
94
125
  };
95
126
 
96
127
  /**
97
- * @param {object} functionNode
98
- * @param {boolean} checkDefaultObjects
128
+ * @param {ESTreeOrTypeScriptNode} functionNode
129
+ * @param {boolean} [checkDefaultObjects]
99
130
  * @returns {Array}
100
131
  */
101
132
  const getFunctionParameterNames = (functionNode, checkDefaultObjects) => {
102
133
  var _functionNode$value;
103
- // eslint-disable-next-line complexity
134
+ /* eslint-disable complexity -- Temporary */
135
+ /**
136
+ * @param {} param
137
+ * @param {boolean} [isProperty]
138
+ * @returns {undefined|{
139
+ * isRestProperty: boolean|undefined,
140
+ * name: string,
141
+ * restElement: true
142
+ * }|[undefined|string, FlattendRootInfo|{
143
+ * name: Integer,
144
+ * restElement: boolean
145
+ * }[]]}
146
+ */
104
147
  const getParamName = (param, isProperty) => {
105
148
  var _param$left, _param$left3;
149
+ /* eslint-enable complexity -- Temporary */
106
150
  const hasLeftTypeAnnotation = 'left' in param && 'typeAnnotation' in param.left;
107
151
  if ('typeAnnotation' in param || hasLeftTypeAnnotation) {
108
152
  var _typeAnnotation$typeA;
@@ -140,14 +184,14 @@ const getFunctionParameterNames = (functionNode, checkDefaultObjects) => {
140
184
  // eslint-disable-next-line default-case
141
185
  switch (param.value.type) {
142
186
  case 'ArrayPattern':
143
- return [param.key.name, param.value.elements.map((prop, idx) => {
187
+ return [param.key.name, /** @type {import('estree').ArrayPattern} */param.value.elements.map((prop, idx) => {
144
188
  return {
145
189
  name: idx,
146
- restElement: prop.type === 'RestElement'
190
+ restElement: (prop === null || prop === void 0 ? void 0 : prop.type) === 'RestElement'
147
191
  };
148
192
  })];
149
193
  case 'ObjectPattern':
150
- return [param.key.name, param.value.properties.map(prop => {
194
+ return [param.key.name, /** @type {import('estree').ObjectPattern} */param.value.properties.map(prop => {
151
195
  return getParamName(prop, isProperty);
152
196
  })];
153
197
  case 'AssignmentPattern':
@@ -157,20 +201,20 @@ const getFunctionParameterNames = (functionNode, checkDefaultObjects) => {
157
201
  case 'Identifier':
158
202
  // Default parameter
159
203
  if (checkDefaultObjects && param.value.right.type === 'ObjectExpression') {
160
- return [param.key.name, param.value.right.properties.map(prop => {
204
+ return [param.key.name, /** @type {import('estree').AssignmentPattern} */param.value.right.properties.map(prop => {
161
205
  return getParamName(prop, isProperty);
162
206
  })];
163
207
  }
164
208
  break;
165
209
  case 'ObjectPattern':
166
- return [param.key.name, param.value.left.properties.map(prop => {
210
+ return [param.key.name, /** @type {import('estree').ObjectPattern} */param.value.left.properties.map(prop => {
167
211
  return getParamName(prop, isProperty);
168
212
  })];
169
213
  case 'ArrayPattern':
170
- return [param.key.name, param.value.left.elements.map((prop, idx) => {
214
+ return [param.key.name, /** @type {import('estree').ArrayPattern} */param.value.left.elements.map((prop, idx) => {
171
215
  return {
172
216
  name: idx,
173
- restElement: prop.type === 'RestElement'
217
+ restElement: (prop === null || prop === void 0 ? void 0 : prop.type) === 'RestElement'
174
218
  };
175
219
  })];
176
220
  }
@@ -197,7 +241,7 @@ const getFunctionParameterNames = (functionNode, checkDefaultObjects) => {
197
241
  }
198
242
  if (param.type === 'ArrayPattern' || ((_param$left3 = param.left) === null || _param$left3 === void 0 ? void 0 : _param$left3.type) === 'ArrayPattern') {
199
243
  var _param$left4;
200
- const elements = param.elements || ((_param$left4 = param.left) === null || _param$left4 === void 0 ? void 0 : _param$left4.elements);
244
+ const elements = /** @type {import('estree').ArrayPattern} */param.elements || ( /** @type {import('estree').ArrayPattern} */(_param$left4 = param.left) === null || _param$left4 === void 0 ? void 0 : _param$left4.elements);
201
245
  const roots = elements.map((prop, idx) => {
202
246
  return {
203
247
  name: `"${idx}"`,
@@ -227,7 +271,7 @@ const getFunctionParameterNames = (functionNode, checkDefaultObjects) => {
227
271
  };
228
272
 
229
273
  /**
230
- * @param {Node} functionNode
274
+ * @param {ESTreeOrTypeScriptNode} functionNode
231
275
  * @returns {Integer}
232
276
  */
233
277
  const hasParams = functionNode => {
@@ -239,9 +283,13 @@ const hasParams = functionNode => {
239
283
  * Gets all names of the target type, including those that refer to a path, e.g.
240
284
  * "@param foo; @param foo.bar".
241
285
  *
242
- * @param {object} jsdoc
286
+ * @param {import('comment-parser').Block} jsdoc
243
287
  * @param {string} targetTagName
244
- * @returns {Array<object>}
288
+ * @returns {{
289
+ * idx: Integer,
290
+ * name: string,
291
+ * type: string
292
+ * }[]}
245
293
  */
246
294
  const getJsdocTagsDeep = (jsdoc, targetTagName) => {
247
295
  const ret = [];
@@ -264,8 +312,9 @@ const getJsdocTagsDeep = (jsdoc, targetTagName) => {
264
312
  const modeWarnSettings = (0, _WarnSettings.default)();
265
313
 
266
314
  /**
267
- * @param {string} mode
268
- * @param context
315
+ * @param {ParserMode} mode
316
+ * @param {import('eslint').Rule.RuleContext} context
317
+ * @returns {import('./tagNames.js').AliasedTags}
269
318
  */
270
319
  const getTagNamesForMode = (mode, context) => {
271
320
  switch (mode) {
@@ -296,11 +345,14 @@ const getTagNamesForMode = (mode, context) => {
296
345
  };
297
346
 
298
347
  /**
299
- * @param context
348
+ * @param {import('eslint').Rule.RuleContext} context
300
349
  * @param {ParserMode} mode
301
350
  * @param {string} name
302
- * @param {object} tagPreference
303
- * @returns {string|object}
351
+ * @param {TagNamePreference} tagPreference
352
+ * @returns {string|boolean|{
353
+ * message: string;
354
+ * replacement?: string|undefined;
355
+ * }}
304
356
  */
305
357
  const getPreferredTagName = (context, mode, name, tagPreference = {}) => {
306
358
  var _Object$entries$find;
@@ -319,7 +371,7 @@ const getPreferredTagName = (context, mode, name, tagPreference = {}) => {
319
371
  const tagPreferenceFixed = Object.fromEntries(Object.entries(tagPreference).map(([key, value]) => {
320
372
  return [key.replace(/^tag /u, ''), value];
321
373
  }));
322
- if (Object.prototype.hasOwnProperty.call(tagPreferenceFixed, name)) {
374
+ if (Object.hasOwn(tagPreferenceFixed, name)) {
323
375
  return tagPreferenceFixed[name];
324
376
  }
325
377
  const tagNames = getTagNamesForMode(mode, context);
@@ -362,18 +414,70 @@ const hasTag = (jsdoc, targetTagName) => {
362
414
  /**
363
415
  * Get all tags, inline tags and inline tags in tags
364
416
  *
365
- * @param {object} jsdoc
366
- * @returns {Array}
417
+ * @param {import('comment-parser').Block & {
418
+ * inlineTags: import('@es-joy/jsdoccomment').JsdocInlineTagNoType[]
419
+ * }} jsdoc
420
+ * @param {boolean} includeInlineTags
421
+ * @returns {(import('comment-parser').Spec|
422
+ * import('@es-joy/jsdoccomment').JsdocInlineTagNoType)[]}
367
423
  */
368
424
  const getAllTags = (jsdoc, includeInlineTags) => {
369
- return includeInlineTags ? [...jsdoc.tags, ...jsdoc.inlineTags, ...jsdoc.tags.flatMap(tag => {
370
- return tag.inlineTags;
425
+ return includeInlineTags ? [...jsdoc.tags, ...jsdoc.inlineTags.map(inlineTag => {
426
+ // Tags don't have source or line numbers, so add before returning
427
+ let line = -1;
428
+ for (const {
429
+ tokens: {
430
+ description
431
+ }
432
+ } of jsdoc.source) {
433
+ line++;
434
+ if (description && description.includes(`{@${inlineTag.tag}`)) {
435
+ break;
436
+ }
437
+ }
438
+ inlineTag.line = line;
439
+ return inlineTag;
440
+ }), ...jsdoc.tags.flatMap(tag => {
441
+ let tagBegins = -1;
442
+ for (const {
443
+ tokens: {
444
+ tag: tg
445
+ }
446
+ } of jsdoc.source) {
447
+ tagBegins++;
448
+ if (tg) {
449
+ break;
450
+ }
451
+ }
452
+ for (const inlineTag of tag.inlineTags) {
453
+ let line;
454
+ for (const {
455
+ number,
456
+ tokens: {
457
+ description
458
+ }
459
+ } of tag.source) {
460
+ if (description && description.includes(`{@${inlineTag.tag}`)) {
461
+ line = number;
462
+ break;
463
+ }
464
+ }
465
+ inlineTag.line = tagBegins + line - 1;
466
+ }
467
+ return (
468
+ /**
469
+ * @type {import('comment-parser').Spec & {
470
+ * inlineTags: import('@es-joy/jsdoccomment').JsdocInlineTagNoType[]
471
+ * }}
472
+ */
473
+ tag.inlineTags
474
+ );
371
475
  })] : jsdoc.tags;
372
476
  };
373
477
 
374
478
  /**
375
479
  * @param {object} jsdoc
376
- * @param {Array} targetTagNames
480
+ * @param {string[]} targetTagNames
377
481
  * @returns {boolean}
378
482
  */
379
483
  const hasATag = (jsdoc, targetTagNames) => {
@@ -385,9 +489,9 @@ const hasATag = (jsdoc, targetTagNames) => {
385
489
  /**
386
490
  * Checks if the JSDoc comment has an undefined type.
387
491
  *
388
- * @param {JsDocTag} tag
492
+ * @param {import('comment-parser').Spec} tag
389
493
  * the tag which should be checked.
390
- * @param {"jsdoc"|"closure"|"typescript"} mode
494
+ * @param {ParserMode} mode
391
495
  * @returns {boolean}
392
496
  * true in case a defined type is undeclared; otherwise false.
393
497
  */
@@ -423,20 +527,34 @@ const mayBeUndefinedTypeTag = (tag, mode) => {
423
527
  };
424
528
 
425
529
  /**
426
- * @param map
427
- * @param tag
428
- * @returns {Map}
530
+ * @param {import('./getDefaultTagStructureForMode.js').TagStructure} map
531
+ * @param {string} tag
532
+ * @returns {Map<string, string | boolean>}
429
533
  */
430
534
  const ensureMap = (map, tag) => {
431
535
  if (!map.has(tag)) {
432
536
  map.set(tag, new Map());
433
537
  }
434
- return map.get(tag);
538
+ return (/** @type {Map<string, string | boolean>} */map.get(tag)
539
+ );
435
540
  };
436
541
 
542
+ /* eslint-disable jsdoc/valid-types -- Older non-TS version */
543
+ /**
544
+ * @typedef {{
545
+ * [tag: string]: {
546
+ * name: string|boolean,
547
+ * type: string[]|boolean,
548
+ * required: string[]
549
+ * }
550
+ * }} StructuredTags
551
+ */
552
+ /* eslint-enable jsdoc/valid-types -- Older non-TS version */
553
+
437
554
  /**
438
- * @param structuredTags
439
- * @param tagMap
555
+ * @param {StructuredTags} structuredTags
556
+ * @param {import('./getDefaultTagStructureForMode.js').TagStructure} tagMap
557
+ * @returns {void}
440
558
  */
441
559
  const overrideTagStructure = (structuredTags, tagMap = tagStructure) => {
442
560
  for (const [tag, {
@@ -469,9 +587,9 @@ const overrideTagStructure = (structuredTags, tagMap = tagStructure) => {
469
587
  };
470
588
 
471
589
  /**
472
- * @param mode
473
- * @param structuredTags
474
- * @returns {Map}
590
+ * @param {ParserMode} mode
591
+ * @param {StructuredTags} structuredTags
592
+ * @returns {import('./getDefaultTagStructureForMode.js').TagStructure}
475
593
  */
476
594
  const getTagStructureForMode = (mode, structuredTags) => {
477
595
  const tagStruct = (0, _getDefaultTagStructureForMode.default)(mode);
@@ -484,8 +602,8 @@ const getTagStructureForMode = (mode, structuredTags) => {
484
602
  };
485
603
 
486
604
  /**
487
- * @param tag
488
- * @param {Map} tagMap
605
+ * @param {string} tag
606
+ * @param {import('./getDefaultTagStructureForMode.js').TagStructure} tagMap
489
607
  * @returns {boolean}
490
608
  */
491
609
  const isNamepathDefiningTag = (tag, tagMap = tagStructure) => {
@@ -494,8 +612,8 @@ const isNamepathDefiningTag = (tag, tagMap = tagStructure) => {
494
612
  };
495
613
 
496
614
  /**
497
- * @param tag
498
- * @param {Map} tagMap
615
+ * @param {string} tag
616
+ * @param {import('./getDefaultTagStructureForMode.js').TagStructure} tagMap
499
617
  * @returns {boolean}
500
618
  */
501
619
  const isNamepathReferencingTag = (tag, tagMap = tagStructure) => {
@@ -504,8 +622,8 @@ const isNamepathReferencingTag = (tag, tagMap = tagStructure) => {
504
622
  };
505
623
 
506
624
  /**
507
- * @param tag
508
- * @param {Map} tagMap
625
+ * @param {string} tag
626
+ * @param {import('./getDefaultTagStructureForMode.js').TagStructure} tagMap
509
627
  * @returns {boolean}
510
628
  */
511
629
  const isNamepathOrUrlReferencingTag = (tag, tagMap = tagStructure) => {
@@ -514,8 +632,8 @@ const isNamepathOrUrlReferencingTag = (tag, tagMap = tagStructure) => {
514
632
  };
515
633
 
516
634
  /**
517
- * @param tag
518
- * @param {Map} tagMap
635
+ * @param {string} tag
636
+ * @param {import('./getDefaultTagStructureForMode.js').TagStructure} tagMap
519
637
  * @returns {boolean}
520
638
  */
521
639
  const tagMustHaveTypePosition = (tag, tagMap = tagStructure) => {
@@ -524,9 +642,9 @@ const tagMustHaveTypePosition = (tag, tagMap = tagStructure) => {
524
642
  };
525
643
 
526
644
  /**
527
- * @param tag
528
- * @param {Map} tagMap
529
- * @returns {boolean}
645
+ * @param {string} tag
646
+ * @param {import('./getDefaultTagStructureForMode.js').TagStructure} tagMap
647
+ * @returns {boolean|string}
530
648
  */
531
649
  const tagMightHaveTypePosition = (tag, tagMap = tagStructure) => {
532
650
  if (tagMustHaveTypePosition(tag, tagMap)) {
@@ -539,8 +657,8 @@ const tagMightHaveTypePosition = (tag, tagMap = tagStructure) => {
539
657
  const namepathTypes = new Set(['namepath-defining', 'namepath-referencing']);
540
658
 
541
659
  /**
542
- * @param tag
543
- * @param {Map} tagMap
660
+ * @param {string} tag
661
+ * @param {import('./getDefaultTagStructureForMode.js').TagStructure} tagMap
544
662
  * @returns {boolean}
545
663
  */
546
664
  const tagMightHaveNamePosition = (tag, tagMap = tagStructure) => {
@@ -550,8 +668,8 @@ const tagMightHaveNamePosition = (tag, tagMap = tagStructure) => {
550
668
  };
551
669
 
552
670
  /**
553
- * @param tag
554
- * @param {Map} tagMap
671
+ * @param {string} tag
672
+ * @param {import('./getDefaultTagStructureForMode.js').TagStructure} tagMap
555
673
  * @returns {boolean}
556
674
  */
557
675
  const tagMightHaveNamepath = (tag, tagMap = tagStructure) => {
@@ -560,8 +678,8 @@ const tagMightHaveNamepath = (tag, tagMap = tagStructure) => {
560
678
  };
561
679
 
562
680
  /**
563
- * @param tag
564
- * @param {Map} tagMap
681
+ * @param {string} tag
682
+ * @param {import('./getDefaultTagStructureForMode.js').TagStructure} tagMap
565
683
  * @returns {boolean}
566
684
  */
567
685
  const tagMustHaveNamePosition = (tag, tagMap = tagStructure) => {
@@ -571,7 +689,7 @@ const tagMustHaveNamePosition = (tag, tagMap = tagStructure) => {
571
689
 
572
690
  /**
573
691
  * @param tag
574
- * @param {Map} tagMap
692
+ * @param {import('./getDefaultTagStructureForMode.js').TagStructure} tagMap
575
693
  * @returns {boolean}
576
694
  */
577
695
  const tagMightHaveEitherTypeOrNamePosition = (tag, tagMap) => {
@@ -579,8 +697,8 @@ const tagMightHaveEitherTypeOrNamePosition = (tag, tagMap) => {
579
697
  };
580
698
 
581
699
  /**
582
- * @param tag
583
- * @param {Map} tagMap
700
+ * @param {string} tag
701
+ * @param {import('./getDefaultTagStructureForMode.js').TagStructure} tagMap
584
702
  * @returns {boolean}
585
703
  */
586
704
  const tagMustHaveEitherTypeOrNamePosition = (tag, tagMap) => {
@@ -590,7 +708,7 @@ const tagMustHaveEitherTypeOrNamePosition = (tag, tagMap) => {
590
708
 
591
709
  /**
592
710
  * @param tag
593
- * @param {Map} tagMap
711
+ * @param {import('./getDefaultTagStructureForMode.js').TagStructure} tagMap
594
712
  * @returns {boolean}
595
713
  */
596
714
  const tagMissingRequiredTypeOrNamepath = (tag, tagMap = tagStructure) => {
@@ -603,8 +721,14 @@ const tagMissingRequiredTypeOrNamepath = (tag, tagMap = tagStructure) => {
603
721
  return mustHaveEither && !hasEither && !mustHaveTypePosition;
604
722
  };
605
723
 
606
- // eslint-disable-next-line complexity
724
+ /* eslint-disable complexity -- Temporary */
725
+ /**
726
+ * @param {ESTreeOrTypeScriptNode} node
727
+ * @param {boolean} [checkYieldReturnValue]
728
+ * @returns {boolean}
729
+ */
607
730
  const hasNonFunctionYield = (node, checkYieldReturnValue) => {
731
+ /* eslint-enable complexity -- Temporary */
608
732
  if (!node) {
609
733
  return false;
610
734
  }
@@ -754,7 +878,8 @@ const hasNonFunctionYield = (node, checkYieldReturnValue) => {
754
878
  /**
755
879
  * Checks if a node has a return statement. Void return does not count.
756
880
  *
757
- * @param {object} node
881
+ * @param {ESTreeOrTypeScriptNode} node
882
+ * @param {boolean} [checkYieldReturnValue]
758
883
  * @returns {boolean}
759
884
  */
760
885
  const hasYieldValue = (node, checkYieldReturnValue) => {
@@ -764,8 +889,8 @@ const hasYieldValue = (node, checkYieldReturnValue) => {
764
889
  /**
765
890
  * Checks if a node has a throws statement.
766
891
  *
767
- * @param {object} node
768
- * @param {boolean} innerFunction
892
+ * @param {ESTreeOrTypeScriptNode} node
893
+ * @param {boolean} [innerFunction]
769
894
  * @returns {boolean}
770
895
  */
771
896
  // eslint-disable-next-line complexity
@@ -843,8 +968,8 @@ const isInlineTag = (tag) => {
843
968
  *
844
969
  * @see {https://github.com/google/closure-compiler/wiki/Generic-Types}
845
970
  * @see {https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html#template}
846
- * @param {JsDocTag} tag
847
- * @returns {Array<string>}
971
+ * @param {import('comment-parser').Spec} tag
972
+ * @returns {string[]}
848
973
  */
849
974
  const parseClosureTemplateTag = tag => {
850
975
  return tag.name.split(',').map(type => {
@@ -861,7 +986,7 @@ const parseClosureTemplateTag = tag => {
861
986
  * contexts designated by the rule. Returns an array of
862
987
  * ESTree AST types, indicating allowable contexts.
863
988
  *
864
- * @param {*} context
989
+ * @param {import('eslint').Rule.RuleContext} context
865
990
  * @param {DefaultContexts} defaultContexts
866
991
  * @param settings
867
992
  * @returns {string[]}
@@ -921,8 +1046,31 @@ const filterTags = (tags, filter) => {
921
1046
  const tagsWithNamesAndDescriptions = new Set(['param', 'arg', 'argument', 'property', 'prop', 'template',
922
1047
  // These two are parsed by our custom parser as though having a `name`
923
1048
  'returns', 'return']);
1049
+
1050
+ /* eslint-disable jsdoc/valid-types -- Old version */
1051
+ /**
1052
+ * @typedef {{
1053
+ * [key: string]: false|
1054
+ * {message: string, replacement?: string}
1055
+ * }} TagNamePreference
1056
+ */
1057
+ /* eslint-enable jsdoc/valid-types -- Old version */
1058
+
1059
+ /**
1060
+ * @param {import('eslint').Rule.RuleContext} context
1061
+ * @param {ParserMode} mode
1062
+ * @param {import('comment-parser').Spec[]} tags
1063
+ * @param {TagNamePreference} tagPreference
1064
+ * @returns {{
1065
+ * tagsWithNames: import('comment-parser').Spec[],
1066
+ * tagsWithoutNames: import('comment-parser').Spec[]
1067
+ * }}
1068
+ */
924
1069
  const getTagsByType = (context, mode, tags, tagPreference) => {
925
1070
  const descName = getPreferredTagName(context, mode, 'description', tagPreference);
1071
+ /**
1072
+ * @type {import('comment-parser').Spec[]}
1073
+ */
926
1074
  const tagsWithoutNames = [];
927
1075
  const tagsWithNames = filterTags(tags, tag => {
928
1076
  const {
@@ -939,22 +1087,47 @@ const getTagsByType = (context, mode, tags, tagPreference) => {
939
1087
  tagsWithoutNames
940
1088
  };
941
1089
  };
1090
+
1091
+ /**
1092
+ * @param {import('eslint').SourceCode} sourceCode
1093
+ * @returns {string}
1094
+ */
942
1095
  const getIndent = sourceCode => {
943
1096
  var _sourceCode$text$matc;
944
1097
  return (((_sourceCode$text$matc = sourceCode.text.match(/^\n*([ \t]+)/u)) === null || _sourceCode$text$matc === void 0 ? void 0 : _sourceCode$text$matc[1]) ?? '') + ' ';
945
1098
  };
1099
+
1100
+ /**
1101
+ * @param {ESTreeOrTypeScriptNode} node
1102
+ * @returns {boolean}
1103
+ */
946
1104
  const isConstructor = node => {
947
1105
  var _node$parent;
948
1106
  return (node === null || node === void 0 ? void 0 : node.type) === 'MethodDefinition' && node.kind === 'constructor' || (node === null || node === void 0 ? void 0 : (_node$parent = node.parent) === null || _node$parent === void 0 ? void 0 : _node$parent.kind) === 'constructor';
949
1107
  };
1108
+
1109
+ /**
1110
+ * @param {ESTreeOrTypeScriptNode} node
1111
+ * @returns {boolean}
1112
+ */
950
1113
  const isGetter = node => {
951
1114
  var _node$parent2;
952
1115
  return node && ((_node$parent2 = node.parent) === null || _node$parent2 === void 0 ? void 0 : _node$parent2.kind) === 'get';
953
1116
  };
1117
+
1118
+ /**
1119
+ * @param {ESTreeOrTypeScriptNode} node
1120
+ * @returns {boolean}
1121
+ */
954
1122
  const isSetter = node => {
955
1123
  var _node$parent3;
956
1124
  return node && ((_node$parent3 = node.parent) === null || _node$parent3 === void 0 ? void 0 : _node$parent3.kind) === 'set';
957
1125
  };
1126
+
1127
+ /**
1128
+ * @param {ESTreeOrTypeScriptNode} node
1129
+ * @returns {boolean}
1130
+ */
958
1131
  const hasAccessorPair = node => {
959
1132
  const {
960
1133
  type,
@@ -974,6 +1147,14 @@ const hasAccessorPair = node => {
974
1147
  return kind === oppositeKind && name === sourceName;
975
1148
  });
976
1149
  };
1150
+
1151
+ /**
1152
+ * @param {import('comment-parser').Block} jsdoc
1153
+ * @param {ESTreeOrTypeScriptNode} node
1154
+ * @param {import('eslint').Rule.RuleContext} context
1155
+ * @param {} schema
1156
+ * @returns {boolean}
1157
+ */
977
1158
  const exemptSpeciaMethods = (jsdoc, node, context, schema) => {
978
1159
  const hasSchemaOption = prop => {
979
1160
  var _context$options$2;