eslint-plugin-jsdoc 63.0.11 → 63.0.12

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 (171) hide show
  1. package/dist/WarnSettings.cjs +8 -1
  2. package/dist/WarnSettings.cjs.map +1 -1
  3. package/dist/alignTransform.cjs +10 -6
  4. package/dist/alignTransform.cjs.map +1 -1
  5. package/dist/buildForbidRuleDefinition.cjs +10 -3
  6. package/dist/buildForbidRuleDefinition.cjs.map +1 -1
  7. package/dist/buildRejectOrPreferRuleDefinition.cjs +14 -7
  8. package/dist/buildRejectOrPreferRuleDefinition.cjs.map +1 -1
  9. package/dist/defaultTagOrder.cjs +8 -1
  10. package/dist/defaultTagOrder.cjs.map +1 -1
  11. package/dist/exportParser.cjs +14 -6
  12. package/dist/exportParser.cjs.map +1 -1
  13. package/dist/generateDocs.cjs +44 -36
  14. package/dist/generateDocs.cjs.map +1 -1
  15. package/dist/generateOptions.cjs +18 -15
  16. package/dist/generateOptions.cjs.map +1 -1
  17. package/dist/generateRule.cjs +24 -24
  18. package/dist/generateRule.cjs.map +1 -1
  19. package/dist/generateRuleTypes.cjs +9 -6
  20. package/dist/generateRuleTypes.cjs.map +1 -1
  21. package/dist/getDefaultTagStructureForMode.cjs +8 -1
  22. package/dist/getDefaultTagStructureForMode.cjs.map +1 -1
  23. package/dist/getJsdocProcessorPlugin.cjs +28 -20
  24. package/dist/getJsdocProcessorPlugin.cjs.map +1 -1
  25. package/dist/index-cjs.cjs +159 -152
  26. package/dist/index-cjs.cjs.map +1 -1
  27. package/dist/index-esm.cjs +27 -16
  28. package/dist/index-esm.cjs.map +1 -1
  29. package/dist/index.cjs +172 -159
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/iterateJsdoc.cjs +32 -22
  32. package/dist/iterateJsdoc.cjs.map +1 -1
  33. package/dist/jsdocUtils.cjs +86 -18
  34. package/dist/jsdocUtils.cjs.map +1 -1
  35. package/dist/rules/checkAccess.cjs +10 -2
  36. package/dist/rules/checkAccess.cjs.map +1 -1
  37. package/dist/rules/checkAlignment.cjs +10 -2
  38. package/dist/rules/checkAlignment.cjs.map +1 -1
  39. package/dist/rules/checkExamples.cjs +15 -6
  40. package/dist/rules/checkExamples.cjs.map +1 -1
  41. package/dist/rules/checkIndentation.cjs +9 -2
  42. package/dist/rules/checkIndentation.cjs.map +1 -1
  43. package/dist/rules/checkLineAlignment.cjs +14 -6
  44. package/dist/rules/checkLineAlignment.cjs.map +1 -1
  45. package/dist/rules/checkParamNames.cjs +9 -2
  46. package/dist/rules/checkParamNames.cjs.map +1 -1
  47. package/dist/rules/checkPropertyNames.cjs +9 -2
  48. package/dist/rules/checkPropertyNames.cjs.map +1 -1
  49. package/dist/rules/checkSyntax.cjs +10 -2
  50. package/dist/rules/checkSyntax.cjs.map +1 -1
  51. package/dist/rules/checkTagNames.cjs +11 -4
  52. package/dist/rules/checkTagNames.cjs.map +1 -1
  53. package/dist/rules/checkTemplateNames.cjs +20 -12
  54. package/dist/rules/checkTemplateNames.cjs.map +1 -1
  55. package/dist/rules/checkTypes.cjs +10 -4
  56. package/dist/rules/checkTypes.cjs.map +1 -1
  57. package/dist/rules/checkValues.cjs +17 -9
  58. package/dist/rules/checkValues.cjs.map +1 -1
  59. package/dist/rules/convertToJsdocComments.cjs +19 -13
  60. package/dist/rules/convertToJsdocComments.cjs.map +1 -1
  61. package/dist/rules/emptyTags.cjs +10 -2
  62. package/dist/rules/emptyTags.cjs.map +1 -1
  63. package/dist/rules/escapeInlineTags.cjs +10 -2
  64. package/dist/rules/escapeInlineTags.cjs.map +1 -1
  65. package/dist/rules/implementsOnClasses.cjs +10 -2
  66. package/dist/rules/implementsOnClasses.cjs.map +1 -1
  67. package/dist/rules/importsAsDependencies.cjs +20 -12
  68. package/dist/rules/importsAsDependencies.cjs.map +1 -1
  69. package/dist/rules/informativeDocs.cjs +12 -4
  70. package/dist/rules/informativeDocs.cjs.map +1 -1
  71. package/dist/rules/linesBeforeBlock.cjs +9 -2
  72. package/dist/rules/linesBeforeBlock.cjs.map +1 -1
  73. package/dist/rules/matchDescription.cjs +9 -2
  74. package/dist/rules/matchDescription.cjs.map +1 -1
  75. package/dist/rules/matchName.cjs +10 -2
  76. package/dist/rules/matchName.cjs.map +1 -1
  77. package/dist/rules/multilineBlocks.cjs +9 -2
  78. package/dist/rules/multilineBlocks.cjs.map +1 -1
  79. package/dist/rules/noBadBlocks.cjs +11 -4
  80. package/dist/rules/noBadBlocks.cjs.map +1 -1
  81. package/dist/rules/noBlankBlockDescriptions.cjs +10 -2
  82. package/dist/rules/noBlankBlockDescriptions.cjs.map +1 -1
  83. package/dist/rules/noBlankBlocks.cjs +10 -2
  84. package/dist/rules/noBlankBlocks.cjs.map +1 -1
  85. package/dist/rules/noDefaults.cjs +10 -2
  86. package/dist/rules/noDefaults.cjs.map +1 -1
  87. package/dist/rules/noMissingSyntax.cjs +9 -2
  88. package/dist/rules/noMissingSyntax.cjs.map +1 -1
  89. package/dist/rules/noMultiAsterisks.cjs +10 -2
  90. package/dist/rules/noMultiAsterisks.cjs.map +1 -1
  91. package/dist/rules/noRestrictedSyntax.cjs +9 -2
  92. package/dist/rules/noRestrictedSyntax.cjs.map +1 -1
  93. package/dist/rules/noTypes.cjs +9 -2
  94. package/dist/rules/noTypes.cjs.map +1 -1
  95. package/dist/rules/noUndefinedTypes.cjs +21 -13
  96. package/dist/rules/noUndefinedTypes.cjs.map +1 -1
  97. package/dist/rules/preferImportTag.cjs +28 -21
  98. package/dist/rules/preferImportTag.cjs.map +1 -1
  99. package/dist/rules/requireAsteriskPrefix.cjs +10 -2
  100. package/dist/rules/requireAsteriskPrefix.cjs.map +1 -1
  101. package/dist/rules/requireDescription.cjs +9 -2
  102. package/dist/rules/requireDescription.cjs.map +1 -1
  103. package/dist/rules/requireDescriptionCompleteSentence.cjs +15 -7
  104. package/dist/rules/requireDescriptionCompleteSentence.cjs.map +1 -1
  105. package/dist/rules/requireExample.cjs +10 -2
  106. package/dist/rules/requireExample.cjs.map +1 -1
  107. package/dist/rules/requireFileOverview.cjs +10 -2
  108. package/dist/rules/requireFileOverview.cjs.map +1 -1
  109. package/dist/rules/requireHyphenBeforeParamDescription.cjs +10 -2
  110. package/dist/rules/requireHyphenBeforeParamDescription.cjs.map +1 -1
  111. package/dist/rules/requireJsdoc.cjs +24 -17
  112. package/dist/rules/requireJsdoc.cjs.map +1 -1
  113. package/dist/rules/requireParam.cjs +9 -2
  114. package/dist/rules/requireParam.cjs.map +1 -1
  115. package/dist/rules/requireParamDescription.cjs +10 -2
  116. package/dist/rules/requireParamDescription.cjs.map +1 -1
  117. package/dist/rules/requireParamName.cjs +10 -2
  118. package/dist/rules/requireParamName.cjs.map +1 -1
  119. package/dist/rules/requireParamType.cjs +10 -2
  120. package/dist/rules/requireParamType.cjs.map +1 -1
  121. package/dist/rules/requireProperty.cjs +10 -2
  122. package/dist/rules/requireProperty.cjs.map +1 -1
  123. package/dist/rules/requirePropertyDescription.cjs +10 -2
  124. package/dist/rules/requirePropertyDescription.cjs.map +1 -1
  125. package/dist/rules/requirePropertyName.cjs +10 -2
  126. package/dist/rules/requirePropertyName.cjs.map +1 -1
  127. package/dist/rules/requirePropertyType.cjs +10 -2
  128. package/dist/rules/requirePropertyType.cjs.map +1 -1
  129. package/dist/rules/requireRejects.cjs +9 -2
  130. package/dist/rules/requireRejects.cjs.map +1 -1
  131. package/dist/rules/requireReturns.cjs +11 -4
  132. package/dist/rules/requireReturns.cjs.map +1 -1
  133. package/dist/rules/requireReturnsCheck.cjs +15 -8
  134. package/dist/rules/requireReturnsCheck.cjs.map +1 -1
  135. package/dist/rules/requireReturnsDescription.cjs +10 -2
  136. package/dist/rules/requireReturnsDescription.cjs.map +1 -1
  137. package/dist/rules/requireReturnsType.cjs +10 -2
  138. package/dist/rules/requireReturnsType.cjs.map +1 -1
  139. package/dist/rules/requireTags.cjs +9 -2
  140. package/dist/rules/requireTags.cjs.map +1 -1
  141. package/dist/rules/requireTemplate.cjs +13 -5
  142. package/dist/rules/requireTemplate.cjs.map +1 -1
  143. package/dist/rules/requireThrows.cjs +9 -2
  144. package/dist/rules/requireThrows.cjs.map +1 -1
  145. package/dist/rules/requireYields.cjs +9 -2
  146. package/dist/rules/requireYields.cjs.map +1 -1
  147. package/dist/rules/requireYieldsCheck.cjs +9 -2
  148. package/dist/rules/requireYieldsCheck.cjs.map +1 -1
  149. package/dist/rules/sortTags.cjs +12 -4
  150. package/dist/rules/sortTags.cjs.map +1 -1
  151. package/dist/rules/tagLines.cjs +9 -2
  152. package/dist/rules/tagLines.cjs.map +1 -1
  153. package/dist/rules/textEscaping.cjs +9 -2
  154. package/dist/rules/textEscaping.cjs.map +1 -1
  155. package/dist/rules/tsMethodSignatureStyle.cjs +18 -10
  156. package/dist/rules/tsMethodSignatureStyle.cjs.map +1 -1
  157. package/dist/rules/tsNoEmptyObjectType.cjs +13 -5
  158. package/dist/rules/tsNoEmptyObjectType.cjs.map +1 -1
  159. package/dist/rules/tsNoUnnecessaryTemplateExpression.cjs +16 -8
  160. package/dist/rules/tsNoUnnecessaryTemplateExpression.cjs.map +1 -1
  161. package/dist/rules/tsPreferFunctionType.cjs +16 -8
  162. package/dist/rules/tsPreferFunctionType.cjs.map +1 -1
  163. package/dist/rules/typeFormatting.cjs +17 -9
  164. package/dist/rules/typeFormatting.cjs.map +1 -1
  165. package/dist/rules/validTypes.cjs +18 -10
  166. package/dist/rules/validTypes.cjs.map +1 -1
  167. package/dist/tagNames.cjs +9 -4
  168. package/dist/tagNames.cjs.map +1 -1
  169. package/dist/utils/hasReturnValue.cjs +8 -1
  170. package/dist/utils/hasReturnValue.cjs.map +1 -1
  171. package/package.json +1 -1
