eslint-plugin-jsdoc 50.6.16 → 50.7.0

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 (155) hide show
  1. package/dist/alignTransform.cjs +10 -10
  2. package/dist/alignTransform.cjs.map +1 -1
  3. package/dist/exportParser.cjs +141 -135
  4. package/dist/exportParser.cjs.map +1 -1
  5. package/dist/generateRule.cjs +10 -12
  6. package/dist/generateRule.cjs.map +1 -1
  7. package/dist/getDefaultTagStructureForMode.cjs +73 -73
  8. package/dist/getDefaultTagStructureForMode.cjs.map +1 -1
  9. package/dist/getJsdocProcessorPlugin.cjs +121 -110
  10. package/dist/getJsdocProcessorPlugin.cjs.map +1 -1
  11. package/dist/index.cjs +17 -12
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.d.ts +4 -3
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/iterateJsdoc.cjs +87 -66
  16. package/dist/iterateJsdoc.cjs.map +1 -1
  17. package/dist/jsdocUtils.cjs +144 -142
  18. package/dist/jsdocUtils.cjs.map +1 -1
  19. package/dist/rules/checkAlignment.cjs +2 -2
  20. package/dist/rules/checkAlignment.cjs.map +1 -1
  21. package/dist/rules/checkExamples.cjs +22 -28
  22. package/dist/rules/checkExamples.cjs.map +1 -1
  23. package/dist/rules/checkIndentation.cjs +2 -2
  24. package/dist/rules/checkIndentation.cjs.map +1 -1
  25. package/dist/rules/checkLineAlignment.cjs +14 -14
  26. package/dist/rules/checkLineAlignment.cjs.map +1 -1
  27. package/dist/rules/checkParamNames.cjs +21 -15
  28. package/dist/rules/checkParamNames.cjs.map +1 -1
  29. package/dist/rules/checkPropertyNames.cjs +2 -2
  30. package/dist/rules/checkPropertyNames.cjs.map +1 -1
  31. package/dist/rules/checkTagNames.cjs +11 -11
  32. package/dist/rules/checkTagNames.cjs.map +1 -1
  33. package/dist/rules/checkTemplateNames.cjs +21 -22
  34. package/dist/rules/checkTemplateNames.cjs.map +1 -1
  35. package/dist/rules/checkTypes.cjs +10 -10
  36. package/dist/rules/checkTypes.cjs.map +1 -1
  37. package/dist/rules/checkValues.cjs +11 -14
  38. package/dist/rules/checkValues.cjs.map +1 -1
  39. package/dist/rules/convertToJsdocComments.cjs +26 -27
  40. package/dist/rules/convertToJsdocComments.cjs.map +1 -1
  41. package/dist/rules/emptyTags.cjs +6 -6
  42. package/dist/rules/emptyTags.cjs.map +1 -1
  43. package/dist/rules/importsAsDependencies.cjs.map +1 -1
  44. package/dist/rules/informativeDocs.cjs +12 -12
  45. package/dist/rules/informativeDocs.cjs.map +1 -1
  46. package/dist/rules/linesBeforeBlock.cjs +12 -12
  47. package/dist/rules/linesBeforeBlock.cjs.map +1 -1
  48. package/dist/rules/matchDescription.cjs +1 -1
  49. package/dist/rules/matchDescription.cjs.map +1 -1
  50. package/dist/rules/matchName.cjs +4 -4
  51. package/dist/rules/matchName.cjs.map +1 -1
  52. package/dist/rules/multilineBlocks.cjs +10 -10
  53. package/dist/rules/multilineBlocks.cjs.map +1 -1
  54. package/dist/rules/noBadBlocks.cjs +3 -3
  55. package/dist/rules/noBadBlocks.cjs.map +1 -1
  56. package/dist/rules/noMultiAsterisks.cjs +6 -6
  57. package/dist/rules/noMultiAsterisks.cjs.map +1 -1
  58. package/dist/rules/noRestrictedSyntax.cjs +2 -2
  59. package/dist/rules/noRestrictedSyntax.cjs.map +1 -1
  60. package/dist/rules/noTypes.cjs.map +1 -1
  61. package/dist/rules/noUndefinedTypes.cjs +17 -20
  62. package/dist/rules/noUndefinedTypes.cjs.map +1 -1
  63. package/dist/rules/requireAsteriskPrefix.cjs +4 -4
  64. package/dist/rules/requireAsteriskPrefix.cjs.map +1 -1
  65. package/dist/rules/requireDescription.cjs +2 -2
  66. package/dist/rules/requireDescription.cjs.map +1 -1
  67. package/dist/rules/requireDescriptionCompleteSentence.cjs +8 -8
  68. package/dist/rules/requireDescriptionCompleteSentence.cjs.map +1 -1
  69. package/dist/rules/requireFileOverview.cjs +6 -6
  70. package/dist/rules/requireFileOverview.cjs.map +1 -1
  71. package/dist/rules/requireHyphenBeforeParamDescription.cjs +1 -4
  72. package/dist/rules/requireHyphenBeforeParamDescription.cjs.map +1 -1
  73. package/dist/rules/requireJsdoc.cjs +19 -19
  74. package/dist/rules/requireJsdoc.cjs.map +1 -1
  75. package/dist/rules/requireParam.cjs +12 -12
  76. package/dist/rules/requireParam.cjs.map +1 -1
  77. package/dist/rules/requireProperty.cjs +1 -1
  78. package/dist/rules/requireProperty.cjs.map +1 -1
  79. package/dist/rules/requireReturns.cjs +3 -3
  80. package/dist/rules/requireReturns.cjs.map +1 -1
  81. package/dist/rules/requireReturnsCheck.cjs +1 -1
  82. package/dist/rules/requireReturnsCheck.cjs.map +1 -1
  83. package/dist/rules/requireReturnsDescription.cjs +1 -1
  84. package/dist/rules/requireReturnsDescription.cjs.map +1 -1
  85. package/dist/rules/requireTemplate.cjs +16 -15
  86. package/dist/rules/requireTemplate.cjs.map +1 -1
  87. package/dist/rules/requireYields.cjs +4 -4
  88. package/dist/rules/requireYields.cjs.map +1 -1
  89. package/dist/rules/requireYieldsCheck.cjs +6 -6
  90. package/dist/rules/requireYieldsCheck.cjs.map +1 -1
  91. package/dist/rules/sortTags.cjs +13 -13
  92. package/dist/rules/sortTags.cjs.map +1 -1
  93. package/dist/rules/tagLines.cjs +11 -11
  94. package/dist/rules/tagLines.cjs.map +1 -1
  95. package/dist/rules/textEscaping.cjs +2 -2
  96. package/dist/rules/textEscaping.cjs.map +1 -1
  97. package/dist/rules/validTypes.cjs +15 -15
  98. package/dist/rules/validTypes.cjs.map +1 -1
  99. package/dist/tagNames.cjs +1 -1
  100. package/dist/tagNames.cjs.map +1 -1
  101. package/dist/utils/hasReturnValue.cjs +176 -176
  102. package/dist/utils/hasReturnValue.cjs.map +1 -1
  103. package/eslint.config.js +36 -32
  104. package/package.json +35 -35
  105. package/pnpm-workspace.yaml +1 -0
  106. package/src/alignTransform.js +15 -15
  107. package/src/exportParser.js +386 -373
  108. package/src/getDefaultTagStructureForMode.js +45 -45
  109. package/src/getJsdocProcessorPlugin.js +175 -128
  110. package/src/index.js +66 -37
  111. package/src/iterateJsdoc.js +61 -28
  112. package/src/jsdocUtils.js +354 -338
  113. package/src/rules/checkAlignment.js +2 -2
  114. package/src/rules/checkExamples.js +16 -20
  115. package/src/rules/checkIndentation.js +2 -2
  116. package/src/rules/checkLineAlignment.js +10 -10
  117. package/src/rules/checkParamNames.js +22 -14
  118. package/src/rules/checkPropertyNames.js +1 -1
  119. package/src/rules/checkTagNames.js +7 -7
  120. package/src/rules/checkTemplateNames.js +52 -38
  121. package/src/rules/checkTypes.js +7 -7
  122. package/src/rules/checkValues.js +16 -17
  123. package/src/rules/convertToJsdocComments.js +47 -37
  124. package/src/rules/emptyTags.js +14 -7
  125. package/src/rules/importsAsDependencies.js +3 -1
  126. package/src/rules/informativeDocs.js +58 -58
  127. package/src/rules/linesBeforeBlock.js +25 -17
  128. package/src/rules/matchDescription.js +1 -1
  129. package/src/rules/matchName.js +2 -2
  130. package/src/rules/multilineBlocks.js +10 -10
  131. package/src/rules/noBadBlocks.js +3 -3
  132. package/src/rules/noMultiAsterisks.js +4 -4
  133. package/src/rules/noRestrictedSyntax.js +1 -1
  134. package/src/rules/noTypes.js +1 -1
  135. package/src/rules/noUndefinedTypes.js +29 -23
  136. package/src/rules/requireAsteriskPrefix.js +3 -3
  137. package/src/rules/requireDescription.js +1 -1
  138. package/src/rules/requireDescriptionCompleteSentence.js +6 -6
  139. package/src/rules/requireFileOverview.js +3 -3
  140. package/src/rules/requireHyphenBeforeParamDescription.js +2 -5
  141. package/src/rules/requireJsdoc.js +14 -14
  142. package/src/rules/requireParam.js +9 -9
  143. package/src/rules/requireProperty.js +1 -1
  144. package/src/rules/requireReturns.js +1 -1
  145. package/src/rules/requireReturnsCheck.js +1 -1
  146. package/src/rules/requireReturnsDescription.js +1 -1
  147. package/src/rules/requireTemplate.js +59 -38
  148. package/src/rules/requireYields.js +3 -3
  149. package/src/rules/requireYieldsCheck.js +1 -1
  150. package/src/rules/sortTags.js +7 -7
  151. package/src/rules/tagLines.js +8 -8
  152. package/src/rules/textEscaping.js +2 -0
  153. package/src/rules/validTypes.js +29 -29
  154. package/src/tagNames.js +2 -2
  155. package/src/utils/hasReturnValue.js +298 -283
