eslint-plugin-jsdoc 58.1.1 → 59.0.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 (184) hide show
  1. package/README.md +66 -62
  2. package/dist/buildForbidRuleDefinition.cjs +0 -1
  3. package/dist/buildForbidRuleDefinition.cjs.map +1 -1
  4. package/dist/buildRejectOrPreferRuleDefinition.cjs +7 -2
  5. package/dist/buildRejectOrPreferRuleDefinition.cjs.map +1 -1
  6. package/dist/cjs/rules/convertToJsdocComments.d.ts +7 -0
  7. package/dist/generateDocs.cjs +129 -3
  8. package/dist/generateDocs.cjs.map +1 -1
  9. package/dist/generateRule.cjs +3 -1
  10. package/dist/generateRule.cjs.map +1 -1
  11. package/dist/generateRuleTypes.cjs +5 -5
  12. package/dist/generateRuleTypes.cjs.map +1 -1
  13. package/dist/index-cjs.cjs +30 -0
  14. package/dist/index-cjs.cjs.map +1 -1
  15. package/dist/index.cjs +30 -0
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/rules/checkAccess.cjs +1 -1
  18. package/dist/rules/checkAccess.cjs.map +1 -1
  19. package/dist/rules/checkAlignment.cjs +4 -1
  20. package/dist/rules/checkAlignment.cjs.map +1 -1
  21. package/dist/rules/checkExamples.cjs +1 -1
  22. package/dist/rules/checkExamples.cjs.map +1 -1
  23. package/dist/rules/checkIndentation.cjs +19 -0
  24. package/dist/rules/checkIndentation.cjs.map +1 -1
  25. package/dist/rules/checkLineAlignment.cjs +25 -1
  26. package/dist/rules/checkLineAlignment.cjs.map +1 -1
  27. package/dist/rules/checkParamNames.cjs +62 -1
  28. package/dist/rules/checkParamNames.cjs.map +1 -1
  29. package/dist/rules/checkPropertyNames.cjs +6 -0
  30. package/dist/rules/checkPropertyNames.cjs.map +1 -1
  31. package/dist/rules/checkTagNames.cjs +71 -0
  32. package/dist/rules/checkTagNames.cjs.map +1 -1
  33. package/dist/rules/checkTypes.cjs +16 -1
  34. package/dist/rules/checkTypes.cjs.map +1 -1
  35. package/dist/rules/checkValues.cjs +17 -1
  36. package/dist/rules/checkValues.cjs.map +1 -1
  37. package/dist/rules/convertToJsdocComments.cjs +48 -0
  38. package/dist/rules/convertToJsdocComments.cjs.map +1 -1
  39. package/dist/rules/convertToJsdocComments.d.ts +7 -0
  40. package/dist/rules/emptyTags.cjs +10 -1
  41. package/dist/rules/emptyTags.cjs.map +1 -1
  42. package/dist/rules/implementsOnClasses.cjs +15 -1
  43. package/dist/rules/implementsOnClasses.cjs.map +1 -1
  44. package/dist/rules/informativeDocs.cjs +45 -0
  45. package/dist/rules/informativeDocs.cjs.map +1 -1
  46. package/dist/rules/linesBeforeBlock.cjs +14 -0
  47. package/dist/rules/linesBeforeBlock.cjs.map +1 -1
  48. package/dist/rules/matchDescription.cjs +129 -0
  49. package/dist/rules/matchDescription.cjs.map +1 -1
  50. package/dist/rules/matchName.cjs +30 -0
  51. package/dist/rules/matchName.cjs.map +1 -1
  52. package/dist/rules/multilineBlocks.cjs +78 -6
  53. package/dist/rules/multilineBlocks.cjs.map +1 -1
  54. package/dist/rules/noBadBlocks.cjs +11 -2
  55. package/dist/rules/noBadBlocks.cjs.map +1 -1
  56. package/dist/rules/noBlankBlockDescriptions.cjs +1 -1
  57. package/dist/rules/noBlankBlockDescriptions.cjs.map +1 -1
  58. package/dist/rules/noBlankBlocks.cjs +3 -1
  59. package/dist/rules/noBlankBlocks.cjs.map +1 -1
  60. package/dist/rules/noDefaults.cjs +19 -0
  61. package/dist/rules/noDefaults.cjs.map +1 -1
  62. package/dist/rules/noMissingSyntax.cjs +22 -2
  63. package/dist/rules/noMissingSyntax.cjs.map +1 -1
  64. package/dist/rules/noMultiAsterisks.cjs +29 -0
  65. package/dist/rules/noMultiAsterisks.cjs.map +1 -1
  66. package/dist/rules/noRestrictedSyntax.cjs +17 -1
  67. package/dist/rules/noRestrictedSyntax.cjs.map +1 -1
  68. package/dist/rules/noTypes.cjs +17 -1
  69. package/dist/rules/noTypes.cjs.map +1 -1
  70. package/dist/rules/noUndefinedTypes.cjs +11 -1
  71. package/dist/rules/noUndefinedTypes.cjs.map +1 -1
  72. package/dist/rules/requireAsteriskPrefix.cjs +28 -0
  73. package/dist/rules/requireAsteriskPrefix.cjs.map +1 -1
  74. package/dist/rules/requireDescription.cjs +30 -1
  75. package/dist/rules/requireDescription.cjs.map +1 -1
  76. package/dist/rules/requireDescriptionCompleteSentence.cjs +27 -0
  77. package/dist/rules/requireDescriptionCompleteSentence.cjs.map +1 -1
  78. package/dist/rules/requireExample.cjs +26 -1
  79. package/dist/rules/requireExample.cjs.map +1 -1
  80. package/dist/rules/requireFileOverview.cjs +61 -0
  81. package/dist/rules/requireFileOverview.cjs.map +1 -1
  82. package/dist/rules/requireHyphenBeforeParamDescription.cjs +20 -2
  83. package/dist/rules/requireHyphenBeforeParamDescription.cjs.map +1 -1
  84. package/dist/rules/requireJsdoc.cjs +82 -3
  85. package/dist/rules/requireJsdoc.cjs.map +1 -1
  86. package/dist/rules/requireParam.cjs +213 -1
  87. package/dist/rules/requireParam.cjs.map +1 -1
  88. package/dist/rules/requireParamDescription.cjs +21 -0
  89. package/dist/rules/requireParamDescription.cjs.map +1 -1
  90. package/dist/rules/requireParamName.cjs +16 -1
  91. package/dist/rules/requireParamName.cjs.map +1 -1
  92. package/dist/rules/requireParamType.cjs +21 -1
  93. package/dist/rules/requireParamType.cjs.map +1 -1
  94. package/dist/rules/requirePropertyName.cjs +1 -1
  95. package/dist/rules/requirePropertyName.cjs.map +1 -1
  96. package/dist/rules/requirePropertyType.cjs +1 -1
  97. package/dist/rules/requirePropertyType.cjs.map +1 -1
  98. package/dist/rules/requireReturns.cjs +54 -1
  99. package/dist/rules/requireReturns.cjs.map +1 -1
  100. package/dist/rules/requireReturnsCheck.cjs +22 -1
  101. package/dist/rules/requireReturnsCheck.cjs.map +1 -1
  102. package/dist/rules/requireReturnsDescription.cjs +15 -1
  103. package/dist/rules/requireReturnsDescription.cjs.map +1 -1
  104. package/dist/rules/requireReturnsType.cjs +15 -1
  105. package/dist/rules/requireReturnsType.cjs.map +1 -1
  106. package/dist/rules/requireTemplate.cjs +17 -1
  107. package/dist/rules/requireTemplate.cjs.map +1 -1
  108. package/dist/rules/requireThrows.cjs +18 -1
  109. package/dist/rules/requireThrows.cjs.map +1 -1
  110. package/dist/rules/requireYields.cjs +50 -1
  111. package/dist/rules/requireYields.cjs.map +1 -1
  112. package/dist/rules/requireYieldsCheck.cjs +25 -7
  113. package/dist/rules/requireYieldsCheck.cjs.map +1 -1
  114. package/dist/rules/sortTags.cjs +200 -1
  115. package/dist/rules/sortTags.cjs.map +1 -1
  116. package/dist/rules/tagLines.cjs +32 -2
  117. package/dist/rules/tagLines.cjs.map +1 -1
  118. package/dist/rules/textEscaping.cjs +5 -1
  119. package/dist/rules/textEscaping.cjs.map +1 -1
  120. package/dist/rules/typeFormatting.cjs +47 -10
  121. package/dist/rules/typeFormatting.cjs.map +1 -1
  122. package/dist/rules/validTypes.cjs +8 -1
  123. package/dist/rules/validTypes.cjs.map +1 -1
  124. package/dist/rules.d.ts +2130 -32
  125. package/package.json +1 -1
  126. package/src/buildForbidRuleDefinition.js +0 -1
  127. package/src/buildRejectOrPreferRuleDefinition.js +12 -2
  128. package/src/index-cjs.js +36 -0
  129. package/src/index.js +36 -0
  130. package/src/rules/checkAccess.js +1 -1
  131. package/src/rules/checkAlignment.js +3 -0
  132. package/src/rules/checkExamples.js +1 -1
  133. package/src/rules/checkIndentation.js +19 -0
  134. package/src/rules/checkLineAlignment.js +24 -0
  135. package/src/rules/checkParamNames.js +62 -1
  136. package/src/rules/checkPropertyNames.js +6 -0
  137. package/src/rules/checkTagNames.js +71 -0
  138. package/src/rules/checkTypes.js +16 -1
  139. package/src/rules/checkValues.js +16 -0
  140. package/src/rules/convertToJsdocComments.js +48 -0
  141. package/src/rules/emptyTags.js +10 -1
  142. package/src/rules/implementsOnClasses.js +15 -1
  143. package/src/rules/informativeDocs.js +45 -0
  144. package/src/rules/linesBeforeBlock.js +14 -0
  145. package/src/rules/matchDescription.js +129 -0
  146. package/src/rules/matchName.js +30 -0
  147. package/src/rules/multilineBlocks.js +77 -5
  148. package/src/rules/noBadBlocks.js +11 -2
  149. package/src/rules/noBlankBlockDescriptions.js +1 -1
  150. package/src/rules/noBlankBlocks.js +2 -0
  151. package/src/rules/noDefaults.js +19 -0
  152. package/src/rules/noMissingSyntax.js +22 -2
  153. package/src/rules/noMultiAsterisks.js +29 -0
  154. package/src/rules/noRestrictedSyntax.js +17 -1
  155. package/src/rules/noTypes.js +17 -1
  156. package/src/rules/noUndefinedTypes.js +11 -1
  157. package/src/rules/requireAsteriskPrefix.js +28 -0
  158. package/src/rules/requireDescription.js +30 -1
  159. package/src/rules/requireDescriptionCompleteSentence.js +27 -0
  160. package/src/rules/requireExample.js +26 -1
  161. package/src/rules/requireFileOverview.js +61 -0
  162. package/src/rules/requireHyphenBeforeParamDescription.js +19 -1
  163. package/src/rules/requireJsdoc.js +80 -1
  164. package/src/rules/requireParam.js +213 -1
  165. package/src/rules/requireParamDescription.js +21 -0
  166. package/src/rules/requireParamName.js +16 -1
  167. package/src/rules/requireParamType.js +21 -1
  168. package/src/rules/requirePropertyName.js +1 -1
  169. package/src/rules/requirePropertyType.js +1 -1
  170. package/src/rules/requireReturns.js +54 -1
  171. package/src/rules/requireReturnsCheck.js +22 -1
  172. package/src/rules/requireReturnsDescription.js +15 -1
  173. package/src/rules/requireReturnsType.js +15 -1
  174. package/src/rules/requireTemplate.js +17 -1
  175. package/src/rules/requireThrows.js +18 -1
  176. package/src/rules/requireYields.js +50 -1
  177. package/src/rules/requireYieldsCheck.js +25 -7
  178. package/src/rules/sortTags.js +200 -1
  179. package/src/rules/tagLines.js +30 -0
  180. package/src/rules/textEscaping.js +5 -1
  181. package/src/rules/typeFormatting.js +44 -7
  182. package/src/rules/validTypes.js +8 -1
  183. package/src/rules.d.ts +2130 -32
  184. package/typings/gitdown.d.ts +4 -0