@@ -1,5 +1,12 @@
1
- import iterateJsdoc from '../iterateJsdoc.js';
2
- export default iterateJsdoc(({
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc.cjs"));
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
+ var _default = exports.default = (0, _iterateJsdoc.default)(({
3
10
  report,
4
11
  utils
5
12
  }) => {
@@ -61,4 +68,5 @@ section of our Advanced docs for more on the expected format.`,
61
68
  type: 'suggestion'
62
69
  }
63
70
  });
71
+ module.exports = exports.default;
64
72
  //# sourceMappingURL=requireReturnsDescription.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"requireReturnsDescription.cjs","names":[],"sources":["../../src/rules/requireReturnsDescription.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nexport default iterateJsdoc(({\n report,\n utils,\n}) => {\n utils.forEachPreferredTag('returns', (jsdocTag, targetTagName) => {\n const type = jsdocTag.type && jsdocTag.type.trim();\n\n if ([\n 'Promise<undefined>', 'Promise<void>', 'undefined', 'void',\n ].includes(type)) {\n return;\n }\n\n if (!jsdocTag.description.trim()) {\n report(`Missing JSDoc @${targetTagName} description.`, null, jsdocTag);\n }\n });\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: 'Requires that the `@returns` tag has a `description` value (not including `void`/`undefined` type returns).',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-returns-description.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n contexts: {\n description: `Set this to an array of strings representing the AST context (or an object with\noptional \\`context\\` and \\`comment\\` properties) where you wish the rule to be applied.\n\n\\`context\\` defaults to \\`any\\` and \\`comment\\` defaults to no specific comment context.\n\nOverrides the default contexts (\\`ArrowFunctionExpression\\`, \\`FunctionDeclaration\\`,\n\\`FunctionExpression\\`). Set to \\`\"any\"\\` if you want\nthe rule to apply to any JSDoc block throughout your files (as is necessary\nfor finding function blocks not attached to a function declaration or\nexpression, i.e., \\`@callback\\` or \\`@function\\` (or its aliases \\`@func\\` or\n\\`@method\\`) (including those associated with an \\`@interface\\`).\n\nSee the [\"AST and Selectors\"](../advanced.md#ast-and-selectors)\nsection of our Advanced docs for more on the expected format.`,\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":"AAAA,OAAO,YAAY,MAAM,oBAAoB;AAE7C,eAAe,YAAY,CAAC,CAAC;EAC3B,MAAM;EACN;AACF,CAAC,KAAK;EACJ,KAAK,CAAC,mBAAmB,CAAC,SAAS,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK;IAChE,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAElD,IAAI,CACF,oBAAoB,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,CAC3D,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;MAChB;IACF;IAEA,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,EAAE;MAChC,MAAM,CAAC,kBAAkB,aAAa,eAAe,EAAE,IAAI,EAAE,QAAQ,CAAC;IACxE;EACF,CAAC,CAAC;AACJ,CAAC,EAAE;EACD,eAAe,EAAE,IAAI;EACrB,IAAI,EAAE;IACJ,IAAI,EAAE;MACJ,WAAW,EAAE,6GAA6G;MAC1H,GAAG,EAAE;IACP,CAAC;IACD,MAAM,EAAE,CACN;MACE,oBAAoB,EAAE,KAAK;MAC3B,UAAU,EAAE;QACV,QAAQ,EAAE;UACR,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8DAA8D;UAClD,KAAK,EAAE;YACL,KAAK,EAAE,CACL;cACE,IAAI,EAAE;YACR,CAAC,EACD;cACE,oBAAoB,EAAE,KAAK;cAC3B,UAAU,EAAE;gBACV,OAAO,EAAE;kBACP,IAAI,EAAE;gBACR,CAAC;gBACD,OAAO,EAAE;kBACP,IAAI,EAAE;gBACR;cACF,CAAC;cACD,IAAI,EAAE;YACR,CAAC;UAEL,CAAC;UACD,IAAI,EAAE;QACR;MACF,CAAC;MACD,IAAI,EAAE;IACR,CAAC,CACF;IACD,IAAI,EAAE;EACR;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"requireReturnsDescription.cjs","names":["iterateJsdoc"],"sources":["../../src/rules/requireReturnsDescription.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nexport default iterateJsdoc(({\n report,\n utils,\n}) => {\n utils.forEachPreferredTag('returns', (jsdocTag, targetTagName) => {\n const type = jsdocTag.type && jsdocTag.type.trim();\n\n if ([\n 'Promise<undefined>', 'Promise<void>', 'undefined', 'void',\n ].includes(type)) {\n return;\n }\n\n if (!jsdocTag.description.trim()) {\n report(`Missing JSDoc @${targetTagName} description.`, null, jsdocTag);\n }\n });\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: 'Requires that the `@returns` tag has a `description` value (not including `void`/`undefined` type returns).',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-returns-description.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n contexts: {\n description: `Set this to an array of strings representing the AST context (or an object with\noptional \\`context\\` and \\`comment\\` properties) where you wish the rule to be applied.\n\n\\`context\\` defaults to \\`any\\` and \\`comment\\` defaults to no specific comment context.\n\nOverrides the default contexts (\\`ArrowFunctionExpression\\`, \\`FunctionDeclaration\\`,\n\\`FunctionExpression\\`). Set to \\`\"any\"\\` if you want\nthe rule to apply to any JSDoc block throughout your files (as is necessary\nfor finding function blocks not attached to a function declaration or\nexpression, i.e., \\`@callback\\` or \\`@function\\` (or its aliases \\`@func\\` or\n\\`@method\\`) (including those associated with an \\`@interface\\`).\n\nSee the [\"AST and Selectors\"](../advanced.md#ast-and-selectors)\nsection of our Advanced docs for more on the expected format.`,\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA;AAA8C;AAAA,iCAE/B,IAAAA,qBAAY,EAAC,CAAC;EAC3B,MAAM;EACN;AACF,CAAC,KAAK;EACJ,KAAK,CAAC,mBAAmB,CAAC,SAAS,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK;IAChE,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAElD,IAAI,CACF,oBAAoB,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,CAC3D,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;MAChB;IACF;IAEA,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,EAAE;MAChC,MAAM,CAAC,kBAAkB,aAAa,eAAe,EAAE,IAAI,EAAE,QAAQ,CAAC;IACxE;EACF,CAAC,CAAC;AACJ,CAAC,EAAE;EACD,eAAe,EAAE,IAAI;EACrB,IAAI,EAAE;IACJ,IAAI,EAAE;MACJ,WAAW,EAAE,6GAA6G;MAC1H,GAAG,EAAE;IACP,CAAC;IACD,MAAM,EAAE,CACN;MACE,oBAAoB,EAAE,KAAK;MAC3B,UAAU,EAAE;QACV,QAAQ,EAAE;UACR,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8DAA8D;UAClD,KAAK,EAAE;YACL,KAAK,EAAE,CACL;cACE,IAAI,EAAE;YACR,CAAC,EACD;cACE,oBAAoB,EAAE,KAAK;cAC3B,UAAU,EAAE;gBACV,OAAO,EAAE;kBACP,IAAI,EAAE;gBACR,CAAC;gBACD,OAAO,EAAE;kBACP,IAAI,EAAE;gBACR;cACF,CAAC;cACD,IAAI,EAAE;YACR,CAAC;UAEL,CAAC;UACD,IAAI,EAAE;QACR;MACF,CAAC;MACD,IAAI,EAAE;IACR,CAAC,CACF;IACD,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA","ignoreList":[]}
@@ -1,5 +1,12 @@
1
- import iterateJsdoc from '../iterateJsdoc.js';
2
- export default iterateJsdoc(({
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc.cjs"));
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
+ var _default = exports.default = (0, _iterateJsdoc.default)(({
3
10
  report,
4
11
  utils
5
12
  }) => {
@@ -57,4 +64,5 @@ section of our Advanced docs for more on the expected format.`,
57
64
  type: 'suggestion'
58
65
  }
59
66
  });
67
+ module.exports = exports.default;
60
68
  //# sourceMappingURL=requireReturnsType.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"requireReturnsType.cjs","names":[],"sources":["../../src/rules/requireReturnsType.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nexport default iterateJsdoc(({\n report,\n utils,\n}) => {\n utils.forEachPreferredTag('returns', (jsdocTag, targetTagName) => {\n if (!jsdocTag.type) {\n report(`Missing JSDoc @${targetTagName} type.`, null, jsdocTag);\n }\n });\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: 'Requires that `@returns` tag has type value (in curly brackets).',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-returns-type.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n contexts: {\n description: `Set this to an array of strings representing the AST context (or an object with\noptional \\`context\\` and \\`comment\\` properties) where you wish the rule to be applied.\n\n\\`context\\` defaults to \\`any\\` and \\`comment\\` defaults to no specific comment context.\n\nOverrides the default contexts (\\`ArrowFunctionExpression\\`, \\`FunctionDeclaration\\`,\n\\`FunctionExpression\\`). Set to \\`\"any\"\\` if you want\nthe rule to apply to any JSDoc block throughout your files (as is necessary\nfor finding function blocks not attached to a function declaration or\nexpression, i.e., \\`@callback\\` or \\`@function\\` (or its aliases \\`@func\\` or\n\\`@method\\`) (including those associated with an \\`@interface\\`).\n\nSee the [\"AST and Selectors\"](../advanced.md#ast-and-selectors)\nsection of our Advanced docs for more on the expected format.`,\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":"AAAA,OAAO,YAAY,MAAM,oBAAoB;AAE7C,eAAe,YAAY,CAAC,CAAC;EAC3B,MAAM;EACN;AACF,CAAC,KAAK;EACJ,KAAK,CAAC,mBAAmB,CAAC,SAAS,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK;IAChE,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE;MAClB,MAAM,CAAC,kBAAkB,aAAa,QAAQ,EAAE,IAAI,EAAE,QAAQ,CAAC;IACjE;EACF,CAAC,CAAC;AACJ,CAAC,EAAE;EACD,eAAe,EAAE,IAAI;EACrB,IAAI,EAAE;IACJ,IAAI,EAAE;MACJ,WAAW,EAAE,kEAAkE;MAC/E,GAAG,EAAE;IACP,CAAC;IACD,MAAM,EAAE,CACN;MACE,oBAAoB,EAAE,KAAK;MAC3B,UAAU,EAAE;QACV,QAAQ,EAAE;UACR,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8DAA8D;UAClD,KAAK,EAAE;YACL,KAAK,EAAE,CACL;cACE,IAAI,EAAE;YACR,CAAC,EACD;cACE,oBAAoB,EAAE,KAAK;cAC3B,UAAU,EAAE;gBACV,OAAO,EAAE;kBACP,IAAI,EAAE;gBACR,CAAC;gBACD,OAAO,EAAE;kBACP,IAAI,EAAE;gBACR;cACF,CAAC;cACD,IAAI,EAAE;YACR,CAAC;UAEL,CAAC;UACD,IAAI,EAAE;QACR;MACF,CAAC;MACD,IAAI,EAAE;IACR,CAAC,CACF;IACD,IAAI,EAAE;EACR;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"requireReturnsType.cjs","names":["iterateJsdoc"],"sources":["../../src/rules/requireReturnsType.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nexport default iterateJsdoc(({\n report,\n utils,\n}) => {\n utils.forEachPreferredTag('returns', (jsdocTag, targetTagName) => {\n if (!jsdocTag.type) {\n report(`Missing JSDoc @${targetTagName} type.`, null, jsdocTag);\n }\n });\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: 'Requires that `@returns` tag has type value (in curly brackets).',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-returns-type.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n contexts: {\n description: `Set this to an array of strings representing the AST context (or an object with\noptional \\`context\\` and \\`comment\\` properties) where you wish the rule to be applied.\n\n\\`context\\` defaults to \\`any\\` and \\`comment\\` defaults to no specific comment context.\n\nOverrides the default contexts (\\`ArrowFunctionExpression\\`, \\`FunctionDeclaration\\`,\n\\`FunctionExpression\\`). Set to \\`\"any\"\\` if you want\nthe rule to apply to any JSDoc block throughout your files (as is necessary\nfor finding function blocks not attached to a function declaration or\nexpression, i.e., \\`@callback\\` or \\`@function\\` (or its aliases \\`@func\\` or\n\\`@method\\`) (including those associated with an \\`@interface\\`).\n\nSee the [\"AST and Selectors\"](../advanced.md#ast-and-selectors)\nsection of our Advanced docs for more on the expected format.`,\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA;AAA8C;AAAA,iCAE/B,IAAAA,qBAAY,EAAC,CAAC;EAC3B,MAAM;EACN;AACF,CAAC,KAAK;EACJ,KAAK,CAAC,mBAAmB,CAAC,SAAS,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK;IAChE,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE;MAClB,MAAM,CAAC,kBAAkB,aAAa,QAAQ,EAAE,IAAI,EAAE,QAAQ,CAAC;IACjE;EACF,CAAC,CAAC;AACJ,CAAC,EAAE;EACD,eAAe,EAAE,IAAI;EACrB,IAAI,EAAE;IACJ,IAAI,EAAE;MACJ,WAAW,EAAE,kEAAkE;MAC/E,GAAG,EAAE;IACP,CAAC;IACD,MAAM,EAAE,CACN;MACE,oBAAoB,EAAE,KAAK;MAC3B,UAAU,EAAE;QACV,QAAQ,EAAE;UACR,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8DAA8D;UAClD,KAAK,EAAE;YACL,KAAK,EAAE,CACL;cACE,IAAI,EAAE;YACR,CAAC,EACD;cACE,oBAAoB,EAAE,KAAK;cAC3B,UAAU,EAAE;gBACV,OAAO,EAAE;kBACP,IAAI,EAAE;gBACR,CAAC;gBACD,OAAO,EAAE;kBACP,IAAI,EAAE;gBACR;cACF,CAAC;cACD,IAAI,EAAE;YACR,CAAC;UAEL,CAAC;UACD,IAAI,EAAE;QACR;MACF,CAAC;MACD,IAAI,EAAE;IACR,CAAC,CACF;IACD,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA","ignoreList":[]}
@@ -1,5 +1,11 @@
1
- import { buildForbidRuleDefinition } from '../buildForbidRuleDefinition.js';
2
- export default buildForbidRuleDefinition({
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _buildForbidRuleDefinition = require("../buildForbidRuleDefinition.cjs");
8
+ var _default = exports.default = (0, _buildForbidRuleDefinition.buildForbidRuleDefinition)({
3
9
  description: 'Requires tags be present, optionally for specific contexts',
4
10
  getContexts(context, report) {
5
11
  // Transformed options to this option in `modifyContext`:
@@ -64,4 +70,5 @@ a string \`tag\` property and \`context\` string property.`,
64
70
  }],
65
71
  url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-tags.md#repos-sticky-header'
66
72
  });
73
+ module.exports = exports.default;
67
74
  //# sourceMappingURL=requireTags.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"requireTags.cjs","names":[],"sources":["../../src/rules/requireTags.js"],"sourcesContent":["import {\n buildForbidRuleDefinition,\n} from '../buildForbidRuleDefinition.js';\n\nexport default buildForbidRuleDefinition({\n description: 'Requires tags be present, optionally for specific contexts',\n getContexts (context, report) {\n // Transformed options to this option in `modifyContext`:\n if (!context.options[0].contexts) {\n report('Rule `require-tags` is missing a `tags` option.');\n return false;\n }\n\n const {\n contexts,\n } = context.options[0];\n\n return contexts;\n },\n modifyContext (context) {\n const tags = /** @type {(string|{tag: string, context: string})[]} */ (\n context.options?.[0]?.tags\n );\n\n const cntxts = tags?.map((tag) => {\n const tagName = typeof tag === 'string' ? tag : tag.tag;\n return {\n comment: `JsdocBlock:not(*:has(JsdocTag[tag=${\n tagName\n }]))`,\n context: typeof tag === 'string' ? 'any' : tag.context,\n message: `Missing required tag \"${tagName}\"`,\n };\n });\n\n // Reproduce context object with our own `contexts`\n const propertyDescriptors = Object.getOwnPropertyDescriptors(context);\n return Object.create(\n Object.getPrototypeOf(context),\n {\n ...propertyDescriptors,\n options: {\n ...propertyDescriptors.options,\n value: [\n {\n contexts: cntxts,\n },\n ],\n },\n },\n );\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n tags: {\n description: `May be an array of either strings or objects with\na string \\`tag\\` property and \\`context\\` string property.`,\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n properties: {\n context: {\n type: 'string',\n },\n tag: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-tags.md#repos-sticky-header',\n});\n"],"mappings":"AAAA,SACE,yBAAyB,QACpB,iCAAiC;AAExC,eAAe,yBAAyB,CAAC;EACvC,WAAW,EAAE,4DAA4D;EACzE,WAAW,CAAE,OAAO,EAAE,MAAM,EAAE;IAC5B;IACA,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;MAChC,MAAM,CAAC,iDAAiD,CAAC;MACzD,OAAO,KAAK;IACd;IAEA,MAAM;MACJ;IACF,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IAEtB,OAAO,QAAQ;EACjB,CAAC;EACD,aAAa,CAAE,OAAO,EAAE;IACtB,MAAM,IAAI,GAAG;IACX,OAAO,CAAC,OAAO,GAAG,CAAC,CAAC,EAAE,IACvB;IAED,MAAM,MAAM,GAAG,IAAI,EAAE,GAAG,CAAE,GAAG,IAAK;MAChC,MAAM,OAAO,GAAG,OAAO,GAAG,KAAK,QAAQ,GAAG,GAAG,GAAG,GAAG,CAAC,GAAG;MACvD,OAAO;QACL,OAAO,EAAE,qCACP,OAAO,KACJ;QACL,OAAO,EAAE,OAAO,GAAG,KAAK,QAAQ,GAAG,KAAK,GAAG,GAAG,CAAC,OAAO;QACtD,OAAO,EAAE,yBAAyB,OAAO;MAC3C,CAAC;IACH,CAAC,CAAC;;IAEF;IACA,MAAM,mBAAmB,GAAG,MAAM,CAAC,yBAAyB,CAAC,OAAO,CAAC;IACrE,OAAO,MAAM,CAAC,MAAM,CAClB,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,EAC9B;MACE,GAAG,mBAAmB;MACtB,OAAO,EAAE;QACP,GAAG,mBAAmB,CAAC,OAAO;QAC9B,KAAK,EAAE,CACL;UACE,QAAQ,EAAE;QACZ,CAAC;MAEL;IACF,CACF,CAAC;EACH,CAAC;EACD,MAAM,EAAE,CACN;IACE,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE;MACV,IAAI,EAAE;QACJ,WAAW,EAAE;AACvB,2DAA2D;QACjD,KAAK,EAAE;UACL,KAAK,EAAE,CACL;YACE,IAAI,EAAE;UACR,CAAC,EACD;YACE,UAAU,EAAE;cACV,OAAO,EAAE;gBACP,IAAI,EAAE;cACR,CAAC;cACD,GAAG,EAAE;gBACH,IAAI,EAAE;cACR;YACF,CAAC;YACD,IAAI,EAAE;UACR,CAAC;QAEL,CAAC;QACD,IAAI,EAAE;MACR;IACF,CAAC;IACD,IAAI,EAAE;EACR,CAAC,CACF;EACD,GAAG,EAAE;AACP,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"requireTags.cjs","names":["buildForbidRuleDefinition"],"sources":["../../src/rules/requireTags.js"],"sourcesContent":["import {\n buildForbidRuleDefinition,\n} from '../buildForbidRuleDefinition.js';\n\nexport default buildForbidRuleDefinition({\n description: 'Requires tags be present, optionally for specific contexts',\n getContexts (context, report) {\n // Transformed options to this option in `modifyContext`:\n if (!context.options[0].contexts) {\n report('Rule `require-tags` is missing a `tags` option.');\n return false;\n }\n\n const {\n contexts,\n } = context.options[0];\n\n return contexts;\n },\n modifyContext (context) {\n const tags = /** @type {(string|{tag: string, context: string})[]} */ (\n context.options?.[0]?.tags\n );\n\n const cntxts = tags?.map((tag) => {\n const tagName = typeof tag === 'string' ? tag : tag.tag;\n return {\n comment: `JsdocBlock:not(*:has(JsdocTag[tag=${\n tagName\n }]))`,\n context: typeof tag === 'string' ? 'any' : tag.context,\n message: `Missing required tag \"${tagName}\"`,\n };\n });\n\n // Reproduce context object with our own `contexts`\n const propertyDescriptors = Object.getOwnPropertyDescriptors(context);\n return Object.create(\n Object.getPrototypeOf(context),\n {\n ...propertyDescriptors,\n options: {\n ...propertyDescriptors.options,\n value: [\n {\n contexts: cntxts,\n },\n ],\n },\n },\n );\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n tags: {\n description: `May be an array of either strings or objects with\na string \\`tag\\` property and \\`context\\` string property.`,\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n properties: {\n context: {\n type: 'string',\n },\n tag: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-tags.md#repos-sticky-header',\n});\n"],"mappings":";;;;;;AAAA;AAEyC,iCAE1B,IAAAA,2BAAA,yBAAyB,EAAC;EACvC,WAAW,EAAE,4DAA4D;EACzE,WAAW,CAAE,OAAO,EAAE,MAAM,EAAE;IAC5B;IACA,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;MAChC,MAAM,CAAC,iDAAiD,CAAC;MACzD,OAAO,KAAK;IACd;IAEA,MAAM;MACJ;IACF,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IAEtB,OAAO,QAAQ;EACjB,CAAC;EACD,aAAa,CAAE,OAAO,EAAE;IACtB,MAAM,IAAI,GAAG;IACX,OAAO,CAAC,OAAO,GAAG,CAAC,CAAC,EAAE,IACvB;IAED,MAAM,MAAM,GAAG,IAAI,EAAE,GAAG,CAAE,GAAG,IAAK;MAChC,MAAM,OAAO,GAAG,OAAO,GAAG,KAAK,QAAQ,GAAG,GAAG,GAAG,GAAG,CAAC,GAAG;MACvD,OAAO;QACL,OAAO,EAAE,qCACP,OAAO,KACJ;QACL,OAAO,EAAE,OAAO,GAAG,KAAK,QAAQ,GAAG,KAAK,GAAG,GAAG,CAAC,OAAO;QACtD,OAAO,EAAE,yBAAyB,OAAO;MAC3C,CAAC;IACH,CAAC,CAAC;;IAEF;IACA,MAAM,mBAAmB,GAAG,MAAM,CAAC,yBAAyB,CAAC,OAAO,CAAC;IACrE,OAAO,MAAM,CAAC,MAAM,CAClB,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,EAC9B;MACE,GAAG,mBAAmB;MACtB,OAAO,EAAE;QACP,GAAG,mBAAmB,CAAC,OAAO;QAC9B,KAAK,EAAE,CACL;UACE,QAAQ,EAAE;QACZ,CAAC;MAEL;IACF,CACF,CAAC;EACH,CAAC;EACD,MAAM,EAAE,CACN;IACE,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE;MACV,IAAI,EAAE;QACJ,WAAW,EAAE;AACvB,2DAA2D;QACjD,KAAK,EAAE;UACL,KAAK,EAAE,CACL;YACE,IAAI,EAAE;UACR,CAAC,EACD;YACE,UAAU,EAAE;cACV,OAAO,EAAE;gBACP,IAAI,EAAE;cACR,CAAC;cACD,GAAG,EAAE;gBACH,IAAI,EAAE;cACR;YACF,CAAC;YACD,IAAI,EAAE;UACR,CAAC;QAEL,CAAC;QACD,IAAI,EAAE;MACR;IACF,CAAC;IACD,IAAI,EAAE;EACR,CAAC,CACF;EACD,GAAG,EAAE;AACP,CAAC,CAAC;AAAA","ignoreList":[]}
@@ -1,6 +1,13 @@
1
- import iterateJsdoc from '../iterateJsdoc.js';
2
- import { parse as parseType, traverse, tryParse as tryParseType } from '@es-joy/jsdoccomment';
3
- export default iterateJsdoc(({
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc.cjs"));
8
+ var _jsdoccomment = require("@es-joy/jsdoccomment");
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+ var _default = exports.default = (0, _iterateJsdoc.default)(({
4
11
  context,
5
12
  node,
6
13
  report,
@@ -108,11 +115,11 @@ export default iterateJsdoc(({
108
115
  const checkForUsedTypes = potentialTag => {
109
116
  let parsedType;
110
117
  try {
111
- parsedType = mode === 'permissive' ? tryParseType(/** @type {string} */potentialTag.type) : parseType(/** @type {string} */potentialTag.type, mode);
118
+ parsedType = mode === 'permissive' ? (0, _jsdoccomment.tryParse)(/** @type {string} */potentialTag.type) : (0, _jsdoccomment.parse)(/** @type {string} */potentialTag.type, mode);
112
119
  } catch {
113
120
  return;
114
121
  }
115
- traverse(parsedType, nde => {
122
+ (0, _jsdoccomment.traverse)(parsedType, nde => {
116
123
  if (nde.type === 'JsdocTypeTypeParameter') {
117
124
  templateNames.push(nde.name.value);
118
125
  return;
@@ -209,4 +216,5 @@ Defaults to \`false\`.`,
209
216
  type: 'suggestion'
210
217
  }
211
218
  });
219
+ module.exports = exports.default;
212
220
  //# sourceMappingURL=requireTemplate.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"requireTemplate.cjs","names":[],"sources":["../../src/rules/requireTemplate.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\nimport {\n parse as parseType,\n traverse,\n tryParse as tryParseType,\n} from '@es-joy/jsdoccomment';\n\nexport default iterateJsdoc(({\n context,\n node,\n report,\n settings,\n utils,\n}) => {\n if (utils.avoidDocs()) {\n return;\n }\n\n const {\n requireSeparateTemplates = false,\n } = context.options[0] || {};\n\n const {\n mode,\n } = settings;\n\n const usedNames = new Set();\n\n const tgName = /** @type {string} */ (utils.getPreferredTagName({\n tagName: 'template',\n }));\n if (!tgName) {\n return;\n }\n\n const templateTags = utils.getTags(tgName);\n\n const templateNames = templateTags.flatMap((tag) => {\n return utils.parseClosureTemplateTag(tag);\n });\n\n if (requireSeparateTemplates) {\n for (const tag of templateTags) {\n const names = utils.parseClosureTemplateTag(tag);\n if (names.length > 1) {\n report(`Missing separate @${tgName} for ${names[1]}`, null, tag);\n }\n }\n }\n\n /**\n * @param {import('@typescript-eslint/types').TSESTree.FunctionDeclaration|\n * import('@typescript-eslint/types').TSESTree.ClassDeclaration|\n * import('@typescript-eslint/types').TSESTree.TSDeclareFunction|\n * import('@typescript-eslint/types').TSESTree.TSInterfaceDeclaration|\n * import('@typescript-eslint/types').TSESTree.TSTypeAliasDeclaration} aliasDeclaration\n */\n const checkTypeParams = (aliasDeclaration) => {\n const {\n params,\n /* c8 ignore next -- Guard */\n } = aliasDeclaration.typeParameters ?? {\n /* c8 ignore next -- Guard */\n params: [],\n };\n for (const {\n name: {\n name,\n },\n } of params) {\n usedNames.add(name);\n }\n\n for (const usedName of usedNames) {\n if (!templateNames.includes(usedName)) {\n report(`Missing @${tgName} ${usedName}`);\n }\n }\n };\n\n const handleTypes = () => {\n const nde = /** @type {import('@typescript-eslint/types').TSESTree.Node} */ (\n node\n );\n if (!nde) {\n return;\n }\n\n switch (nde.type) {\n case 'ClassDeclaration':\n case 'FunctionDeclaration':\n case 'TSDeclareFunction':\n case 'TSInterfaceDeclaration':\n case 'TSTypeAliasDeclaration':\n checkTypeParams(nde);\n break;\n case 'ExportDefaultDeclaration':\n switch (nde.declaration?.type) {\n case 'ClassDeclaration':\n case 'FunctionDeclaration':\n case 'TSInterfaceDeclaration':\n checkTypeParams(nde.declaration);\n break;\n }\n\n break;\n case 'ExportNamedDeclaration':\n switch (nde.declaration?.type) {\n case 'ClassDeclaration':\n case 'FunctionDeclaration':\n case 'TSDeclareFunction':\n case 'TSInterfaceDeclaration':\n case 'TSTypeAliasDeclaration':\n checkTypeParams(nde.declaration);\n break;\n }\n\n break;\n }\n };\n\n const usedNameToTag = new Map();\n\n /**\n * @param {import('comment-parser').Spec} potentialTag\n */\n const checkForUsedTypes = (potentialTag) => {\n let parsedType;\n try {\n parsedType = mode === 'permissive' ?\n tryParseType(/** @type {string} */ (potentialTag.type)) :\n parseType(/** @type {string} */ (potentialTag.type), mode);\n } catch {\n return;\n }\n\n traverse(parsedType, (nde) => {\n if (nde.type === 'JsdocTypeTypeParameter') {\n templateNames.push(nde.name.value);\n return;\n }\n\n if (nde.type === 'JsdocTypeInfer') {\n templateNames.push(nde.element.value);\n return;\n }\n\n const {\n type,\n value,\n } = /** @type {import('jsdoc-type-pratt-parser').NameResult} */ (nde);\n\n if (type === 'JsdocTypeName' && (/^[A-Z]$/v).test(value)) {\n usedNames.add(value);\n if (!usedNameToTag.has(value)) {\n usedNameToTag.set(value, potentialTag);\n }\n }\n });\n };\n\n /**\n * @param {string[]} tagNames\n */\n const checkTagsAndTemplates = (tagNames) => {\n for (const tagName of tagNames) {\n const preferredTagName = /** @type {string} */ (utils.getPreferredTagName({\n tagName,\n }));\n const matchingTags = utils.getTags(preferredTagName);\n for (const matchingTag of matchingTags) {\n checkForUsedTypes(matchingTag);\n }\n }\n\n // Could check against whitelist/blacklist\n for (const usedName of usedNames) {\n if (!templateNames.includes(usedName)) {\n report(`Missing @${tgName} ${usedName}`, null, usedNameToTag.get(usedName));\n }\n }\n };\n\n const callbackTags = utils.getTags('callback');\n const functionTags = utils.getTags('function');\n if (callbackTags.length || functionTags.length) {\n checkTagsAndTemplates([\n 'param', 'returns',\n ]);\n return;\n }\n\n const typedefTags = utils.getTags('typedef');\n if (!typedefTags.length || typedefTags.length >= 2) {\n handleTypes();\n return;\n }\n\n const potentialTypedef = typedefTags[0];\n checkForUsedTypes(potentialTypedef);\n\n checkTagsAndTemplates([\n 'property',\n ]);\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Requires `@template` tags be present when type parameters are used.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-template.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n exemptedBy: {\n description: `Array of tags (e.g., \\`['type']\\`) whose presence on the document\nblock avoids the need for a \\`@template\\`. Defaults to an array with\n\\`inheritdoc\\`. If you set this array, it will overwrite the default,\nso be sure to add back \\`inheritdoc\\` if you wish its presence to cause\nexemption of the rule.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n requireSeparateTemplates: {\n description: `Requires that each template have its own separate line, i.e., preventing\ntemplates of this format:\n\n\\`\\`\\`js\n/**\n * @template T, U, V\n */\n\\`\\`\\`\n\nDefaults to \\`false\\`.`,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: '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]}
1
+ {"version":3,"file":"requireTemplate.cjs","names":["iterateJsdoc","tryParseType","parseType","traverse"],"sources":["../../src/rules/requireTemplate.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\nimport {\n parse as parseType,\n traverse,\n tryParse as tryParseType,\n} from '@es-joy/jsdoccomment';\n\nexport default iterateJsdoc(({\n context,\n node,\n report,\n settings,\n utils,\n}) => {\n if (utils.avoidDocs()) {\n return;\n }\n\n const {\n requireSeparateTemplates = false,\n } = context.options[0] || {};\n\n const {\n mode,\n } = settings;\n\n const usedNames = new Set();\n\n const tgName = /** @type {string} */ (utils.getPreferredTagName({\n tagName: 'template',\n }));\n if (!tgName) {\n return;\n }\n\n const templateTags = utils.getTags(tgName);\n\n const templateNames = templateTags.flatMap((tag) => {\n return utils.parseClosureTemplateTag(tag);\n });\n\n if (requireSeparateTemplates) {\n for (const tag of templateTags) {\n const names = utils.parseClosureTemplateTag(tag);\n if (names.length > 1) {\n report(`Missing separate @${tgName} for ${names[1]}`, null, tag);\n }\n }\n }\n\n /**\n * @param {import('@typescript-eslint/types').TSESTree.FunctionDeclaration|\n * import('@typescript-eslint/types').TSESTree.ClassDeclaration|\n * import('@typescript-eslint/types').TSESTree.TSDeclareFunction|\n * import('@typescript-eslint/types').TSESTree.TSInterfaceDeclaration|\n * import('@typescript-eslint/types').TSESTree.TSTypeAliasDeclaration} aliasDeclaration\n */\n const checkTypeParams = (aliasDeclaration) => {\n const {\n params,\n /* c8 ignore next -- Guard */\n } = aliasDeclaration.typeParameters ?? {\n /* c8 ignore next -- Guard */\n params: [],\n };\n for (const {\n name: {\n name,\n },\n } of params) {\n usedNames.add(name);\n }\n\n for (const usedName of usedNames) {\n if (!templateNames.includes(usedName)) {\n report(`Missing @${tgName} ${usedName}`);\n }\n }\n };\n\n const handleTypes = () => {\n const nde = /** @type {import('@typescript-eslint/types').TSESTree.Node} */ (\n node\n );\n if (!nde) {\n return;\n }\n\n switch (nde.type) {\n case 'ClassDeclaration':\n case 'FunctionDeclaration':\n case 'TSDeclareFunction':\n case 'TSInterfaceDeclaration':\n case 'TSTypeAliasDeclaration':\n checkTypeParams(nde);\n break;\n case 'ExportDefaultDeclaration':\n switch (nde.declaration?.type) {\n case 'ClassDeclaration':\n case 'FunctionDeclaration':\n case 'TSInterfaceDeclaration':\n checkTypeParams(nde.declaration);\n break;\n }\n\n break;\n case 'ExportNamedDeclaration':\n switch (nde.declaration?.type) {\n case 'ClassDeclaration':\n case 'FunctionDeclaration':\n case 'TSDeclareFunction':\n case 'TSInterfaceDeclaration':\n case 'TSTypeAliasDeclaration':\n checkTypeParams(nde.declaration);\n break;\n }\n\n break;\n }\n };\n\n const usedNameToTag = new Map();\n\n /**\n * @param {import('comment-parser').Spec} potentialTag\n */\n const checkForUsedTypes = (potentialTag) => {\n let parsedType;\n try {\n parsedType = mode === 'permissive' ?\n tryParseType(/** @type {string} */ (potentialTag.type)) :\n parseType(/** @type {string} */ (potentialTag.type), mode);\n } catch {\n return;\n }\n\n traverse(parsedType, (nde) => {\n if (nde.type === 'JsdocTypeTypeParameter') {\n templateNames.push(nde.name.value);\n return;\n }\n\n if (nde.type === 'JsdocTypeInfer') {\n templateNames.push(nde.element.value);\n return;\n }\n\n const {\n type,\n value,\n } = /** @type {import('jsdoc-type-pratt-parser').NameResult} */ (nde);\n\n if (type === 'JsdocTypeName' && (/^[A-Z]$/v).test(value)) {\n usedNames.add(value);\n if (!usedNameToTag.has(value)) {\n usedNameToTag.set(value, potentialTag);\n }\n }\n });\n };\n\n /**\n * @param {string[]} tagNames\n */\n const checkTagsAndTemplates = (tagNames) => {\n for (const tagName of tagNames) {\n const preferredTagName = /** @type {string} */ (utils.getPreferredTagName({\n tagName,\n }));\n const matchingTags = utils.getTags(preferredTagName);\n for (const matchingTag of matchingTags) {\n checkForUsedTypes(matchingTag);\n }\n }\n\n // Could check against whitelist/blacklist\n for (const usedName of usedNames) {\n if (!templateNames.includes(usedName)) {\n report(`Missing @${tgName} ${usedName}`, null, usedNameToTag.get(usedName));\n }\n }\n };\n\n const callbackTags = utils.getTags('callback');\n const functionTags = utils.getTags('function');\n if (callbackTags.length || functionTags.length) {\n checkTagsAndTemplates([\n 'param', 'returns',\n ]);\n return;\n }\n\n const typedefTags = utils.getTags('typedef');\n if (!typedefTags.length || typedefTags.length >= 2) {\n handleTypes();\n return;\n }\n\n const potentialTypedef = typedefTags[0];\n checkForUsedTypes(potentialTypedef);\n\n checkTagsAndTemplates([\n 'property',\n ]);\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Requires `@template` tags be present when type parameters are used.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-template.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n exemptedBy: {\n description: `Array of tags (e.g., \\`['type']\\`) whose presence on the document\nblock avoids the need for a \\`@template\\`. Defaults to an array with\n\\`inheritdoc\\`. If you set this array, it will overwrite the default,\nso be sure to add back \\`inheritdoc\\` if you wish its presence to cause\nexemption of the rule.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n requireSeparateTemplates: {\n description: `Requires that each template have its own separate line, i.e., preventing\ntemplates of this format:\n\n\\`\\`\\`js\n/**\n * @template T, U, V\n */\n\\`\\`\\`\n\nDefaults to \\`false\\`.`,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA;AACA;AAI8B;AAAA,iCAEf,IAAAA,qBAAY,EAAC,CAAC;EAC3B,OAAO;EACP,IAAI;EACJ,MAAM;EACN,QAAQ;EACR;AACF,CAAC,KAAK;EACJ,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE;IACrB;EACF;EAEA,MAAM;IACJ,wBAAwB,GAAG;EAC7B,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;EAE5B,MAAM;IACJ;EACF,CAAC,GAAG,QAAQ;EAEZ,MAAM,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,CAAC,SAAS,CAAC;EAC5C,IAAI,CAAC,WAAW,CAAC,MAAM,IAAI,WAAW,CAAC,MAAM,IAAI,CAAC,EAAE;IAClD,WAAW,CAAC,CAAC;IACb;EACF;EAEA,MAAM,gBAAgB,GAAG,WAAW,CAAC,CAAC,CAAC;EACvC,iBAAiB,CAAC,gBAAgB,CAAC;EAEnC,qBAAqB,CAAC,CACpB,UAAU,CACX,CAAC;AACJ,CAAC,EAAE;EACD,gBAAgB,EAAE,IAAI;EACtB,IAAI,EAAE;IACJ,IAAI,EAAE;MACJ,WAAW,EAAE,qEAAqE;MAClF,GAAG,EAAE;IACP,CAAC;IACD,MAAM,EAAE,CACN;MACE,oBAAoB,EAAE,KAAK;MAC3B,UAAU,EAAE;QACV,UAAU,EAAE;UACV,WAAW,EAAE;AACzB;AACA;AACA;AACA,uBAAuB;UACX,KAAK,EAAE;YACL,IAAI,EAAE;UACR,CAAC;UACD,IAAI,EAAE;QACR,CAAC;QACD,wBAAwB,EAAE;UACxB,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;UACX,IAAI,EAAE;QACR;MACF,CAAC;MACD,IAAI,EAAE;IACR,CAAC,CACF;IACD,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA","ignoreList":[]}
@@ -1,5 +1,11 @@
1
- import iterateJsdoc from '../iterateJsdoc.js';
1
+ "use strict";
2
2
 
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc.cjs"));
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
3
9
  /**
4
10
  * We can skip checking for a throws value, in case the documentation is inherited
5
11
  * or the method is either a constructor or an abstract method.
@@ -17,7 +23,7 @@ const canSkip = utils => {
17
23
  // The designated type can itself document `@throws`
18
24
  'type']) || utils.avoidDocs(false);
19
25
  };
20
- export default iterateJsdoc(({
26
+ var _default = exports.default = (0, _iterateJsdoc.default)(({
21
27
  report,
22
28
  utils
23
29
  }) => {
@@ -108,4 +114,5 @@ exemption of the rule.`,
108
114
  type: 'suggestion'
109
115
  }
110
116
  });
117
+ module.exports = exports.default;
111
118
  //# sourceMappingURL=requireThrows.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"requireThrows.cjs","names":[],"sources":["../../src/rules/requireThrows.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * We can skip checking for a throws value, in case the documentation is inherited\n * or the method is either a constructor or an abstract method.\n * @param {import('../iterateJsdoc.js').Utils} utils a reference to the utils which are used to probe if a tag is present or not.\n * @returns {boolean} true in case deep checking can be skipped; otherwise false.\n */\nconst canSkip = (utils) => {\n return utils.hasATag([\n // inheritdoc implies that all documentation is inherited\n // see https://jsdoc.app/tags-inheritdoc.html\n //\n // Abstract methods are by definition incomplete,\n // so it is not necessary to document that they throw an error.\n 'abstract',\n 'virtual',\n\n // The designated type can itself document `@throws`\n 'type',\n ]) ||\n utils.avoidDocs(false);\n};\n\nexport default iterateJsdoc(({\n report,\n utils,\n}) => {\n // A preflight check. We do not need to run a deep check for abstract\n // functions.\n if (canSkip(utils)) {\n return;\n }\n\n const tagName = /** @type {string} */ (utils.getPreferredTagName({\n tagName: 'throws',\n }));\n if (!tagName) {\n return;\n }\n\n const tags = utils.getTags(tagName);\n const iteratingFunction = utils.isIteratingFunction();\n\n // In case the code returns something, we expect a return value in JSDoc.\n const [\n tag,\n ] = tags;\n const missingThrowsTag = typeof tag === 'undefined' || tag === null;\n\n const shouldReport = () => {\n if (!missingThrowsTag) {\n if (tag.type.trim() === 'never' && iteratingFunction && utils.hasThrowValue()) {\n report(`JSDoc @${tagName} declaration set to \"never\" but throw value found.`);\n }\n\n return false;\n }\n\n return iteratingFunction && utils.hasThrowValue();\n };\n\n if (shouldReport()) {\n report(`Missing JSDoc @${tagName} declaration.`);\n }\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: 'Requires that throw statements are documented with `@throws` tags.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-throws.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n contexts: {\n description: `Set this to an array of strings representing the AST context\n(or objects with optional \\`context\\` and \\`comment\\` properties) where you wish\nthe rule to be applied.\n\n\\`context\\` defaults to \\`any\\` and \\`comment\\` defaults to no specific comment context.\n\nOverrides the default contexts (\\`ArrowFunctionExpression\\`, \\`FunctionDeclaration\\`,\n\\`FunctionExpression\\`). Set to \\`\"any\"\\` if you want\nthe rule to apply to any JSDoc block throughout your files (as is necessary\nfor finding function blocks not attached to a function declaration or\nexpression, i.e., \\`@callback\\` or \\`@function\\` (or its aliases \\`@func\\` or\n\\`@method\\`) (including those associated with an \\`@interface\\`).`,\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n exemptedBy: {\n description: `Array of tags (e.g., \\`['type']\\`) whose presence on the\ndocument block avoids the need for a \\`@throws\\`. Defaults to an array\nwith \\`inheritdoc\\`. If you set this array, it will overwrite the default,\nso be sure to add back \\`inheritdoc\\` if you wish its presence to cause\nexemption of the rule.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":"AAAA,OAAO,YAAY,MAAM,oBAAoB;;AAE7C;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,OAAO,GAAI,KAAK,IAAK;EACzB,OAAO,KAAK,CAAC,OAAO,CAAC;EACnB;EACA;EACA;EACA;EACA;EACA,UAAU,EACV,SAAS;EAET;EACA,MAAM,CACP,CAAC,IACA,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC;AAC1B,CAAC;AAED,eAAe,YAAY,CAAC,CAAC;EAC3B,MAAM;EACN;AACF,CAAC,KAA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AoB,EAAE,KAAK;cAC3B,UAAU,EAAE;gBACV,OAAO,EAAE;kBACP,IAAI,EAAE;gBACR,CAAC;gBACD,OAAO,EAAE;kBACP,IAAI,EAAE;gBACR;cACF,CAAC;cACD,IAAI,EAAE;YACR,CAAC;UAEL,CAAC;UACD,IAAI,EAAE;QACR,CAAC;QACD,UAAU,EAAE;UACV,WAAW,EAAE;AACzB;AACA;AACA;AACA,uBAAuB;UACX,KAAK,EAAE;YACL,IAAI,EAAE;UACR,CAAC;UACD,IAAI,EAAE;QACR;MACF,CAAC;MACD,IAAI,EAAE;IACR,CAAC,CACF;IACD,IAAI,EAAE;EACR;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"requireThrows.cjs","names":["iterateJsdoc"],"sources":["../../src/rules/requireThrows.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * We can skip checking for a throws value, in case the documentation is inherited\n * or the method is either a constructor or an abstract method.\n * @param {import('../iterateJsdoc.js').Utils} utils a reference to the utils which are used to probe if a tag is present or not.\n * @returns {boolean} true in case deep checking can be skipped; otherwise false.\n */\nconst canSkip = (utils) => {\n return utils.hasATag([\n // inheritdoc implies that all documentation is inherited\n // see https://jsdoc.app/tags-inheritdoc.html\n //\n // Abstract methods are by definition incomplete,\n // so it is not necessary to document that they throw an error.\n 'abstract',\n 'virtual',\n\n // The designated type can itself document `@throws`\n 'type',\n ]) ||\n utils.avoidDocs(false);\n};\n\nexport default iterateJsdoc(({\n report,\n utils,\n}) => {\n // A preflight check. We do not need to run a deep check for abstract\n // functions.\n if (canSkip(utils)) {\n return;\n }\n\n const tagName = /** @type {string} */ (utils.getPreferredTagName({\n tagName: 'throws',\n }));\n if (!tagName) {\n return;\n }\n\n const tags = utils.getTags(tagName);\n const iteratingFunction = utils.isIteratingFunction();\n\n // In case the code returns something, we expect a return value in JSDoc.\n const [\n tag,\n ] = tags;\n const missingThrowsTag = typeof tag === 'undefined' || tag === null;\n\n const shouldReport = () => {\n if (!missingThrowsTag) {\n if (tag.type.trim() === 'never' && iteratingFunction && utils.hasThrowValue()) {\n report(`JSDoc @${tagName} declaration set to \"never\" but throw value found.`);\n }\n\n return false;\n }\n\n return iteratingFunction && utils.hasThrowValue();\n };\n\n if (shouldReport()) {\n report(`Missing JSDoc @${tagName} declaration.`);\n }\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: 'Requires that throw statements are documented with `@throws` tags.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-throws.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n contexts: {\n description: `Set this to an array of strings representing the AST context\n(or objects with optional \\`context\\` and \\`comment\\` properties) where you wish\nthe rule to be applied.\n\n\\`context\\` defaults to \\`any\\` and \\`comment\\` defaults to no specific comment context.\n\nOverrides the default contexts (\\`ArrowFunctionExpression\\`, \\`FunctionDeclaration\\`,\n\\`FunctionExpression\\`). Set to \\`\"any\"\\` if you want\nthe rule to apply to any JSDoc block throughout your files (as is necessary\nfor finding function blocks not attached to a function declaration or\nexpression, i.e., \\`@callback\\` or \\`@function\\` (or its aliases \\`@func\\` or\n\\`@method\\`) (including those associated with an \\`@interface\\`).`,\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n exemptedBy: {\n description: `Array of tags (e.g., \\`['type']\\`) whose presence on the\ndocument block avoids the need for a \\`@throws\\`. Defaults to an array\nwith \\`inheritdoc\\`. If you set this array, it will overwrite the default,\nso be sure to add back \\`inheritdoc\\` if you wish its presence to cause\nexemption of the rule.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA;AAA8C;AAE9C;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,OAAO,GAAI,KAAK,IA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MAAM,EAAE,CACN;MACE,oBAAoB,EAAE,KAAK;MAC3B,UAAU,EAAE;QACV,QAAQ,EAAE;UACR,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kEAAkE;UACtD,KAAK,EAAE;YACL,KAAK,EAAE,CACL;cACE,IAAI,EAAE;YACR,CAAC,EACD;cACE,oBAAoB,EAAE,KAAK;cAC3B,UAAU,EAAE;gBACV,OAAO,EAAE;kBACP,IAAI,EAAE;gBACR,CAAC;gBACD,OAAO,EAAE;kBACP,IAAI,EAAE;gBACR;cACF,CAAC;cACD,IAAI,EAAE;YACR,CAAC;UAEL,CAAC;UACD,IAAI,EAAE;QACR,CAAC;QACD,UAAU,EAAE;UACV,WAAW,EAAE;AACzB;AACA;AACA;AACA,uBAAuB;UACX,KAAK,EAAE;YACL,IAAI,EAAE;UACR,CAAC;UACD,IAAI,EAAE;QACR;MACF,CAAC;MACD,IAAI,EAAE;IACR,CAAC,CACF;IACD,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA","ignoreList":[]}
@@ -1,5 +1,11 @@
1
- import iterateJsdoc from '../iterateJsdoc.js';
1
+ "use strict";
2
2
 
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc.cjs"));
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
3
9
  /**
4
10
  * We can skip checking for a yield value, in case the documentation is inherited
5
11
  * or the method has a constructor or abstract tag.
@@ -49,7 +55,7 @@ const checkTagName = (utils, report, tagName) => {
49
55
  const missingTag = typeof tag === 'undefined' || tag === null;
50
56
  return [preferredTagName, missingTag];
51
57
  };
52
- export default iterateJsdoc(({
58
+ var _default = exports.default = (0, _iterateJsdoc.default)(({
53
59
  context,
54
60
  report,
55
61
  utils
@@ -214,4 +220,5 @@ to catch \`@generator\` with \`@callback\` or such not attached to a function.`,
214
220
  type: 'suggestion'
215
221
  }
216
222
  });
223
+ module.exports = exports.default;
217
224
  //# sourceMappingURL=requireYields.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"requireYields.cjs","names":[],"sources":["../../src/rules/requireYields.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * We can skip checking for a yield value, in case the documentation is inherited\n * or the method has a constructor or abstract tag.\n *\n * In either of these cases the yield value is optional or not defined.\n * @param {import('../iterateJsdoc.js').Utils} utils a reference to the utils which are used to probe if a tag is present or not.\n * @returns {boolean} true in case deep checking can be skipped; otherwise false.\n */\nconst canSkip = (utils) => {\n return utils.hasATag([\n // inheritdoc implies that all documentation is inherited\n // see https://jsdoc.app/tags-inheritdoc.html\n //\n // Abstract methods are by definition incomplete,\n // so it is not an error if it declares a yield value but does not implement it.\n 'abstract',\n 'virtual',\n\n // Constructors do not have a yield value\n // so we can bail out here, too.\n 'class',\n 'constructor',\n\n // Yield (and any `next`) type is specified accompanying the targeted\n // @type\n 'type',\n\n // This seems to imply a class as well\n 'interface',\n ]) ||\n utils.avoidDocs();\n};\n\n/**\n * @param {import('../iterateJsdoc.js').Utils} utils\n * @param {import('../iterateJsdoc.js').Report} report\n * @param {string} tagName\n * @returns {[preferredTagName?: string, missingTag?: boolean]}\n */\nconst checkTagName = (utils, report, tagName) => {\n const preferredTagName = /** @type {string} */ (utils.getPreferredTagName({\n tagName,\n }));\n if (!preferredTagName) {\n return [];\n }\n\n const tags = utils.getTags(preferredTagName);\n\n if (tags.length > 1) {\n report(`Found more than one @${preferredTagName} declaration.`);\n }\n\n // In case the code yields something, we expect a yields value in JSDoc.\n const [\n tag,\n ] = tags;\n const missingTag = typeof tag === 'undefined' || tag === null;\n\n return [\n preferredTagName, missingTag,\n ];\n};\n\nexport default iterateJsdoc(({\n context,\n report,\n utils,\n}) => {\n const {\n forceRequireNext = false,\n forceRequireYields = false,\n next = false,\n nextWithGeneratorTag = false,\n withGeneratorTag = true,\n } = context.options[0] || {};\n\n // A preflight check. We do not need to run a deep check\n // in case the @yield comment is optional or undefined.\n if (canSkip(utils)) {\n return;\n }\n\n const iteratingFunction = utils.isIteratingFunction();\n\n const [\n preferredYieldTagName,\n missingYieldTag,\n ] = checkTagName(\n utils, report, 'yields',\n );\n if (preferredYieldTagName) {\n const shouldReportYields = () => {\n if (!missingYieldTag) {\n return false;\n }\n\n if (\n withGeneratorTag && utils.hasTag('generator') ||\n forceRequireYields && iteratingFunction && utils.isGenerator()\n ) {\n return true;\n }\n\n return iteratingFunction && utils.isGenerator() && utils.hasYieldValue();\n };\n\n if (shouldReportYields()) {\n report(`Missing JSDoc @${preferredYieldTagName} declaration.`);\n }\n }\n\n if (next || nextWithGeneratorTag || forceRequireNext) {\n const [\n preferredNextTagName,\n missingNextTag,\n ] = checkTagName(\n utils, report, 'next',\n );\n if (!preferredNextTagName) {\n return;\n }\n\n const shouldReportNext = () => {\n if (!missingNextTag) {\n return false;\n }\n\n if (\n nextWithGeneratorTag && utils.hasTag('generator')) {\n return true;\n }\n\n if (\n !next && !forceRequireNext ||\n !iteratingFunction ||\n !utils.isGenerator()\n ) {\n return false;\n }\n\n return forceRequireNext || utils.hasYieldReturnValue();\n };\n\n if (shouldReportNext()) {\n report(`Missing JSDoc @${preferredNextTagName} declaration.`);\n }\n }\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: 'Requires yields are documented with `@yields` tags.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-yields.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n contexts: {\n description: `Set this to an array of strings representing the AST context\n(or objects with optional \\`context\\` and \\`comment\\` properties) where you wish\nthe rule to be applied.\n\n\\`context\\` defaults to \\`any\\` and \\`comment\\` defaults to no specific comment context.\n\nOverrides the default contexts (\\`ArrowFunctionExpression\\`, \\`FunctionDeclaration\\`,\n\\`FunctionExpression\\`). Set to \\`\"any\"\\` if you want\nthe rule to apply to any JSDoc block throughout your files (as is necessary\nfor finding function blocks not attached to a function declaration or\nexpression, i.e., \\`@callback\\` or \\`@function\\` (or its aliases \\`@func\\` or\n\\`@method\\`) (including those associated with an \\`@interface\\`). This\nrule will only apply on non-default contexts when there is such a tag\npresent and the \\`forceRequireYields\\` option is set or if the\n\\`withGeneratorTag\\` option is set with a present \\`@generator\\` tag\n(since we are not checking against the actual \\`yield\\` values in these\ncases).`,\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n exemptedBy: {\n description: `Array of tags (e.g., \\`['type']\\`) whose presence on the\ndocument block avoids the need for a \\`@yields\\`. Defaults to an array\nwith \\`inheritdoc\\`. If you set this array, it will overwrite the default,\nso be sure to add back \\`inheritdoc\\` if you wish its presence to cause\nexemption of the rule.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n forceRequireNext: {\n default: false,\n description: `Set to \\`true\\` to always insist on\n\\`@next\\` documentation even if there are no \\`yield\\` statements in the\nfunction or none return values. May be desired to flag that a project is\naware of the expected yield return being \\`undefined\\`. Defaults to \\`false\\`.`,\n type: 'boolean',\n },\n forceRequireYields: {\n default: false,\n description: `Set to \\`true\\` to always insist on\n\\`@yields\\` documentation for generators even if there are only\nexpressionless \\`yield\\` statements in the function. May be desired to flag\nthat a project is aware of an \\`undefined\\`/\\`void\\` yield. Defaults to\n\\`false\\`.`,\n type: 'boolean',\n },\n next: {\n default: false,\n description: `If \\`true\\`, this option will insist that any use of a \\`yield\\` return\nvalue (e.g., \\`const rv = yield;\\` or \\`const rv = yield value;\\`) has a\n(non-standard) \\`@next\\` tag (in addition to any \\`@yields\\` tag) so as to be\nable to document the type expected to be supplied into the iterator\n(the \\`Generator\\` iterator that is returned by the call to the generator\nfunction) to the iterator (e.g., \\`it.next(value)\\`). The tag will not be\nexpected if the generator function body merely has plain \\`yield;\\` or\n\\`yield value;\\` statements without returning the values. Defaults to\n\\`false\\`.`,\n type: 'boolean',\n },\n nextWithGeneratorTag: {\n default: false,\n description: `If a \\`@generator\\` tag is present on a block, require\n(non-standard ) \\`@next\\` (see \\`next\\` option). This will require using \\`void\\`\nor \\`undefined\\` in cases where generators do not use the \\`next()\\`-supplied\nincoming \\`yield\\`-returned value. Defaults to \\`false\\`. See \\`contexts\\` to\n\\`any\\` if you want to catch \\`@generator\\` with \\`@callback\\` or such not\nattached to a function.`,\n type: 'boolean',\n },\n withGeneratorTag: {\n default: true,\n description: `If a \\`@generator\\` tag is present on a block, require\n\\`@yields\\`/\\`@yield\\`. Defaults to \\`true\\`. See \\`contexts\\` to \\`any\\` if you want\nto catch \\`@generator\\` with \\`@callback\\` or such not attached to a function.`,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":"AAAA,OAAO,YAAY,MAAM,oBAAoB;;AAE7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,OAAO,GAAI,KAAK,IAAK;EACzB,OAAO,KAAK,CAAC,OAAO,CAAC;EACnB;EACA;EACA;EACA;EACA;EACA,UAAU,EACV,SAAS;EAET;EACA;EACA,OAAO,EACP,aAAa;EAEb;EACA;EACA,MAAM;EAEN;EACA,WAAW,CACZ,CAAC,IACA,KAAK,CAAC,SAAS,CAAC,CAAC;AACrB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,KAAK;EAC/C,MAAM,gBAAgB,GAAG,qBAAuB,KAAK,CAAC,mBAAmB,CAAC;IACxE;EACF,CAAC,CAAE;EACH,IAAI,CAAC,gBAAgB,EAAE;IACrB,OAAO,EAAE;EACX;EAEA,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC;EAE5C,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;IACnB,MAAM,CAAC,wBA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,EAAE;UACV,WAAW,EAAE;AACzB;AACA;AACA;AACA,uBAAuB;UACX,KAAK,EAAE;YACL,IAAI,EAAE;UACR,CAAC;UACD,IAAI,EAAE;QACR,CAAC;QACD,gBAAgB,EAAE;UAChB,OAAO,EAAE,KAAK;UACd,WAAW,EAAE;AACzB;AACA;AACA,+EAA+E;UACnE,IAAI,EAAE;QACR,CAAC;QACD,kBAAkB,EAAE;UAClB,OAAO,EAAE,KAAK;UACd,WAAW,EAAE;AACzB;AACA;AACA;AACA,WAAW;UACC,IAAI,EAAE;QACR,CAAC;QACD,IAAI,EAAE;UACJ,OAAO,EAAE,KAAK;UACd,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;UACC,IAAI,EAAE;QACR,CAAC;QACD,oBAAoB,EAAE;UACpB,OAAO,EAAE,KAAK;UACd,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA,wBAAwB;UACZ,IAAI,EAAE;QACR,CAAC;QACD,gBAAgB,EAAE;UAChB,OAAO,EAAE,IAAI;UACb,WAAW,EAAE;AACzB;AACA,+EAA+E;UACnE,IAAI,EAAE;QACR;MACF,CAAC;MACD,IAAI,EAAE;IACR,CAAC,CACF;IACD,IAAI,EAAE;EACR;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"requireYields.cjs","names":["iterateJsdoc"],"sources":["../../src/rules/requireYields.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * We can skip checking for a yield value, in case the documentation is inherited\n * or the method has a constructor or abstract tag.\n *\n * In either of these cases the yield value is optional or not defined.\n * @param {import('../iterateJsdoc.js').Utils} utils a reference to the utils which are used to probe if a tag is present or not.\n * @returns {boolean} true in case deep checking can be skipped; otherwise false.\n */\nconst canSkip = (utils) => {\n return utils.hasATag([\n // inheritdoc implies that all documentation is inherited\n // see https://jsdoc.app/tags-inheritdoc.html\n //\n // Abstract methods are by definition incomplete,\n // so it is not an error if it declares a yield value but does not implement it.\n 'abstract',\n 'virtual',\n\n // Constructors do not have a yield value\n // so we can bail out here, too.\n 'class',\n 'constructor',\n\n // Yield (and any `next`) type is specified accompanying the targeted\n // @type\n 'type',\n\n // This seems to imply a class as well\n 'interface',\n ]) ||\n utils.avoidDocs();\n};\n\n/**\n * @param {import('../iterateJsdoc.js').Utils} utils\n * @param {import('../iterateJsdoc.js').Report} report\n * @param {string} tagName\n * @returns {[preferredTagName?: string, missingTag?: boolean]}\n */\nconst checkTagName = (utils, report, tagName) => {\n const preferredTagName = /** @type {string} */ (utils.getPreferredTagName({\n tagName,\n }));\n if (!preferredTagName) {\n return [];\n }\n\n const tags = utils.getTags(preferredTagName);\n\n if (tags.length > 1) {\n report(`Found more than one @${preferredTagName} declaration.`);\n }\n\n // In case the code yields something, we expect a yields value in JSDoc.\n const [\n tag,\n ] = tags;\n const missingTag = typeof tag === 'undefined' || tag === null;\n\n return [\n preferredTagName, missingTag,\n ];\n};\n\nexport default iterateJsdoc(({\n context,\n report,\n utils,\n}) => {\n const {\n forceRequireNext = false,\n forceRequireYields = false,\n next = false,\n nextWithGeneratorTag = false,\n withGeneratorTag = true,\n } = context.options[0] || {};\n\n // A preflight check. We do not need to run a deep check\n // in case the @yield comment is optional or undefined.\n if (canSkip(utils)) {\n return;\n }\n\n const iteratingFunction = utils.isIteratingFunction();\n\n const [\n preferredYieldTagName,\n missingYieldTag,\n ] = checkTagName(\n utils, report, 'yields',\n );\n if (preferredYieldTagName) {\n const shouldReportYields = () => {\n if (!missingYieldTag) {\n return false;\n }\n\n if (\n withGeneratorTag && utils.hasTag('generator') ||\n forceRequireYields && iteratingFunction && utils.isGenerator()\n ) {\n return true;\n }\n\n return iteratingFunction && utils.isGenerator() && utils.hasYieldValue();\n };\n\n if (shouldReportYields()) {\n report(`Missing JSDoc @${preferredYieldTagName} declaration.`);\n }\n }\n\n if (next || nextWithGeneratorTag || forceRequireNext) {\n const [\n preferredNextTagName,\n missingNextTag,\n ] = checkTagName(\n utils, report, 'next',\n );\n if (!preferredNextTagName) {\n return;\n }\n\n const shouldReportNext = () => {\n if (!missingNextTag) {\n return false;\n }\n\n if (\n nextWithGeneratorTag && utils.hasTag('generator')) {\n return true;\n }\n\n if (\n !next && !forceRequireNext ||\n !iteratingFunction ||\n !utils.isGenerator()\n ) {\n return false;\n }\n\n return forceRequireNext || utils.hasYieldReturnValue();\n };\n\n if (shouldReportNext()) {\n report(`Missing JSDoc @${preferredNextTagName} declaration.`);\n }\n }\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: 'Requires yields are documented with `@yields` tags.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-yields.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n contexts: {\n description: `Set this to an array of strings representing the AST context\n(or objects with optional \\`context\\` and \\`comment\\` properties) where you wish\nthe rule to be applied.\n\n\\`context\\` defaults to \\`any\\` and \\`comment\\` defaults to no specific comment context.\n\nOverrides the default contexts (\\`ArrowFunctionExpression\\`, \\`FunctionDeclaration\\`,\n\\`FunctionExpression\\`). Set to \\`\"any\"\\` if you want\nthe rule to apply to any JSDoc block throughout your files (as is necessary\nfor finding function blocks not attached to a function declaration or\nexpression, i.e., \\`@callback\\` or \\`@function\\` (or its aliases \\`@func\\` or\n\\`@method\\`) (including those associated with an \\`@interface\\`). This\nrule will only apply on non-default contexts when there is such a tag\npresent and the \\`forceRequireYields\\` option is set or if the\n\\`withGeneratorTag\\` option is set with a present \\`@generator\\` tag\n(since we are not checking against the actual \\`yield\\` values in these\ncases).`,\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n exemptedBy: {\n description: `Array of tags (e.g., \\`['type']\\`) whose presence on the\ndocument block avoids the need for a \\`@yields\\`. Defaults to an array\nwith \\`inheritdoc\\`. If you set this array, it will overwrite the default,\nso be sure to add back \\`inheritdoc\\` if you wish its presence to cause\nexemption of the rule.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n forceRequireNext: {\n default: false,\n description: `Set to \\`true\\` to always insist on\n\\`@next\\` documentation even if there are no \\`yield\\` statements in the\nfunction or none return values. May be desired to flag that a project is\naware of the expected yield return being \\`undefined\\`. Defaults to \\`false\\`.`,\n type: 'boolean',\n },\n forceRequireYields: {\n default: false,\n description: `Set to \\`true\\` to always insist on\n\\`@yields\\` documentation for generators even if there are only\nexpressionless \\`yield\\` statements in the function. May be desired to flag\nthat a project is aware of an \\`undefined\\`/\\`void\\` yield. Defaults to\n\\`false\\`.`,\n type: 'boolean',\n },\n next: {\n default: false,\n description: `If \\`true\\`, this option will insist that any use of a \\`yield\\` return\nvalue (e.g., \\`const rv = yield;\\` or \\`const rv = yield value;\\`) has a\n(non-standard) \\`@next\\` tag (in addition to any \\`@yields\\` tag) so as to be\nable to document the type expected to be supplied into the iterator\n(the \\`Generator\\` iterator that is returned by the call to the generator\nfunction) to the iterator (e.g., \\`it.next(value)\\`). The tag will not be\nexpected if the generator function body merely has plain \\`yield;\\` or\n\\`yield value;\\` statements without returning the values. Defaults to\n\\`false\\`.`,\n type: 'boolean',\n },\n nextWithGeneratorTag: {\n default: false,\n description: `If a \\`@generator\\` tag is present on a block, require\n(non-standard ) \\`@next\\` (see \\`next\\` option). This will require using \\`void\\`\nor \\`undefined\\` in cases where generators do not use the \\`next()\\`-supplied\nincoming \\`yield\\`-returned value. Defaults to \\`false\\`. See \\`contexts\\` to\n\\`any\\` if you want to catch \\`@generator\\` with \\`@callback\\` or such not\nattached to a function.`,\n type: 'boolean',\n },\n withGeneratorTag: {\n default: true,\n description: `If a \\`@generator\\` tag is present on a block, require\n\\`@yields\\`/\\`@yield\\`. Defaults to \\`true\\`. See \\`contexts\\` to \\`any\\` if you want\nto catch \\`@generator\\` with \\`@callback\\` or such not attached to a function.`,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type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AE,KAAK;UACd,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA,wBAAwB;UACZ,IAAI,EAAE;QACR,CAAC;QACD,gBAAgB,EAAE;UAChB,OAAO,EAAE,IAAI;UACb,WAAW,EAAE;AACzB;AACA,+EAA+E;UACnE,IAAI,EAAE;QACR;MACF,CAAC;MACD,IAAI,EAAE;IACR,CAAC,CACF;IACD,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA","ignoreList":[]}
@@ -1,5 +1,11 @@
1
- import iterateJsdoc from '../iterateJsdoc.js';
1
+ "use strict";
2
2
 
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc.cjs"));
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
3
9
  /**
4
10
  * @param {import('../iterateJsdoc.js').Utils} utils
5
11
  * @param {import('../iterateJsdoc.js').Settings} settings
@@ -48,7 +54,7 @@ const checkTagName = (utils, report, tagName) => {
48
54
  }
49
55
  return [preferredTagName, tags[0]];
50
56
  };
51
- export default iterateJsdoc(({
57
+ var _default = exports.default = (0, _iterateJsdoc.default)(({
52
58
  context,
53
59
  report,
54
60
  settings,
@@ -169,4 +175,5 @@ the values. Defaults to \`false\`.`,
169
175
  type: 'suggestion'
170
176
  }
171
177
  });
178
+ module.exports = exports.default;
172
179
  //# sourceMappingURL=requireYieldsCheck.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"requireYieldsCheck.cjs","names":[],"sources":["../../src/rules/requireYieldsCheck.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * @param {import('../iterateJsdoc.js').Utils} utils\n * @param {import('../iterateJsdoc.js').Settings} settings\n * @returns {boolean}\n */\nconst canSkip = (utils, settings) => {\n const voidingTags = [\n // An abstract function is by definition incomplete\n // so it is perfectly fine if a yield is documented but\n // not present within the function.\n // A subclass may inherit the doc and implement the\n // missing yield.\n 'abstract',\n 'virtual',\n\n // Constructor functions do not have a yield value\n // so we can bail here, too.\n 'class',\n 'constructor',\n\n // This seems to imply a class as well\n 'interface',\n ];\n\n if (settings.mode === 'closure') {\n // Structural Interface in GCC terms, equivalent to @interface tag as far as this rule is concerned\n voidingTags.push('record');\n }\n\n return utils.hasATag(voidingTags) ||\n utils.isConstructor() ||\n utils.classHasTag('interface') ||\n settings.mode === 'closure' && utils.classHasTag('record');\n};\n\n/**\n * @param {import('../iterateJsdoc.js').Utils} utils\n * @param {import('../iterateJsdoc.js').Report} report\n * @param {string} tagName\n * @returns {[]|[preferredTagName: string, tag: import('comment-parser').Spec]}\n */\nconst checkTagName = (utils, report, tagName) => {\n const preferredTagName = /** @type {string} */ (utils.getPreferredTagName({\n tagName,\n }));\n if (!preferredTagName) {\n return [];\n }\n\n const tags = utils.getTags(preferredTagName);\n\n if (tags.length === 0) {\n return [];\n }\n\n if (tags.length > 1) {\n report(`Found more than one @${preferredTagName} declaration.`);\n\n return [];\n }\n\n return [\n preferredTagName, tags[0],\n ];\n};\n\nexport default iterateJsdoc(({\n context,\n report,\n settings,\n utils,\n}) => {\n if (canSkip(utils, settings)) {\n return;\n }\n\n const {\n checkGeneratorsOnly = false,\n next = false,\n } = context.options[0] || {};\n\n const [\n preferredYieldTagName,\n yieldTag,\n ] = checkTagName(\n utils, report, 'yields',\n );\n if (preferredYieldTagName) {\n const shouldReportYields = () => {\n if (\n /** @type {import('comment-parser').Spec} */ (\n yieldTag\n ).type.trim() === 'never'\n ) {\n if (utils.hasYieldValue()) {\n report(`JSDoc @${preferredYieldTagName} declaration set with \"never\" but yield expression is present in function.`);\n }\n\n return false;\n }\n\n if (checkGeneratorsOnly && !utils.isGenerator()) {\n return true;\n }\n\n return !utils.mayBeUndefinedTypeTag(\n /** @type {import('comment-parser').Spec} */\n (yieldTag),\n ) && !utils.hasYieldValue();\n };\n\n // In case a yield value is declared in JSDoc, we also expect one in the code.\n if (shouldReportYields()) {\n report(`JSDoc @${preferredYieldTagName} declaration present but yield expression not available in function.`);\n }\n }\n\n if (next) {\n const [\n preferredNextTagName,\n nextTag,\n ] = checkTagName(\n utils, report, 'next',\n );\n if (preferredNextTagName) {\n const shouldReportNext = () => {\n if (\n /** @type {import('comment-parser').Spec} */ (\n nextTag\n ).type.trim() === 'never'\n ) {\n if (utils.hasYieldReturnValue()) {\n report(`JSDoc @${preferredNextTagName} declaration set with \"never\" but yield expression with return value is present in function.`);\n }\n\n return false;\n }\n\n if (checkGeneratorsOnly && !utils.isGenerator()) {\n return true;\n }\n\n return !utils.mayBeUndefinedTypeTag(\n /** @type {import('comment-parser').Spec} */\n (nextTag),\n ) && !utils.hasYieldReturnValue();\n };\n\n if (shouldReportNext()) {\n report(`JSDoc @${preferredNextTagName} declaration present but yield expression with return value not available in function.`);\n }\n }\n }\n}, {\n meta: {\n docs: {\n description: 'Ensures that if a `@yields` is present that a `yield` (or `yield` with a value) is present in the function body (or that if a `@next` is present that there is a yield with a return value present).',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-yields-check.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n checkGeneratorsOnly: {\n default: false,\n description: `Avoids checking the function body and merely insists\nthat all generators have \\`@yields\\`. This can be an optimization with the\nESLint \\`require-yield\\` rule, as that rule already ensures a \\`yield\\` is\npresent in generators, albeit assuming the generator is not empty).\nDefaults to \\`false\\`.`,\n type: 'boolean',\n },\n contexts: {\n description: `Set this to an array of strings representing the AST context\n(or objects with optional \\`context\\` and \\`comment\\` properties) where you wish\nthe rule to be applied.\n\n\\`context\\` defaults to \\`any\\` and \\`comment\\` defaults to no specific comment context.\n\nOverrides the default contexts (\\`ArrowFunctionExpression\\`, \\`FunctionDeclaration\\`,\n\\`FunctionExpression\\`).`,\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n next: {\n default: false,\n description: `If \\`true\\`, this option will insist that any use of a (non-standard)\n\\`@next\\` tag (in addition to any \\`@yields\\` tag) will be matched by a \\`yield\\`\nwhich uses a return value in the body of the generator (e.g.,\n\\`const rv = yield;\\` or \\`const rv = yield value;\\`). This (non-standard)\ntag is intended to be used to indicate a type and/or description of\nthe value expected to be supplied by the user when supplied to the iterator\nby its \\`next\\` method, as with \\`it.next(value)\\` (with the iterator being\nthe \\`Generator\\` iterator that is returned by the call to the generator\nfunction). This option will report an error if the generator function body\nmerely has plain \\`yield;\\` or \\`yield value;\\` statements without returning\nthe values. Defaults to \\`false\\`.`,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":"AAAA,OAAO,YAAY,MAAM,oBAAoB;;AAE7C;AACA;AACA;AACA;AACA;AACA,MAAM,OAAO,GAAG,CAAC,KAAK,EAAE,QAAQ,KAAK;EACnC,MAAM,WAAW,GAAG;EAClB;EACA;EACA;EACA;EACA;EACA,UAAU,EACV,SAAS;EAET;EACA;EACA,OAAO,EACP,aAAa;EAEb;EACA,WAAW,CACZ;EAED,IAAI,QAAQ,CAAC,IAAI,KAAK,SAAS,EAAE;IAC/B;IACA,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC;EAC5B;EAEA,OAAO,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,IAC/B,KAAK,CAAC,aAAa,CAAC,CAAC,IACrB,KAAK,CAAC,WAAW,CAAC,WAAW,CAAC,IAC9B,QAAQ,CAAC,IAAI,KAAK,SAAS,IAAI,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC;AAC9D,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,KAAK;EAC/C,MAAM,gBAAgB,GAAG,qBAAuB,KAAK,CAAC,mBAAmB,CAAC;IACxE;EACF,CAAC,CAAE;E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oBAAoB,EAAE,KAAK;cAC3B,UAAU,EAAE;gBACV,OAAO,EAAE;kBACP,IAAI,EAAE;gBACR,CAAC;gBACD,OAAO,EAAE;kBACP,IAAI,EAAE;gBACR;cACF,CAAC;cACD,IAAI,EAAE;YACR,CAAC;UAEL,CAAC;UACD,IAAI,EAAE;QACR,CAAC;QACD,IAAI,EAAE;UACJ,OAAO,EAAE,KAAK;UACd,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC;UACvB,IAAI,EAAE;QACR;MACF,CAAC;MACD,IAAI,EAAE;IACR,CAAC,CACF;IACD,IAAI,EAAE;EACR;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"requireYieldsCheck.cjs","names":["iterateJsdoc"],"sources":["../../src/rules/requireYieldsCheck.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * @param {import('../iterateJsdoc.js').Utils} utils\n * @param {import('../iterateJsdoc.js').Settings} settings\n * @returns {boolean}\n */\nconst canSkip = (utils, settings) => {\n const voidingTags = [\n // An abstract function is by definition incomplete\n // so it is perfectly fine if a yield is documented but\n // not present within the function.\n // A subclass may inherit the doc and implement the\n // missing yield.\n 'abstract',\n 'virtual',\n\n // Constructor functions do not have a yield value\n // so we can bail here, too.\n 'class',\n 'constructor',\n\n // This seems to imply a class as well\n 'interface',\n ];\n\n if (settings.mode === 'closure') {\n // Structural Interface in GCC terms, equivalent to @interface tag as far as this rule is concerned\n voidingTags.push('record');\n }\n\n return utils.hasATag(voidingTags) ||\n utils.isConstructor() ||\n utils.classHasTag('interface') ||\n settings.mode === 'closure' && utils.classHasTag('record');\n};\n\n/**\n * @param {import('../iterateJsdoc.js').Utils} utils\n * @param {import('../iterateJsdoc.js').Report} report\n * @param {string} tagName\n * @returns {[]|[preferredTagName: string, tag: import('comment-parser').Spec]}\n */\nconst checkTagName = (utils, report, tagName) => {\n const preferredTagName = /** @type {string} */ (utils.getPreferredTagName({\n tagName,\n }));\n if (!preferredTagName) {\n return [];\n }\n\n const tags = utils.getTags(preferredTagName);\n\n if (tags.length === 0) {\n return [];\n }\n\n if (tags.length > 1) {\n report(`Found more than one @${preferredTagName} declaration.`);\n\n return [];\n }\n\n return [\n preferredTagName, tags[0],\n ];\n};\n\nexport default iterateJsdoc(({\n context,\n report,\n settings,\n utils,\n}) => {\n if (canSkip(utils, settings)) {\n return;\n }\n\n const {\n checkGeneratorsOnly = false,\n next = false,\n } = context.options[0] || {};\n\n const [\n preferredYieldTagName,\n yieldTag,\n ] = checkTagName(\n utils, report, 'yields',\n );\n if (preferredYieldTagName) {\n const shouldReportYields = () => {\n if (\n /** @type {import('comment-parser').Spec} */ (\n yieldTag\n ).type.trim() === 'never'\n ) {\n if (utils.hasYieldValue()) {\n report(`JSDoc @${preferredYieldTagName} declaration set with \"never\" but yield expression is present in function.`);\n }\n\n return false;\n }\n\n if (checkGeneratorsOnly && !utils.isGenerator()) {\n return true;\n }\n\n return !utils.mayBeUndefinedTypeTag(\n /** @type {import('comment-parser').Spec} */\n (yieldTag),\n ) && !utils.hasYieldValue();\n };\n\n // In case a yield value is declared in JSDoc, we also expect one in the code.\n if (shouldReportYields()) {\n report(`JSDoc @${preferredYieldTagName} declaration present but yield expression not available in function.`);\n }\n }\n\n if (next) {\n const [\n preferredNextTagName,\n nextTag,\n ] = checkTagName(\n utils, report, 'next',\n );\n if (preferredNextTagName) {\n const shouldReportNext = () => {\n if (\n /** @type {import('comment-parser').Spec} */ (\n nextTag\n ).type.trim() === 'never'\n ) {\n if (utils.hasYieldReturnValue()) {\n report(`JSDoc @${preferredNextTagName} declaration set with \"never\" but yield expression with return value is present in function.`);\n }\n\n return false;\n }\n\n if (checkGeneratorsOnly && !utils.isGenerator()) {\n return true;\n }\n\n return !utils.mayBeUndefinedTypeTag(\n /** @type {import('comment-parser').Spec} */\n (nextTag),\n ) && !utils.hasYieldReturnValue();\n };\n\n if (shouldReportNext()) {\n report(`JSDoc @${preferredNextTagName} declaration present but yield expression with return value not available in function.`);\n }\n }\n }\n}, {\n meta: {\n docs: {\n description: 'Ensures that if a `@yields` is present that a `yield` (or `yield` with a value) is present in the function body (or that if a `@next` is present that there is a yield with a return value present).',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-yields-check.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n checkGeneratorsOnly: {\n default: false,\n description: `Avoids checking the function body and merely insists\nthat all generators have \\`@yields\\`. This can be an optimization with the\nESLint \\`require-yield\\` rule, as that rule already ensures a \\`yield\\` is\npresent in generators, albeit assuming the generator is not empty).\nDefaults to \\`false\\`.`,\n type: 'boolean',\n },\n contexts: {\n description: `Set this to an array of strings representing the AST context\n(or objects with optional \\`context\\` and \\`comment\\` properties) where you wish\nthe rule to be applied.\n\n\\`context\\` defaults to \\`any\\` and \\`comment\\` defaults to no specific comment context.\n\nOverrides the default contexts (\\`ArrowFunctionExpression\\`, \\`FunctionDeclaration\\`,\n\\`FunctionExpression\\`).`,\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n next: {\n default: false,\n description: `If \\`true\\`, this option will insist that any use of a (non-standard)\n\\`@next\\` tag (in addition to any \\`@yields\\` tag) will be matched by a \\`yield\\`\nwhich uses a return value in the body of the generator (e.g.,\n\\`const rv = yield;\\` or \\`const rv = yield value;\\`). This (non-standard)\ntag is intended to be used to indicate a type and/or description of\nthe value expected to be supplied by the user when supplied to the iterator\nby its \\`next\\` method, as with \\`it.next(value)\\` (with the iterator being\nthe \\`Generator\\` iterator that is returned by the call to the generator\nfunction). This option will report an error if the generator function body\nmerely has plain \\`yield;\\` or \\`yield value;\\` statements without returning\nthe values. Defaults to \\`false\\`.`,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n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TagOrder from '../defaultTagOrder.js';
2
- import iterateJsdoc from '../iterateJsdoc.js';
3
- export default iterateJsdoc(({
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _defaultTagOrder = _interopRequireDefault(require("../defaultTagOrder.cjs"));
8
+ var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc.cjs"));
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+ var _default = exports.default = (0, _iterateJsdoc.default)(({
4
11
  context,
5
12
  jsdoc,
6
13
  utils
@@ -25,7 +32,7 @@ export default iterateJsdoc(({
25
32
  reportIntraTagGroupSpacing = true,
26
33
  reportTagGroupSpacing = true,
27
34
  tagExceptions = {},
28
- tagSequence = defaultTagOrder
35
+ tagSequence = _defaultTagOrder.default
29
36
  } = context.options[0] || {};
30
37
  const tagList = tagSequence.flatMap(obj => {
31
38
  /* typeof obj === 'string' ? obj : */
@@ -645,4 +652,5 @@ a fixed order that doesn't change into the future, supply your own
645
652
  type: 'suggestion'
646
653
  }
647
654
  });
655
+ module.exports = exports.default;
648
656
  //# sourceMappingURL=sortTags.cjs.map