@@ -20,9 +20,9 @@ Object.defineProperty(exports, "hasValueOrExecutorHasNonEmptyResolveValue", {
20
20
  exports.tagMustHaveTypePosition = exports.tagMustHaveNamePosition = exports.tagMissingRequiredTypeOrNamepath = exports.tagMightHaveTypePosition = exports.tagMightHaveNamepath = exports.tagMightHaveNamePosition = exports.tagMightHaveEitherTypeOrNamePosition = exports.setTagStructure = exports.pathDoesNotBeginWith = exports.parseClosureTemplateTag = exports.overrideTagStructure = exports.mayBeUndefinedTypeTag = exports.isValidTag = exports.isSetter = exports.isNamepathReferencingTag = exports.isNamepathOrUrlReferencingTag = exports.isNamepathDefiningTag = exports.isGetter = exports.isConstructor = exports.hasYieldValue = void 0;
21
21
  var _getDefaultTagStructureForMode = _interopRequireDefault(require("./getDefaultTagStructureForMode.cjs"));
22
22
  var _tagNames = require("./tagNames.cjs");
23
- var _hasReturnValue = require("./utils/hasReturnValue.cjs");
24
23
  var _WarnSettings = _interopRequireDefault(require("./WarnSettings.cjs"));
25
24
  var _jsdoccomment = require("@es-joy/jsdoccomment");
25
+ var _hasReturnValue = require("./utils/hasReturnValue.cjs");
26
26
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
27
27
  /**
28
28
  * @typedef {number} Integer
@@ -175,10 +175,8 @@ const getPropertiesFromPropertySignature = propSignature => {
175
175
  }
176
176
  if (propSignature.typeAnnotation && propSignature.typeAnnotation.typeAnnotation.type === 'TSTypeLiteral') {
177
177
  return [/** @type {import('@typescript-eslint/types').TSESTree.Identifier} */propSignature.key.name, propSignature.typeAnnotation.typeAnnotation.members.map(member => {
178
- return /** @type {string} */(
179
- getPropertiesFromPropertySignature( /** @type {import('@typescript-eslint/types').TSESTree.TSPropertySignature} */
180
- member)
181
- );
178
+ return /** @type {string} */getPropertiesFromPropertySignature(/** @type {import('@typescript-eslint/types').TSESTree.TSPropertySignature} */
179
+ member);
182
180
  })];
183
181
  }