@@ -144,7 +144,7 @@ export default iterateJsdoc(({
144
144
  contextDefaults: true,
145
145
  meta: {
146
146
  docs: {
147
- description: 'Requires that returns are documented.',
147
+ description: 'Requires that returns are documented with `@returns`.',
148
148
  url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-returns.md#repos-sticky-header',
149
149
  },
150
150
  fixable: 'code',
@@ -154,13 +154,34 @@ export default iterateJsdoc(({
154
154
  properties: {
155
155
  checkConstructors: {
156
156
  default: false,
157
+ description: `A value indicating whether \`constructor\`s should
158
+ be checked for \`@returns\` tags. Defaults to \`false\`.`,
157
159
  type: 'boolean',
158
160
  },
159
161
  checkGetters: {
160
162
  default: true,
163
+ description: `Boolean to determine whether getter methods should
164
+ be checked for \`@returns\` tags. Defaults to \`true\`.`,
161
165
  type: 'boolean',
162
166
  },
163
167
  contexts: {
168
+ description: `Set this to an array of strings representing the AST context
169
+ (or objects with optional \`context\` and \`comment\` properties) where you wish
170
+ the rule to be applied.
171
+
172
+ \`context\` defaults to \`any\` and \`comment\` defaults to no specific comment context.
173
+
174
+ Overrides the default contexts (\`ArrowFunctionExpression\`, \`FunctionDeclaration\`,
175
+ \`FunctionExpression\`). Set to \`"any"\` if you want
176
+ the rule to apply to any JSDoc block throughout your files (as is necessary
177
+ for finding function blocks not attached to a function declaration or
178
+ expression, i.e., \`@callback\` or \`@function\` (or its aliases \`@func\` or
179
+ \`@method\`) (including those associated with an \`@interface\`). This
180
+ rule will only apply on non-default contexts when there is such a tag
181
+ present and the \`forceRequireReturn\` option is set or if the
182
+ \`forceReturnsWithAsync\` option is set with a present \`@async\` tag
183
+ (since we are not checking against the actual \`return\` values in these
184
+ cases).`,
164
185
  items: {
165
186
  anyOf: [
166
187
  {
@@ -186,9 +207,16 @@ export default iterateJsdoc(({
186
207
  type: 'array',
187
208
  },
188
209
  enableFixer: {
210
+ description: `Whether to enable the fixer to add a blank \`@returns\`.
211
+ Defaults to \`false\`.`,
189
212
  type: 'boolean',
190
213
  },
191
214
  exemptedBy: {
215
+ description: `Array of tags (e.g., \`['type']\`) whose presence on the
216
+ document block avoids the need for a \`@returns\`. Defaults to an array
217
+ with \`inheritdoc\`. If you set this array, it will overwrite the default,
218
+ so be sure to add back \`inheritdoc\` if you wish its presence to cause
219
+ exemption of the rule.`,
192
220
  items: {
193
221
  type: 'string',
194
222
  },
@@ -196,13 +224,38 @@ export default iterateJsdoc(({
196
224
  },
197
225
  forceRequireReturn: {
198
226
  default: false,
227
+ description: `Set to \`true\` to always insist on
228
+ \`@returns\` documentation regardless of implicit or explicit \`return\`'s
229
+ in the function. May be desired to flag that a project is aware of an
230
+ \`undefined\`/\`void\` return. Defaults to \`false\`.`,
199
231
  type: 'boolean',
200
232
  },
201
233
  forceReturnsWithAsync: {
202
234
  default: false,
235
+ description: `By default \`async\` functions that do not explicitly
236
+ return a value pass this rule as an \`async\` function will always return a
237
+ \`Promise\`, even if the \`Promise\` resolves to void. You can force all
238
+ \`async\` functions (including ones with an explicit \`Promise\` but no
239
+ detected non-\`undefined\` \`resolve\` value) to require \`@return\`
240
+ documentation by setting \`forceReturnsWithAsync\` to \`true\` on the options
241
+ object. This may be useful for flagging that there has been consideration
242
+ of return type. Defaults to \`false\`.`,
203
243
  type: 'boolean',
204
244
  },
205
245
  publicOnly: {
246
+ description: `This option will insist that missing \`@returns\` are only reported for
247
+ function bodies / class declarations that are exported from the module.
248
+ May be a boolean or object. If set to \`true\`, the defaults below will be
249
+ used. If unset, \`@returns\` reporting will not be limited to exports.
250
+
251
+ This object supports the following optional boolean keys (\`false\` unless
252
+ otherwise noted):
253
+
254
+ - \`ancestorsOnly\` - Optimization to only check node ancestors to check if node is exported
255
+ - \`esm\` - ESM exports are checked for \`@returns\` JSDoc comments (Defaults to \`true\`)
256
+ - \`cjs\` - CommonJS exports are checked for \`@returns\` JSDoc comments (Defaults to \`true\`)
257
+ - \`window\` - Window global exports are checked for \`@returns\` JSDoc comments
258
+ `,
206
259
  oneOf: [
207
260
  {
208
261
  default: false,
@@ -117,7 +117,7 @@ export default iterateJsdoc(({
117
117
  }, {
118
118
  meta: {
119
119
  docs: {
120
- description: 'Requires a return statement in function body if a `@returns` tag is specified in jsdoc comment.',
120
+ description: 'Requires a return statement in function body if a `@returns` tag is specified in JSDoc comment(and reports if multiple `@returns` tags are present).',
121
121
  url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-returns-check.md#repos-sticky-header',
122
122
  },
123
123
  schema: [
@@ -126,13 +126,34 @@ export default iterateJsdoc(({
126
126
  properties: {
127
127
  exemptAsync: {
128
128
  default: true,
129
+ description: `By default, functions which return a \`Promise\` that are not
130
+ detected as resolving with a non-\`undefined\` value and \`async\` functions
131
+ (even ones that do not explicitly return a value, as these are returning a
132
+ \`Promise\` implicitly) will be exempted from reporting by this rule.
133
+ If you wish to insist that only \`Promise\`'s which resolve to
134
+ non-\`undefined\` values or \`async\` functions with explicit \`return\`'s will
135
+ be exempted from reporting (i.e., that \`async\` functions can be reported
136
+ if they lack an explicit (non-\`undefined\`) \`return\` when a \`@returns\` is
137
+ present), you can set \`exemptAsync\` to \`false\` on the options object.`,
129
138
  type: 'boolean',
130
139
  },
131
140
  exemptGenerators: {
141
+ description: `Because a generator might be labeled as having a
142
+ \`IterableIterator\` \`@returns\` value (along with an iterator type
143
+ corresponding to the type of any \`yield\` statements), projects might wish to
144
+ leverage \`@returns\` in generators even without a \`return\` statement. This
145
+ option is therefore \`true\` by default in \`typescript\` mode (in "jsdoc" mode,
146
+ one might be more likely to take advantage of \`@yields\`). Set it to \`false\`
147
+ if you wish for a missing \`return\` to be flagged regardless.`,
132
148
  type: 'boolean',
133
149
  },
134
150
  reportMissingReturnForUndefinedTypes: {
135
151
  default: false,
152
+ description: `If \`true\` and no return or
153
+ resolve value is found, this setting will even insist that reporting occur
154
+ with \`void\` or \`undefined\` (including as an indicated \`Promise\` type).
155
+ Unlike \`require-returns\`, with this option in the rule, one can
156
+ *discourage* the labeling of \`undefined\` types. Defaults to \`false\`.`,
136
157
  type: 'boolean',
137
158
  },
138
159
  },
@@ -21,7 +21,7 @@ export default iterateJsdoc(({
21
21
  contextDefaults: true,
22
22
  meta: {
23
23
  docs: {
24
- description: 'Requires that the `@returns` tag has a `description` value.',
24
+ description: 'Requires that the `@returns` tag has a `description` value (not including `void`/`undefined` type returns).',
25
25
  url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-returns-description.md#repos-sticky-header',
26
26
  },
27
27
  schema: [
@@ -29,6 +29,20 @@ export default iterateJsdoc(({
29
29
  additionalProperties: false,
30
30
  properties: {
31
31
  contexts: {
32
+ description: `Set this to an array of strings representing the AST context (or an object with
33
+ optional \`context\` and \`comment\` properties) where you wish the rule to be applied.
34
+
35
+ \`context\` defaults to \`any\` and \`comment\` defaults to no specific comment context.
36
+
37
+ Overrides the default contexts (\`ArrowFunctionExpression\`, \`FunctionDeclaration\`,
38
+ \`FunctionExpression\`). Set to \`"any"\` if you want
39
+ the rule to apply to any JSDoc block throughout your files (as is necessary
40
+ for finding function blocks not attached to a function declaration or
41
+ expression, i.e., \`@callback\` or \`@function\` (or its aliases \`@func\` or
42
+ \`@method\`) (including those associated with an \`@interface\`).
43
+
44
+ See the ["AST and Selectors"](../#advanced-ast-and-selectors)
45
+ section of our Advanced docs for more on the expected format.`,
32
46
  items: {
33
47
  anyOf: [
34
48
  {
@@ -13,7 +13,7 @@ export default iterateJsdoc(({
13
13
  contextDefaults: true,
14
14
  meta: {
15
15
  docs: {
16
- description: 'Requires that `@returns` tag has `type` value.',
16
+ description: 'Requires that `@returns` tag has type value (in curly brackets).',
17
17
  url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-returns-type.md#repos-sticky-header',
18
18
  },
19
19
  schema: [
@@ -21,6 +21,20 @@ export default iterateJsdoc(({
21
21
  additionalProperties: false,
22
22
  properties: {
23
23
  contexts: {
24
+ description: `Set this to an array of strings representing the AST context (or an object with
25
+ optional \`context\` and \`comment\` properties) where you wish the rule to be applied.
26
+
27
+ \`context\` defaults to \`any\` and \`comment\` defaults to no specific comment context.
28
+
29
+ Overrides the default contexts (\`ArrowFunctionExpression\`, \`FunctionDeclaration\`,
30
+ \`FunctionExpression\`). Set to \`"any"\` if you want
31
+ the rule to apply to any JSDoc block throughout your files (as is necessary
32
+ for finding function blocks not attached to a function declaration or
33
+ expression, i.e., \`@callback\` or \`@function\` (or its aliases \`@func\` or
34
+ \`@method\`) (including those associated with an \`@interface\`).
35
+
36
+ See the ["AST and Selectors"](../#advanced-ast-and-selectors)
37
+ section of our Advanced docs for more on the expected format.`,
24
38
  items: {
25
39
  anyOf: [
26
40
  {
@@ -186,7 +186,7 @@ export default iterateJsdoc(({
186
186
  iterateAllJsdocs: true,
187
187
  meta: {
188
188
  docs: {
189
- description: 'Requires template tags for each generic type parameter',
189
+ description: 'Requires `@template` tags be present when type parameters are used.',
190
190
  url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-template.md#repos-sticky-header',
191
191
  },
192
192
  schema: [
@@ -194,12 +194,28 @@ export default iterateJsdoc(({
194
194
  additionalProperties: false,
195
195
  properties: {
196
196
  exemptedBy: {
197
+ description: `Array of tags (e.g., \`['type']\`) whose presence on the document
198
+ block avoids the need for a \`@template\`. Defaults to an array with
199
+ \`inheritdoc\`. If you set this array, it will overwrite the default,
200
+ so be sure to add back \`inheritdoc\` if you wish its presence to cause
201
+ exemption of the rule.`,
197
202
  items: {
198
203
  type: 'string',
199
204
  },
200
205
  type: 'array',
201
206
  },
202
207
  requireSeparateTemplates: {
208
+ description: `Requires that each template have its own separate line, i.e., preventing
209
+ templates of this format:
210
+
211
+ \`\`\`js
212
+ /**
213
+ * @template T, U, V
214
+ */
215
+ \`\`\`
216
+
217
+ Defaults to \`false\`.
218
+ `,
203
219
  type: 'boolean',
204
220
  },
205
221
  },
@@ -67,7 +67,7 @@ export default iterateJsdoc(({
67
67
  contextDefaults: true,
68
68
  meta: {
69
69
  docs: {
70
- description: 'Requires that throw statements are documented.',
70
+ description: 'Requires that throw statements are documented with `@throws` tags.',
71
71
  url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-throws.md#repos-sticky-header',
72
72
  },
73
73
  schema: [
@@ -75,6 +75,18 @@ export default iterateJsdoc(({
75
75
  additionalProperties: false,
76
76
  properties: {
77
77
  contexts: {
78
+ description: `Set this to an array of strings representing the AST context
79
+ (or objects with optional \`context\` and \`comment\` properties) where you wish
80
+ the rule to be applied.
81
+
82
+ \`context\` defaults to \`any\` and \`comment\` defaults to no specific comment context.
83
+
84
+ Overrides the default contexts (\`ArrowFunctionExpression\`, \`FunctionDeclaration\`,
85
+ \`FunctionExpression\`). Set to \`"any"\` if you want
86
+ the rule to apply to any JSDoc block throughout your files (as is necessary
87
+ for finding function blocks not attached to a function declaration or
88
+ expression, i.e., \`@callback\` or \`@function\` (or its aliases \`@func\` or
89
+ \`@method\`) (including those associated with an \`@interface\`).`,
78
90
  items: {
79
91
  anyOf: [
80
92
  {
@@ -97,6 +109,11 @@ export default iterateJsdoc(({
97
109
  type: 'array',
98
110
  },
99
111
  exemptedBy: {
112
+ description: `Array of tags (e.g., \`['type']\`) whose presence on the
113
+ document block avoids the need for a \`@throws\`. Defaults to an array
114
+ with \`inheritdoc\`. If you set this array, it will overwrite the default,
115
+ so be sure to add back \`inheritdoc\` if you wish its presence to cause
116
+ exemption of the rule.`,
100
117
  items: {
101
118
  type: 'string',
102
119
  },
@@ -152,7 +152,7 @@ export default iterateJsdoc(({
152
152
  contextDefaults: true,
153
153
  meta: {
154
154
  docs: {
155
- description: 'Requires yields are documented.',
155
+ description: 'Requires yields are documented with `@yields` tags.',
156
156
  url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-yields.md#repos-sticky-header',
157
157
  },
158
158
  schema: [
@@ -160,6 +160,23 @@ export default iterateJsdoc(({
160
160
  additionalProperties: false,
161
161
  properties: {
162
162
  contexts: {
163
+ description: `Set this to an array of strings representing the AST context
164
+ (or objects with optional \`context\` and \`comment\` properties) where you wish
165
+ the rule to be applied.
166
+
167
+ \`context\` defaults to \`any\` and \`comment\` defaults to no specific comment context.
168
+
169
+ Overrides the default contexts (\`ArrowFunctionExpression\`, \`FunctionDeclaration\`,
170
+ \`FunctionExpression\`). Set to \`"any"\` if you want
171
+ the rule to apply to any JSDoc block throughout your files (as is necessary
172
+ for finding function blocks not attached to a function declaration or
173
+ expression, i.e., \`@callback\` or \`@function\` (or its aliases \`@func\` or
174
+ \`@method\`) (including those associated with an \`@interface\`). This
175
+ rule will only apply on non-default contexts when there is such a tag
176
+ present and the \`forceRequireYields\` option is set or if the
177
+ \`withGeneratorTag\` option is set with a present \`@generator\` tag
178
+ (since we are not checking against the actual \`yield\` values in these
179
+ cases).`,
163
180
  items: {
164
181
  anyOf: [
165
182
  {
@@ -182,6 +199,11 @@ export default iterateJsdoc(({
182
199
  type: 'array',
183
200
  },
184
201
  exemptedBy: {
202
+ description: `Array of tags (e.g., \`['type']\`) whose presence on the
203
+ document block avoids the need for a \`@yields\`. Defaults to an array
204
+ with \`inheritdoc\`. If you set this array, it will overwrite the default,
205
+ so be sure to add back \`inheritdoc\` if you wish its presence to cause
206
+ exemption of the rule.`,
185
207
  items: {
186
208
  type: 'string',
187
209
  },
@@ -189,22 +211,49 @@ export default iterateJsdoc(({
189
211
  },
190
212
  forceRequireNext: {
191
213
  default: false,
214
+ description: `Set to \`true\` to always insist on
215
+ \`@next\` documentation even if there are no \`yield\` statements in the
216
+ function or none return values. May be desired to flag that a project is
217
+ aware of the expected yield return being \`undefined\`. Defaults to \`false\`.`,
192
218
  type: 'boolean',
193
219
  },
194
220
  forceRequireYields: {
195
221
  default: false,
222
+ description: `Set to \`true\` to always insist on
223
+ \`@yields\` documentation for generators even if there are only
224
+ expressionless \`yield\` statements in the function. May be desired to flag
225
+ that a project is aware of an \`undefined\`/\`void\` yield. Defaults to
226
+ \`false\`.`,
196
227
  type: 'boolean',
197
228
  },
198
229
  next: {
199
230
  default: false,
231
+ description: `If \`true\`, this option will insist that any use of a \`yield\` return
232
+ value (e.g., \`const rv = yield;\` or \`const rv = yield value;\`) has a
233
+ (non-standard) \`@next\` tag (in addition to any \`@yields\` tag) so as to be
234
+ able to document the type expected to be supplied into the iterator
235
+ (the \`Generator\` iterator that is returned by the call to the generator
236
+ function) to the iterator (e.g., \`it.next(value)\`). The tag will not be
237
+ expected if the generator function body merely has plain \`yield;\` or
238
+ \`yield value;\` statements without returning the values. Defaults to
239
+ \`false\`.`,
200
240
  type: 'boolean',
201
241
  },
202
242
  nextWithGeneratorTag: {
203
243
  default: false,
244
+ description: `If a \`@generator\` tag is present on a block, require
245
+ (non-standard ) \`@next\` (see \`next\` option). This will require using \`void\`
246
+ or \`undefined\` in cases where generators do not use the \`next()\`-supplied
247
+ incoming \`yield\`-returned value. Defaults to \`false\`. See \`contexts\` to
248
+ \`any\` if you want to catch \`@generator\` with \`@callback\` or such not
249
+ attached to a function.`,
204
250
  type: 'boolean',
205
251
  },
206
252
  withGeneratorTag: {
207
253
  default: true,
254
+ description: `If a \`@generator\` tag is present on a block, require
255
+ \`@yields\`/\`@yield\`. Defaults to \`true\`. See \`contexts\` to \`any\` if you want
256
+ to catch \`@generator\` with \`@callback\` or such not attached to a function.`,
208
257
  type: 'boolean',
209
258
  },
210
259
  },
@@ -156,7 +156,7 @@ export default iterateJsdoc(({
156
156
  }, {
157
157
  meta: {
158
158
  docs: {
159
- description: 'Requires a yield statement in function body if a `@yields` tag is specified in jsdoc comment.',
159
+ 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).',
160
160
  url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-yields-check.md#repos-sticky-header',
161
161
  },
162
162
  schema: [
@@ -165,9 +165,22 @@ export default iterateJsdoc(({
165
165
  properties: {
166
166
  checkGeneratorsOnly: {
167
167
  default: false,
168
+ description: `Avoids checking the function body and merely insists
169
+ that all generators have \`@yields\`. This can be an optimization with the
170
+ ESLint \`require-yield\` rule, as that rule already ensures a \`yield\` is
171
+ present in generators, albeit assuming the generator is not empty).
172
+ Defaults to \`false\`.`,
168
173
  type: 'boolean',
169
174
  },
170
175
  contexts: {
176
+ description: `Set this to an array of strings representing the AST context
177
+ (or objects with optional \`context\` and \`comment\` properties) where you wish
178
+ the rule to be applied.
179
+
180
+ \`context\` defaults to \`any\` and \`comment\` defaults to no specific comment context.
181
+
182
+ Overrides the default contexts (\`ArrowFunctionExpression\`, \`FunctionDeclaration\`,
183
+ \`FunctionExpression\`).`,
171
184
  items: {
172
185
  anyOf: [
173
186
  {
@@ -189,14 +202,19 @@ export default iterateJsdoc(({
189
202
  },
190
203
  type: 'array',
191
204
  },
192
- exemptedBy: {
193
- items: {
194
- type: 'string',
195
- },
196
- type: 'array',
197
- },
198
205
  next: {
199
206
  default: false,
207
+ description: `If \`true\`, this option will insist that any use of a (non-standard)
208
+ \`@next\` tag (in addition to any \`@yields\` tag) will be matched by a \`yield\`
209
+ which uses a return value in the body of the generator (e.g.,
210
+ \`const rv = yield;\` or \`const rv = yield value;\`). This (non-standard)
211
+ tag is intended to be used to indicate a type and/or description of
212
+ the value expected to be supplied by the user when supplied to the iterator
213
+ by its \`next\` method, as with \`it.next(value)\` (with the iterator being
214
+ the \`Generator\` iterator that is returned by the call to the generator
215
+ function). This option will report an error if the generator function body
216
+ merely has plain \`yield;\` or \`yield value;\` statements without returning
217
+ the values. Defaults to \`false\`.`,
200
218
  type: 'boolean',
201
219
  },
202
220
  },
@@ -512,7 +512,7 @@ export default iterateJsdoc(({
512
512
  iterateAllJsdocs: true,
513
513
  meta: {
514
514
  docs: {
515
- description: 'Sorts tags by a specified sequence according to tag name.',
515
+ description: 'Sorts tags by a specified sequence according to tag name, optionally adding line breaks between tag groups.',
516
516
  url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/sort-tags.md#repos-sticky-header',
517
517
  },
518
518
  fixable: 'code',
@@ -521,22 +521,221 @@ export default iterateJsdoc(({
521
521
  additionalProperties: false,
522
522
  properties: {
523
523
  alphabetizeExtras: {
524
+ description: `Defaults to \`false\`. Alphabetizes any items not within \`tagSequence\` after any
525
+ items within \`tagSequence\` (or in place of the special \`-other\` pseudo-tag)
526
+ are sorted.
527
+
528
+ If you want all your tags alphabetized, you can supply an empty array for
529
+ \`tagSequence\` along with setting this option to \`true\`.`,
524
530
  type: 'boolean',
525
531
  },
526
532
  linesBetween: {
533
+ description: `Indicates the number of lines to be added between tag groups. Defaults to 1.
534
+ Do not set to 0 or 2+ if you are using \`tag-lines\` and \`"always"\` and do not
535
+ set to 1+ if you are using \`tag-lines\` and \`"never"\`.`,
527
536
  type: 'integer',
528
537
  },
529
538
  reportIntraTagGroupSpacing: {
539
+ description: `Whether to enable reporting and fixing of line breaks within tags of a given
540
+ tag group. Defaults to \`true\` which will remove any line breaks at the end of
541
+ such tags. Do not use with \`true\` if you are using \`tag-lines\` and \`always\`.`,
530
542
  type: 'boolean',
531
543
  },
532
544
  reportTagGroupSpacing: {
545
+ description: `Whether to enable reporting and fixing of line breaks between tag groups
546
+ as set by \`linesBetween\`. Defaults to \`true\`. Note that the very last tag
547
+ will not have spacing applied regardless. For adding line breaks there, you
548
+ may wish to use the \`endLines\` option of the \`tag-lines\` rule.`,
533
549
  type: 'boolean',
534
550
  },
535
551
  tagSequence: {
552
+ description: `An array of tag group objects indicating the preferred sequence for sorting tags.
553
+
554
+ Each item in the array should be an object with a \`tags\` property set to an array
555
+ of tag names.
556
+
557
+ Tag names earlier in the list will be arranged first. The relative position of
558
+ tags of the same name will not be changed.
559
+
560
+ Earlier groups will also be arranged before later groups, but with the added
561
+ feature that additional line breaks may be added between (or before or after)
562
+ such groups (depending on the setting of \`linesBetween\`).
563
+
564
+ Tag names not in the list will be grouped together at the end. The pseudo-tag
565
+ \`-other\` can be used to place them anywhere else if desired. The tags will be
566
+ placed in their order of appearance, or alphabetized if \`alphabetizeExtras\`
567
+ is enabled, see more below about that option.
568
+
569
+ Defaults to the array below (noting that it is just a single tag group with
570
+ no lines between groups by default).
571
+
572
+ Please note that this order is still experimental, so if you want to retain
573
+ a fixed order that doesn't change into the future, supply your own
574
+ \`tagSequence\`.
575
+
576
+ \`\`\`js
577
+ [{tags: [
578
+ // Brief descriptions
579
+ 'summary',
580
+ 'typeSummary',
581
+
582
+ // Module/file-level
583
+ 'module',
584
+ 'exports',
585
+ 'file',
586
+ 'fileoverview',
587
+ 'overview',
588
+ 'import',
589
+
590
+ // Identifying (name, type)
591
+ 'typedef',
592
+ 'interface',
593
+ 'record',
594
+ 'template',
595
+ 'name',
596
+ 'kind',
597
+ 'type',
598
+ 'alias',
599
+ 'external',
600
+ 'host',
601
+ 'callback',
602
+ 'func',
603
+ 'function',
604
+ 'method',
605
+ 'class',
606
+ 'constructor',
607
+
608
+ // Relationships
609
+ 'modifies',
610
+ 'mixes',
611
+ 'mixin',
612
+ 'mixinClass',
613
+ 'mixinFunction',
614
+ 'namespace',
615
+ 'borrows',
616
+ 'constructs',
617
+ 'lends',
618
+ 'implements',
619
+ 'requires',
620
+
621
+ // Long descriptions
622
+ 'desc',
623
+ 'description',
624
+ 'classdesc',
625
+ 'tutorial',
626
+ 'copyright',
627
+ 'license',
628
+
629
+ // Simple annotations
630
+ 'const',
631
+ 'constant',
632
+ 'final',
633
+ 'global',
634
+ 'readonly',
635
+ 'abstract',
636
+ 'virtual',
637
+ 'var',
638
+ 'member',
639
+ 'memberof',
640
+ 'memberof!',
641
+ 'inner',
642
+ 'instance',
643
+ 'inheritdoc',
644
+ 'inheritDoc',
645
+ 'override',
646
+ 'hideconstructor',
647
+
648
+ // Core function/object info
649
+ 'param',
650
+ 'arg',
651
+ 'argument',
652
+ 'prop',
653
+ 'property',
654
+ 'return',
655
+ 'returns',
656
+
657
+ // Important behavior details
658
+ 'async',
659
+ 'generator',
660
+ 'default',
661
+ 'defaultvalue',
662
+ 'enum',
663
+ 'augments',
664
+ 'extends',
665
+ 'throws',
666
+ 'exception',
667
+ 'yield',
668
+ 'yields',
669
+ 'event',
670
+ 'fires',
671
+ 'emits',
672
+ 'listens',
673
+ 'this',
674
+
675
+ // Access
676
+ 'static',
677
+ 'private',
678
+ 'protected',
679
+ 'public',
680
+ 'access',
681
+ 'package',
682
+
683
+ '-other',
684
+
685
+ // Supplementary descriptions
686
+ 'see',
687
+ 'example',
688
+
689
+ // METADATA
690
+
691
+ // Other Closure (undocumented) metadata
692
+ 'closurePrimitive',
693
+ 'customElement',
694
+ 'expose',
695
+ 'hidden',
696
+ 'idGenerator',
697
+ 'meaning',
698
+ 'ngInject',
699
+ 'owner',
700
+ 'wizaction',
701
+
702
+ // Other Closure (documented) metadata
703
+ 'define',
704
+ 'dict',
705
+ 'export',
706
+ 'externs',
707
+ 'implicitCast',
708
+ 'noalias',
709
+ 'nocollapse',
710
+ 'nocompile',
711
+ 'noinline',
712
+ 'nosideeffects',
713
+ 'polymer',
714
+ 'polymerBehavior',
715
+ 'preserve',
716
+ 'struct',
717
+ 'suppress',
718
+ 'unrestricted',
719
+
720
+ // @homer0/prettier-plugin-jsdoc metadata
721
+ 'category',
722
+
723
+ // Non-Closure metadata
724
+ 'ignore',
725
+ 'author',
726
+ 'version',
727
+ 'variation',
728
+ 'since',
729
+ 'deprecated',
730
+ 'todo',
731
+ ]}];
732
+ \`\`\`
733
+ `,
536
734
  items: {
537
735
  additionalProperties: false,
538
736
  properties: {
539
737
  tags: {
738
+ description: 'See description on `tagSequence`.',
540
739
  items: {
541
740
  type: 'string',
542
741
  },