184
182
  return /** @type {import('@typescript-eslint/types').TSESTree.Identifier} */propSignature.key.name;
@@ -218,7 +216,7 @@ const getFunctionParameterNames = (functionNode, checkDefaultObjects) => {
218
216
  param.typeAnnotation;
219
217
  if ((typeAnnotation === null || typeAnnotation === void 0 || (_typeAnnotation$typeA = typeAnnotation.typeAnnotation) === null || _typeAnnotation$typeA === void 0 ? void 0 : _typeAnnotation$typeA.type) === 'TSTypeLiteral') {
220
218
  const propertyNames = typeAnnotation.typeAnnotation.members.map(member => {
221
- return getPropertiesFromPropertySignature( /** @type {import('@typescript-eslint/types').TSESTree.TSPropertySignature} */
219
+ return getPropertiesFromPropertySignature(/** @type {import('@typescript-eslint/types').TSESTree.TSPropertySignature} */
222
220
  member);
223
221
  });
224
222
  const flattened = {
@@ -240,7 +238,7 @@ const getFunctionParameterNames = (functionNode, checkDefaultObjects) => {
240
238
  }
241
239
  if (param.type === 'ObjectPattern' || 'left' in param && param.left.type === 'ObjectPattern') {
242
240
  var _param$left;
243
- const properties = /** @type {import('@typescript-eslint/types').TSESTree.ObjectPattern} */param.properties || ( /** @type {import('estree').ObjectPattern} */(_param$left = /** @type {import('@typescript-eslint/types').TSESTree.AssignmentPattern} */param.left) === null || _param$left === void 0 ? void 0 : _param$left.properties);
241
+ const properties = /** @type {import('@typescript-eslint/types').TSESTree.ObjectPattern} */param.properties || (/** @type {import('estree').ObjectPattern} */(_param$left = /** @type {import('@typescript-eslint/types').TSESTree.AssignmentPattern} */param.left) === null || _param$left === void 0 ? void 0 : _param$left.properties);
244
242
  const roots = properties.map(prop => {
245
243
  return getParamName(prop, true);
246
244
  });
@@ -267,11 +265,19 @@ const getFunctionParameterNames = (functionNode, checkDefaultObjects) => {
267
265
  case 'AssignmentPattern':
268
266
  {
269
267
  switch (param.value.left.type) {
268
+ case 'ArrayPattern':
269
+ return [/** @type {import('estree').Identifier} */
270
+ param.key.name, /** @type {import('estree').ArrayPattern} */param.value.left.elements.map((prop, idx) => {
271
+ return {
272
+ name: idx,
273
+ restElement: (prop === null || prop === void 0 ? void 0 : prop.type) === 'RestElement'
274
+ };
275
+ })];
270
276
  case 'Identifier':
271
277
  // Default parameter
272
278
  if (checkDefaultObjects && param.value.right.type === 'ObjectExpression') {
273
279
  return [/** @type {import('estree').Identifier} */param.key.name, /** @type {import('estree').AssignmentPattern} */param.value.right.properties.map(prop => {
274
- return /** @type {string} */getParamName( /** @type {import('estree').Property} */
280
+ return /** @type {string} */getParamName(/** @type {import('estree').Property} */
275
281
  prop, isProperty);
276
282
  })];
277
283
  }
@@ -281,14 +287,6 @@ const getFunctionParameterNames = (functionNode, checkDefaultObjects) => {
281
287
  param.key.name, /** @type {import('estree').ObjectPattern} */param.value.left.properties.map(prop => {
282
288
  return getParamName(prop, isProperty);
283
289
  })];
284
- case 'ArrayPattern':
285
- return [/** @type {import('estree').Identifier} */
286
- param.key.name, /** @type {import('estree').ArrayPattern} */param.value.left.elements.map((prop, idx) => {
287
- return {
288
- name: idx,
289
- restElement: (prop === null || prop === void 0 ? void 0 : prop.type) === 'RestElement'
290
- };
291
- })];
292
290
  }
293
291
  }
294
292
  }
@@ -312,7 +310,7 @@ const getFunctionParameterNames = (functionNode, checkDefaultObjects) => {
312
310
  }
313
311
  if (param.type === 'ArrayPattern' || /** @type {import('estree').AssignmentPattern} */((_param$left2 = param.left) === null || _param$left2 === void 0 ? void 0 : _param$left2.type) === 'ArrayPattern') {
314
312
  var _param$left3;
315
- const elements = /** @type {import('estree').ArrayPattern} */param.elements || ( /** @type {import('estree').ArrayPattern} */(_param$left3 = /** @type {import('estree').AssignmentPattern} */param.left) === null || _param$left3 === void 0 ? void 0 : _param$left3.elements);
313
+ const elements = /** @type {import('estree').ArrayPattern} */param.elements || (/** @type {import('estree').ArrayPattern} */(_param$left3 = /** @type {import('estree').AssignmentPattern} */param.left) === null || _param$left3 === void 0 ? void 0 : _param$left3.elements);
316
314
  const roots = elements.map((prop, idx) => {
317
315
  return {
318
316
  name: `"${idx}"`,
@@ -321,13 +319,14 @@ const getFunctionParameterNames = (functionNode, checkDefaultObjects) => {
321
319
  });
322
320
  return [undefined, flattenRoots(roots)];
323
321
  }
324
- if (['RestElement', 'ExperimentalRestProperty'].includes(param.type)) {
322
+ if (['ExperimentalRestProperty', 'RestElement'].includes(param.type)) {
325
323
  var _param$argument;
326
324
  return {
327
325
  isRestProperty: isProperty,
328
- name: /** @type {import('@typescript-eslint/types').TSESTree.Identifier} */( /** @type {import('@typescript-eslint/types').TSESTree.RestElement} */param
326
+ name: /** @type {import('@typescript-eslint/types').TSESTree.Identifier} */(/** @type {import('@typescript-eslint/types').TSESTree.RestElement} */param
329
327
  // @ts-expect-error Ok
330
328
  .argument).name ?? (param === null || param === void 0 || (_param$argument = param.argument) === null || _param$argument === void 0 || (_param$argument = _param$argument.elements) === null || _param$argument === void 0 ? void 0 : _param$argument.map(({
329
+ // @ts-expect-error Ok
331
330
  name
332
331
  }) => {
333
332
  return name;
@@ -336,7 +335,7 @@ const getFunctionParameterNames = (functionNode, checkDefaultObjects) => {
336
335
  };
337
336
  }
338
337
  if (param.type === 'TSParameterProperty') {
339
- return getParamName( /** @type {import('@typescript-eslint/types').TSESTree.Identifier} */
338
+ return getParamName(/** @type {import('@typescript-eslint/types').TSESTree.Identifier} */
340
339
  /** @type {import('@typescript-eslint/types').TSESTree.TSParameterProperty} */param.parameter, true);
341
340
  }
342
341
  throw new Error(`Unsupported function signature format: \`${param.type}\`.`);
@@ -344,7 +343,7 @@ const getFunctionParameterNames = (functionNode, checkDefaultObjects) => {
344
343
  if (!functionNode) {
345
344
  return [];
346
345
  }
347
- return ( /** @type {import('@typescript-eslint/types').TSESTree.FunctionDeclaration} */functionNode.params || ( /** @type {import('@typescript-eslint/types').TSESTree.MethodDefinition} */(_functionNode$value = functionNode.value) === null || _functionNode$value === void 0 ? void 0 : _functionNode$value.params) || []).map(param => {
346
+ return (/** @type {import('@typescript-eslint/types').TSESTree.FunctionDeclaration} */functionNode.params || (/** @type {import('@typescript-eslint/types').TSESTree.MethodDefinition} */(_functionNode$value = functionNode.value) === null || _functionNode$value === void 0 ? void 0 : _functionNode$value.params) || []).map(param => {
348
347
  return getParamName(param);
349
348
  });
350
349
  };
@@ -399,13 +398,13 @@ const modeWarnSettings = (0, _WarnSettings.default)();
399
398
  */
400
399
  const getTagNamesForMode = (mode, context) => {
401
400
  switch (mode) {
401
+ case 'closure':
402
+ case 'permissive':
403
+ return _tagNames.closureTags;
402
404
  case 'jsdoc':
403
405
  return _tagNames.jsdocTags;
404
406
  case 'typescript':
405
407
  return _tagNames.typeScriptTags;
406
- case 'closure':
407
- case 'permissive':
408
- return _tagNames.closureTags;
409
408
  default:
410
409
  if (!modeWarnSettings.hasBeenWarned(context, 'mode')) {
411
410
  context.report({
@@ -441,14 +440,14 @@ const getTagDescription = (tg, returnArray) => {
441
440
  const descriptions = [];
442
441
  tg.source.some(({
443
442
  tokens: {
443
+ description,
444
444
  end,
445
445
  lineEnd,
446
+ name,
446
447
  postDelimiter,
447
- tag,
448
448
  postTag,
449
- name,
450
- type,
451
- description
449
+ tag,
450
+ type
452
451
  }
453
452
  }) => {
454
453
  const desc = (tag && postTag || !tag && !name && !type && postDelimiter || ''
@@ -484,7 +483,9 @@ const getTagDescription = (tg, returnArray) => {
484
483
  * }}
485
484
  */
486
485
  exports.getTagDescription = getTagDescription;
487
- const getPreferredTagNameSimple = (name, mode, tagPreference = {}, context = {
486
+ const getPreferredTagNameSimple = (name, mode, tagPreference = {},
487
+ // eslint-disable-next-line unicorn/no-object-as-default-parameter -- Ok
488
+ context = {
488
489
  report() {
489
490
  // No-op
490
491
  }
@@ -593,14 +594,14 @@ const getTags = (jsdoc, tagName) => {
593
594
  */
594
595
  exports.getTags = getTags;
595
596
  const getPreferredTagName = (jsdoc, {
596
- tagName,
597
+ allowObjectReturn = false,
597
598
  context,
599
+ tagName,
600
+ defaultMessage = `Unexpected tag \`@${tagName}\``,
598
601
  mode,
599
- tagNamePreference,
600
602
  report = () => {},
601
603
  skipReportingBlockedTag = false,
602
- allowObjectReturn = false,
603
- defaultMessage = `Unexpected tag \`@${tagName}\``
604
+ tagNamePreference
604
605
  }) => {
605
606
  const ret = getPreferredTagNameSimple(tagName, mode, tagNamePreference, context);
606
607
  const isObject = ret && typeof ret === 'object';
@@ -638,16 +639,16 @@ const forEachPreferredTag = (jsdoc, tagName, arrayHandler, {
638
639
  context,
639
640
  mode,
640
641
  report,
641
- tagNamePreference,
642
- skipReportingBlockedTag = false
642
+ skipReportingBlockedTag = false,
643
+ tagNamePreference
643
644
  } = {}) => {
644
645
  const targetTagName = /** @type {string|false} */
645
646
  getPreferredTagName(jsdoc, {
646
- skipReportingBlockedTag,
647
- tagName,
648
647
  context,
649
648
  mode,
650
649
  report,
650
+ skipReportingBlockedTag,
651
+ tagName,
651
652
  tagNamePreference
652
653
  });
653
654
  if (!targetTagName || skipReportingBlockedTag && targetTagName && typeof targetTagName === 'object') {
@@ -802,8 +803,8 @@ const ensureMap = (map, tag) => {
802
803
  const overrideTagStructure = (structuredTags, tagMap = tagStructure) => {
803
804
  for (const [tag, {
804
805
  name,
805
- type,
806
- required = []
806
+ required = [],
807
+ type
807
808
  }] of Object.entries(structuredTags)) {
808
809
  const tagStruct = ensureMap(tagMap, tag);
809
810
  tagStruct.set('namepathRole', name);
@@ -927,7 +928,7 @@ exports.tagMightHaveNamePosition = tagMightHaveNamePosition;
927
928
  const tagMightHaveNamepath = (tag, tagMap = tagStructure) => {
928
929
  const tagStruct = ensureMap(tagMap, tag);
929
930
  const nampathRole = tagStruct.get('namepathRole');
930
- return nampathRole !== false && namepathTypes.has( /** @type {string} */nampathRole);
931
+ return nampathRole !== false && namepathTypes.has(/** @type {string} */nampathRole);
931
932
  };
932
933
 
933
934
  /**
@@ -990,6 +991,19 @@ const hasNonFunctionYield = (node, checkYieldReturnValue) => {
990
991
  return false;
991
992
  }
992
993
  switch (node.type) {
994
+ case 'ArrayExpression':
995
+ case 'ArrayPattern':
996
+ return node.elements.some(element => {
997
+ return hasNonFunctionYield(element, checkYieldReturnValue);
998
+ });
999
+ case 'AssignmentExpression':
1000
+ case 'BinaryExpression':
1001
+ case 'LogicalExpression':
1002
+ {
1003
+ return hasNonFunctionYield(node.left, checkYieldReturnValue) || hasNonFunctionYield(node.right, checkYieldReturnValue);
1004
+ }
1005
+ case 'AssignmentPattern':
1006
+ return hasNonFunctionYield(node.right, checkYieldReturnValue);
993
1007
  case 'BlockStatement':
994
1008
  {
995
1009
  return node.body.some(bodyNode => {
@@ -998,9 +1012,9 @@ const hasNonFunctionYield = (node, checkYieldReturnValue) => {
998
1012
  }
999
1013
 
1000
1014
  /* c8 ignore next 2 -- In Babel? */
1015
+ case 'CallExpression':
1001
1016
  // @ts-expect-error In Babel?
1002
1017
  case 'OptionalCallExpression':
1003
- case 'CallExpression':
1004
1018
  return node.arguments.some(element => {
1005
1019
  return hasNonFunctionYield(element, checkYieldReturnValue);
1006
1020
  });
@@ -1009,82 +1023,53 @@ const hasNonFunctionYield = (node, checkYieldReturnValue) => {
1009
1023
  {
1010
1024
  return hasNonFunctionYield(node.expression, checkYieldReturnValue);
1011
1025
  }
1012
- case 'LabeledStatement':
1013
- case 'WhileStatement':
1014
- case 'DoWhileStatement':
1015
- case 'ForStatement':
1016
- case 'ForInStatement':
1017
- case 'ForOfStatement':
1018
- case 'WithStatement':
1019
- {
1020
- return hasNonFunctionYield(node.body, checkYieldReturnValue);
1021
- }
1026
+
1027
+ /* c8 ignore next 2 -- In Babel? */
1028
+ // @ts-expect-error In Babel?
1029
+ case 'ClassProperty':
1030
+
1031
+ /* c8 ignore next 2 -- In Babel? */
1032
+ // @ts-expect-error In Babel?
1033
+ case 'ObjectProperty':
1034
+ /* c8 ignore next 2 -- In Babel? */
1035
+ case 'Property':
1036
+ case 'PropertyDefinition':
1037
+ return node.computed && hasNonFunctionYield(node.key, checkYieldReturnValue) || hasNonFunctionYield(node.value, checkYieldReturnValue);
1022
1038
  case 'ConditionalExpression':
1023
1039
  case 'IfStatement':
1024
1040
  {
1025
1041
  return hasNonFunctionYield(node.test, checkYieldReturnValue) || hasNonFunctionYield(node.consequent, checkYieldReturnValue) || hasNonFunctionYield(node.alternate, checkYieldReturnValue);
1026
1042
  }
1027
- case 'TryStatement':
1028
- {
1029
- return hasNonFunctionYield(node.block, checkYieldReturnValue) || hasNonFunctionYield(node.handler && node.handler.body, checkYieldReturnValue) || hasNonFunctionYield( /** @type {import('@typescript-eslint/types').TSESTree.BlockStatement} */
1030
- node.finalizer, checkYieldReturnValue);
1031
- }
1032
- case 'SwitchStatement':
1033
- {
1034
- return node.cases.some(someCase => {
1035
- return someCase.consequent.some(nde => {
1036
- return hasNonFunctionYield(nde, checkYieldReturnValue);
1037
- });
1038
- });
1039
- }
1040
- case 'ArrayPattern':
1041
- case 'ArrayExpression':
1042
- return node.elements.some(element => {
1043
- return hasNonFunctionYield(element, checkYieldReturnValue);
1044
- });
1045
- case 'AssignmentPattern':
1046
- return hasNonFunctionYield(node.right, checkYieldReturnValue);
1047
- case 'VariableDeclaration':
1048
- {
1049
- return node.declarations.some(nde => {
1050
- return hasNonFunctionYield(nde, checkYieldReturnValue);
1051
- });
1052
- }
1053
- case 'VariableDeclarator':
1054
- {
1055
- return hasNonFunctionYield(node.id, checkYieldReturnValue) || hasNonFunctionYield(node.init, checkYieldReturnValue);
1056
- }
1057
- case 'AssignmentExpression':
1058
- case 'BinaryExpression':
1059
- case 'LogicalExpression':
1043
+ case 'DoWhileStatement':
1044
+ case 'ForInStatement':
1045
+ case 'ForOfStatement':
1046
+ case 'ForStatement':
1047
+ case 'LabeledStatement':
1048
+ case 'WhileStatement':
1049
+ case 'WithStatement':
1060
1050
  {
1061
- return hasNonFunctionYield(node.left, checkYieldReturnValue) || hasNonFunctionYield(node.right, checkYieldReturnValue);
1051
+ return hasNonFunctionYield(node.body, checkYieldReturnValue);
1062
1052
  }
1063
1053
 
1064
- // Comma
1065
- case 'SequenceExpression':
1066
- case 'TemplateLiteral':
1067
- return node.expressions.some(subExpression => {
1068
- return hasNonFunctionYield(subExpression, checkYieldReturnValue);
1069
- });
1070
- case 'ObjectPattern':
1071
- case 'ObjectExpression':
1072
- return node.properties.some(property => {
1073
- return hasNonFunctionYield(property, checkYieldReturnValue);
1074
- });
1075
-
1076
- /* c8 ignore next -- In Babel? */
1077
- case 'PropertyDefinition':
1078
- /* eslint-disable no-fallthrough */
1079
1054
  /* c8 ignore next 2 -- In Babel? */
1080
1055
  // @ts-expect-error In Babel?
1081
- case 'ObjectProperty':
1056
+ case 'Import':
1057
+ case 'ImportExpression':
1058
+ return hasNonFunctionYield(node.source, checkYieldReturnValue);
1059
+
1060
+ // ?.
1082
1061
  /* c8 ignore next 2 -- In Babel? */
1062
+ case 'MemberExpression':
1083
1063
  // @ts-expect-error In Babel?
1084
- case 'ClassProperty':
1085
- case 'Property':
1064
+ case 'OptionalMemberExpression':
1065
+ return hasNonFunctionYield(node.object, checkYieldReturnValue) || hasNonFunctionYield(node.property, checkYieldReturnValue);
1066
+ case 'ObjectExpression':
1067
+ /* eslint-disable no-fallthrough */
1068
+ case 'ObjectPattern':
1086
1069
  /* eslint-enable no-fallthrough */
1087
- return node.computed && hasNonFunctionYield(node.key, checkYieldReturnValue) || hasNonFunctionYield(node.value, checkYieldReturnValue);
1070
+ return node.properties.some(property => {
1071
+ return hasNonFunctionYield(property, checkYieldReturnValue);
1072
+ });
1088
1073
  /* c8 ignore next 2 -- In Babel? */
1089
1074
  // @ts-expect-error In Babel?
1090
1075
  case 'ObjectMethod':
@@ -1095,24 +1080,6 @@ const hasNonFunctionYield = (node, checkYieldReturnValue) => {
1095
1080
  node.arguments.some(nde => {
1096
1081
  return hasNonFunctionYield(nde, checkYieldReturnValue);
1097
1082
  });
1098
- case 'SpreadElement':
1099
- case 'UnaryExpression':
1100
- return hasNonFunctionYield(node.argument, checkYieldReturnValue);
1101
- case 'TaggedTemplateExpression':
1102
- return hasNonFunctionYield(node.quasi, checkYieldReturnValue);
1103
-
1104
- // ?.
1105
- /* c8 ignore next 2 -- In Babel? */
1106
- // @ts-expect-error In Babel?
1107
- case 'OptionalMemberExpression':
1108
- case 'MemberExpression':
1109
- return hasNonFunctionYield(node.object, checkYieldReturnValue) || hasNonFunctionYield(node.property, checkYieldReturnValue);
1110
-
1111
- /* c8 ignore next 2 -- In Babel? */
1112
- // @ts-expect-error In Babel?
1113
- case 'Import':
1114
- case 'ImportExpression':
1115
- return hasNonFunctionYield(node.source, checkYieldReturnValue);
1116
1083
  case 'ReturnStatement':
1117
1084
  {
1118
1085
  if (node.argument === null) {
@@ -1120,10 +1087,45 @@ const hasNonFunctionYield = (node, checkYieldReturnValue) => {
1120
1087
  }
1121
1088
  return hasNonFunctionYield(node.argument, checkYieldReturnValue);
1122
1089
  }
1090
+
1091
+ // Comma
1092
+ case 'SequenceExpression':
1093
+ case 'TemplateLiteral':
1094
+ return node.expressions.some(subExpression => {
1095
+ return hasNonFunctionYield(subExpression, checkYieldReturnValue);
1096
+ });
1097
+ case 'SpreadElement':
1098
+ case 'UnaryExpression':
1099
+ return hasNonFunctionYield(node.argument, checkYieldReturnValue);
1100
+ case 'SwitchStatement':
1101
+ {
1102
+ return node.cases.some(someCase => {
1103
+ return someCase.consequent.some(nde => {
1104
+ return hasNonFunctionYield(nde, checkYieldReturnValue);
1105
+ });
1106
+ });
1107
+ }
1108
+ case 'TaggedTemplateExpression':
1109
+ return hasNonFunctionYield(node.quasi, checkYieldReturnValue);
1110
+ case 'TryStatement':
1111
+ {
1112
+ return hasNonFunctionYield(node.block, checkYieldReturnValue) || hasNonFunctionYield(node.handler && node.handler.body, checkYieldReturnValue) || hasNonFunctionYield(/** @type {import('@typescript-eslint/types').TSESTree.BlockStatement} */
1113
+ node.finalizer, checkYieldReturnValue);
1114
+ }
1115
+ case 'VariableDeclaration':
1116
+ {
1117
+ return node.declarations.some(nde => {
1118
+ return hasNonFunctionYield(nde, checkYieldReturnValue);
1119
+ });
1120
+ }
1121
+ case 'VariableDeclarator':
1122
+ {
1123
+ return hasNonFunctionYield(node.id, checkYieldReturnValue) || hasNonFunctionYield(node.init, checkYieldReturnValue);
1124
+ }
1123
1125
  case 'YieldExpression':
1124
1126
  {
1125
1127
  if (checkYieldReturnValue) {
1126
- if ( /** @type {import('eslint').Rule.Node} */node.parent.type === 'VariableDeclarator') {
1128
+ if (/** @type {import('eslint').Rule.Node} */node.parent.type === 'VariableDeclarator') {
1127
1129
  return true;
1128
1130
  }
1129
1131
  return false;
@@ -1149,7 +1151,7 @@ const hasNonFunctionYield = (node, checkYieldReturnValue) => {
1149
1151
  * @returns {boolean}
1150
1152
  */
1151
1153
  const hasYieldValue = (node, checkYieldReturnValue) => {
1152
- return /** @type {import('@typescript-eslint/types').TSESTree.FunctionDeclaration} */node.generator && ( /** @type {import('@typescript-eslint/types').TSESTree.FunctionDeclaration} */node.expression || hasNonFunctionYield( /** @type {import('@typescript-eslint/types').TSESTree.FunctionDeclaration} */
1154
+ return /** @type {import('@typescript-eslint/types').TSESTree.FunctionDeclaration} */node.generator && (/** @type {import('@typescript-eslint/types').TSESTree.FunctionDeclaration} */node.expression || hasNonFunctionYield(/** @type {import('@typescript-eslint/types').TSESTree.FunctionDeclaration} */
1153
1155
  node.body, checkYieldReturnValue));
1154
1156
  };
1155
1157
 
@@ -1170,9 +1172,9 @@ const hasThrowValue = (node, innerFunction) => {
1170
1172
  // throws, but we're treating functions atomically rather than trying to
1171
1173
  // follow them
1172
1174
  switch (node.type) {
1173
- case 'FunctionExpression':
1174
- case 'FunctionDeclaration':
1175
1175
  case 'ArrowFunctionExpression':
1176
+ case 'FunctionDeclaration':
1177
+ case 'FunctionExpression':
1176
1178
  {
1177
1179
  return !innerFunction && !node.async && hasThrowValue(node.body, true);
1178
1180
  }
@@ -1182,12 +1184,12 @@ const hasThrowValue = (node, innerFunction) => {
1182
1184
  return bodyNode.type !== 'FunctionDeclaration' && hasThrowValue(bodyNode);
1183
1185
  });
1184
1186
  }
1185
- case 'LabeledStatement':
1186
- case 'WhileStatement':
1187
1187
  case 'DoWhileStatement':
1188
- case 'ForStatement':
1189
1188
  case 'ForInStatement':
1190
1189
  case 'ForOfStatement':
1190
+ case 'ForStatement':
1191
+ case 'LabeledStatement':
1192
+ case 'WhileStatement':
1191
1193
  case 'WithStatement':
1192
1194
  {
1193
1195
  return hasThrowValue(node.body);
@@ -1196,12 +1198,6 @@ const hasThrowValue = (node, innerFunction) => {
1196
1198
  {
1197
1199
  return hasThrowValue(node.consequent) || hasThrowValue(node.alternate);
1198
1200
  }
1199
-
1200
- // We only consider it to throw an error if the catch or finally blocks throw an error.
1201
- case 'TryStatement':
1202
- {
1203
- return hasThrowValue(node.handler && node.handler.body) || hasThrowValue(node.finalizer);
1204
- }
1205
1201
  case 'SwitchStatement':
1206
1202
  {
1207
1203
  return node.cases.some(someCase => {
@@ -1214,6 +1210,12 @@ const hasThrowValue = (node, innerFunction) => {
1214
1210
  {
1215
1211
  return true;
1216
1212
  }
1213
+
1214
+ // We only consider it to throw an error if the catch or finally blocks throw an error.
1215
+ case 'TryStatement':
1216
+ {
1217
+ return hasThrowValue(node.handler && node.handler.body) || hasThrowValue(node.finalizer);
1218
+ }
1217
1219
  default:
1218
1220
  {
1219
1221
  return false;
@@ -1327,9 +1329,9 @@ const getContextObject = (contexts, checkJsdoc, handler) => {
1327
1329
  return properties;
1328
1330
  };
1329
1331
  exports.getContextObject = getContextObject;
1330
- const tagsWithNamesAndDescriptions = new Set(['param', 'arg', 'argument', 'property', 'prop', 'template',
1332
+ const tagsWithNamesAndDescriptions = new Set(['arg', 'argument', 'param', 'prop', 'property', 'return',
1331
1333
  // These two are parsed by our custom parser as though having a `name`
1332
- 'returns', 'return']);
1334
+ 'returns', 'template']);
1333
1335
 
1334
1336
  /**
1335
1337
  * @typedef {{
@@ -1427,9 +1429,9 @@ const isSetter = node => {
1427
1429
  exports.isSetter = isSetter;
1428
1430
  const hasAccessorPair = node => {
1429
1431
  const {
1430
- type,
1432
+ key,
1431
1433
  kind: sourceKind,
1432
- key
1434
+ type
1433
1435
  } =
1434
1436
  /**
1435
1437
  * @type {import('@typescript-eslint/types').TSESTree.MethodDefinition|
@@ -1441,8 +1443,8 @@ const hasAccessorPair = node => {
1441
1443
  const sibling = type === 'MethodDefinition' ? /** @type {import('@typescript-eslint/types').TSESTree.ClassBody} */node.parent.body : /** @type {import('@typescript-eslint/types').TSESTree.ObjectExpression} */node.parent.properties;
1442
1444
  return sibling.some(child => {
1443
1445
  const {
1444
- kind,
1445
- key: ky
1446
+ key: ky,
1447
+ kind
1446
1448
  } =
1447
1449
  /**
1448
1450
  * @type {import('@typescript-eslint/types').TSESTree.MethodDefinition|
@@ -1473,7 +1475,7 @@ const exemptSpeciaMethods = (jsdoc, node, context, schema) => {
1473
1475
  };
1474
1476
  const checkGetters = hasSchemaOption('checkGetters');
1475
1477
  const checkSetters = hasSchemaOption('checkSetters');
1476
- return !hasSchemaOption('checkConstructors') && (isConstructor(node) || hasATag(jsdoc, ['class', 'constructor'])) || isGetter(node) && (!checkGetters || checkGetters === 'no-setter' && hasAccessorPair( /** @type {import('./iterateJsdoc.js').Node} */node.parent)) || isSetter(node) && (!checkSetters || checkSetters === 'no-getter' && hasAccessorPair( /** @type {import('./iterateJsdoc.js').Node} */node.parent));
1478
+ return !hasSchemaOption('checkConstructors') && (isConstructor(node) || hasATag(jsdoc, ['class', 'constructor'])) || isGetter(node) && (!checkGetters || checkGetters === 'no-setter' && hasAccessorPair(/** @type {import('./iterateJsdoc.js').Node} */node.parent)) || isSetter(node) && (!checkSetters || checkSetters === 'no-getter' && hasAccessorPair(/** @type {import('./iterateJsdoc.js').Node} */node.parent));
1477
1479
  };
1478
1480
 
1479
1481
  /**