eslint-plugin-jsdoc 58.1.0 → 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 -60
  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 +64 -16
  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 +57 -19
  182. package/src/rules/validTypes.js +8 -1
  183. package/src/rules.d.ts +2130 -32
  184. package/typings/gitdown.d.ts +4 -0
@@ -303,12 +303,24 @@ export default {
303
303
  additionalProperties: false,
304
304
  properties: {
305
305
  allowedPrefixes: {
306
+ description: `An array of prefixes to allow at the beginning of a comment.
307
+
308
+ Defaults to \`['@ts-', 'istanbul ', 'c8 ', 'v8 ', 'eslint', 'prettier-']\`.
309
+
310
+ Supplying your own value overrides the defaults.`,
306
311
  items: {
307
312
  type: 'string',
308
313
  },
309
314
  type: 'array',
310
315
  },
311
316
  contexts: {
317
+ description: `The contexts array which will be checked for preceding content.
318
+
319
+ Can either be strings or an object with a \`context\` string and an optional, default \`false\` \`inlineCommentBlock\` boolean.
320
+
321
+ Defaults to \`ArrowFunctionExpression\`, \`FunctionDeclaration\`,
322
+ \`FunctionExpression\`, \`TSDeclareFunction\`.
323
+ `,
312
324
  items: {
313
325
  anyOf: [
314
326
  {
@@ -331,6 +343,11 @@ export default {
331
343
  type: 'array',
332
344
  },
333
345
  contextsAfter: {
346
+ description: `The contexts array which will be checked for content on the same line after.
347
+
348
+ Can either be strings or an object with a \`context\` string and an optional, default \`false\` \`inlineCommentBlock\` boolean.
349
+
350
+ Defaults to an empty array.`,
334
351
  items: {
335
352
  anyOf: [
336
353
  {
@@ -353,6 +370,12 @@ export default {
353
370
  type: 'array',
354
371
  },
355
372
  contextsBeforeAndAfter: {
373
+ description: `The contexts array which will be checked for content before and on the same
374
+ line after.
375
+
376
+ Can either be strings or an object with a \`context\` string and an optional, default \`false\` \`inlineCommentBlock\` boolean.
377
+
378
+ Defaults to \`VariableDeclarator\`, \`TSPropertySignature\`, \`PropertyDefinition\`.`,
356
379
  items: {
357
380
  anyOf: [
358
381
  {
@@ -375,15 +398,40 @@ export default {
375
398
  type: 'array',
376
399
  },
377
400
  enableFixer: {
401
+ description: 'Set to `false` to disable fixing.',
378
402
  type: 'boolean',
379
403
  },
380
404
  enforceJsdocLineStyle: {
405
+ description: `What policy to enforce on the conversion of non-JSDoc comments without
406
+ line breaks. (Non-JSDoc (mulitline) comments with line breaks will always
407
+ be converted to \`multi\` style JSDoc comments.)
408
+
409
+ - \`multi\` - Convert to multi-line style
410
+ \`\`\`js
411
+ /**
412
+ * Some text
413
+ */
414
+ \`\`\`
415
+ - \`single\` - Convert to single-line style
416
+ \`\`\`js
417
+ /** Some text */
418
+ \`\`\`
419
+
420
+ Defaults to \`multi\`.
421
+ `,
381
422
  enum: [
382
423
  'multi', 'single',
383
424
  ],
384
425
  type: 'string',
385
426
  },
386
427
  lineOrBlockStyle: {
428
+ description: `What style of comments to which to apply JSDoc conversion.
429
+
430
+ - \`block\` - Applies to block-style comments (\`/* ... */\`)
431
+ - \`line\` - Applies to line-style comments (\`// ...\`)
432
+ - \`both\` - Applies to both block and line-style comments
433
+
434
+ Defaults to \`both\`.`,
387
435
  enum: [
388
436
  'block', 'line', 'both',
389
437
  ],
@@ -75,7 +75,7 @@ export default iterateJsdoc(({
75
75
  iterateAllJsdocs: true,
76
76
  meta: {
77
77
  docs: {
78
- description: 'Expects specific tags to be empty of any content.',
78
+ description: 'Checks tags that are expected to be empty (e.g., `@abstract` or `@async`), reporting if they have content',
79
79
  url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/empty-tags.md#repos-sticky-header',
80
80
  },
81
81
  fixable: 'code',
@@ -84,6 +84,15 @@ export default iterateJsdoc(({
84
84
  additionalProperties: false,
85
85
  properties: {
86
86
  tags: {
87
+ description: `If you want additional tags to be checked for their descriptions, you may
88
+ add them within this option.
89
+
90
+ \`\`\`js
91
+ {
92
+ 'jsdoc/empty-tags': ['error', {tags: ['event']}]
93
+ }
94
+ \`\`\`
95
+ `,
87
96
  items: {
88
97
  type: 'string',
89
98
  },
@@ -26,7 +26,7 @@ export default iterateJsdoc(({
26
26
  contextDefaults: true,
27
27
  meta: {
28
28
  docs: {
29
- description: 'Reports an issue with any non-constructor function using `@implements`.',
29
+ description: 'Prohibits use of `@implements` on non-constructor functions (to enforce the tag only being used on classes/constructors).',
30
30
  url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/implements-on-classes.md#repos-sticky-header',
31
31
  },
32
32
  schema: [
@@ -34,6 +34,20 @@ export default iterateJsdoc(({
34
34
  additionalProperties: false,
35
35
  properties: {
36
36
  contexts: {
37
+ description: `Set this to an array of strings representing the AST context (or an object with
38
+ \`context\` and \`comment\` properties) where you wish the rule to be applied.
39
+
40
+ \`context\` defaults to \`any\` and \`comment\` defaults to no specific comment context.
41
+
42
+ Overrides the default contexts (\`ArrowFunctionExpression\`, \`FunctionDeclaration\`,
43
+ \`FunctionExpression\`). Set to \`"any"\` if you want
44
+ the rule to apply to any JSDoc block throughout your files (as is necessary
45
+ for finding function blocks not attached to a function declaration or
46
+ expression, i.e., \`@callback\` or \`@function\` (or its aliases \`@func\` or
47
+ \`@method\`) (including those associated with an \`@interface\`).
48
+
49
+ See the ["AST and Selectors"](../#advanced-ast-and-selectors)
50
+ section of our Advanced docs for more on the expected format.`,
37
51
  items: {
38
52
  anyOf: [
39
53
  {
@@ -156,6 +156,23 @@ export default iterateJsdoc(({
156
156
  additionalProperties: false,
157
157
  properties: {
158
158
  aliases: {
159
+ description: `The \`aliases\` option allows indicating words as synonyms (aliases) of each other.
160
+
161
+ For example, with \`{ aliases: { emoji: ["smiley", "winkey"] } }\`, the following comment would be considered uninformative:
162
+
163
+ \`\`\`js
164
+ /** A smiley/winkey. */
165
+ let emoji;
166
+ \`\`\`
167
+
168
+ The default \`aliases\` option is:
169
+
170
+ \`\`\`json
171
+ {
172
+ "a": ["an", "our"]
173
+ }
174
+ \`\`\`
175
+ `,
159
176
  patternProperties: {
160
177
  '.*': {
161
178
  items: {
@@ -166,12 +183,40 @@ export default iterateJsdoc(({
166
183
  },
167
184
  },
168
185
  excludedTags: {
186
+ description: `Tags that should not be checked for valid contents.
187
+
188
+ For example, with \`{ excludedTags: ["category"] }\`, the following comment would not be considered uninformative:
189
+
190
+ \`\`\`js
191
+ /** @category Types */
192
+ function computeTypes(node) {
193
+ // ...
194
+ }
195
+ \`\`\`
196
+
197
+ No tags are excluded by default.
198
+ `,
169
199
  items: {
170
200
  type: 'string',
171
201
  },
172
202
  type: 'array',
173
203
  },
174
204
  uselessWords: {
205
+ description: `Words that are ignored when searching for one that adds meaning.
206
+
207
+ For example, with \`{ uselessWords: ["our"] }\`, the following comment would be considered uninformative:
208
+
209
+ \`\`\`js
210
+ /** Our text. */
211
+ let text;
212
+ \`\`\`
213
+
214
+ The default \`uselessWords\` option is:
215
+
216
+ \`\`\`json
217
+ ["a", "an", "i", "in", "of", "s", "the"]
218
+ \`\`\`
219
+ `,
175
220
  items: {
176
221
  type: 'string',
177
222
  },
@@ -108,21 +108,35 @@ export default iterateJsdoc(({
108
108
  additionalProperties: false,
109
109
  properties: {
110
110
  checkBlockStarts: {
111
+ description: `Whether to additionally check the start of blocks, such as classes or functions.
112
+ Defaults to \`false\`.
113
+ `,
111
114
  type: 'boolean',
112
115
  },
113
116
  excludedTags: {
117
+ description: `An array of tags whose presence in the JSDoc block will prevent the
118
+ application of the rule. Defaults to \`['type']\` (i.e., if \`@type\` is present,
119
+ lines before the block will not be added).
120
+ `,
114
121
  items: {
115
122
  type: 'string',
116
123
  },
117
124
  type: 'array',
118
125
  },
119
126
  ignoreSameLine: {
127
+ description: `This option excludes cases where the JSDoc block occurs on the same line as a
128
+ preceding code or comment. Defaults to \`true\`.
129
+ `,
120
130
  type: 'boolean',
121
131
  },
122
132
  ignoreSingleLines: {
133
+ description: `This option excludes cases where the JSDoc block is only one line long.
134
+ Defaults to \`true\`.
135
+ `,
123
136
  type: 'boolean',
124
137
  },
125
138
  lines: {
139
+ description: 'The minimum number of lines to require. Defaults to 1.',
126
140
  type: 'integer',
127
141
  },
128
142
  },
@@ -173,6 +173,19 @@ export default iterateJsdoc(({
173
173
  additionalProperties: false,
174
174
  properties: {
175
175
  contexts: {
176
+ description: `Set this to an array of strings representing the AST context (or an object with
177
+ optional \`context\` and \`comment\` properties) where you wish the rule to be applied (e.g.,
178
+ \`ClassDeclaration\` for ES6 classes).
179
+
180
+ \`context\` defaults to \`any\` and \`comment\` defaults to no specific comment context.
181
+
182
+ Overrides the default contexts (\`ArrowFunctionExpression\`, \`FunctionDeclaration\`,
183
+ \`FunctionExpression\`). Set to \`"any"\` if you want the rule to apply to any
184
+ JSDoc block throughout your files.
185
+
186
+ See the ["AST and Selectors"](../#advanced-ast-and-selectors)
187
+ section of our Advanced docs for more on the expected format.
188
+ `,
176
189
  items: {
177
190
  anyOf: [
178
191
  {
@@ -195,6 +208,42 @@ export default iterateJsdoc(({
195
208
  type: 'array',
196
209
  },
197
210
  mainDescription: {
211
+ description: `If you wish to override the main block description without changing the
212
+ default \`match-description\` (which can cascade to the \`tags\` with \`true\`),
213
+ you may use \`mainDescription\`:
214
+
215
+ \`\`\`js
216
+ {
217
+ 'jsdoc/match-description': ['error', {
218
+ mainDescription: '[A-Z].*\\\\.',
219
+ tags: {
220
+ param: true,
221
+ returns: true
222
+ }
223
+ }]
224
+ }
225
+ \`\`\`
226
+
227
+ There is no need to add \`mainDescription: true\`, as by default, the main
228
+ block description (and only the main block description) is linted, though you
229
+ may disable checking it by setting it to \`false\`.
230
+
231
+ You may also provide an object with \`message\`:
232
+
233
+ \`\`\`js
234
+ {
235
+ 'jsdoc/match-description': ['error', {
236
+ mainDescription: {
237
+ message: 'Capitalize first word of JSDoc block descriptions',
238
+ match: '[A-Z].*\\\\.'
239
+ },
240
+ tags: {
241
+ param: true,
242
+ returns: true
243
+ }
244
+ }]
245
+ }
246
+ \`\`\``,
198
247
  oneOf: [
199
248
  {
200
249
  format: 'regex',
@@ -226,16 +275,96 @@ export default iterateJsdoc(({
226
275
  ],
227
276
  },
228
277
  matchDescription: {
278
+ description: `You can supply your own expression to override the default, passing a
279
+ \`matchDescription\` string on the options object.
280
+
281
+ Defaults to using (only) the \`v\` flag, so
282
+ to add your own flags, encapsulate your expression as a string, but like a
283
+ literal, e.g., \`/[A-Z].*\\./vi\`.
284
+
285
+ \`\`\`js
286
+ {
287
+ 'jsdoc/match-description': ['error', {matchDescription: '[A-Z].*\\\\.'}]
288
+ }
289
+ \`\`\``,
229
290
  format: 'regex',
230
291
  type: 'string',
231
292
  },
232
293
  message: {
294
+ description: `You may provide a custom default message by using the following format:
295
+
296
+ \`\`\`js
297
+ {
298
+ 'jsdoc/match-description': ['error', {
299
+ message: 'The default description should begin with a capital letter.'
300
+ }]
301
+ }
302
+ \`\`\`
303
+
304
+ This can be overridden per tag or for the main block description by setting
305
+ \`message\` within \`tags\` or \`mainDescription\`, respectively.
306
+ `,
233
307
  type: 'string',
234
308
  },
235
309
  nonemptyTags: {
310
+ description: `If not set to \`false\`, will enforce that the following tags have at least
311
+ some content:
312
+
313
+ - \`@copyright\`
314
+ - \`@example\`
315
+ - \`@see\`
316
+ - \`@todo\`
317
+
318
+ If you supply your own tag description for any of the above tags in \`tags\`,
319
+ your description will take precedence.`,
236
320
  type: 'boolean',
237
321
  },
238
322
  tags: {
323
+ description: `If you want different regular expressions to apply to tags, you may use
324
+ the \`tags\` option object:
325
+
326
+ \`\`\`js
327
+ {
328
+ 'jsdoc/match-description': ['error', {tags: {
329
+ param: '\\\\- [A-Z].*\\\\.',
330
+ returns: '[A-Z].*\\\\.'
331
+ }}]
332
+ }
333
+ \`\`\`
334
+
335
+ In place of a string, you can also add \`true\` to indicate that a particular
336
+ tag should be linted with the \`matchDescription\` value (or the default).
337
+
338
+ \`\`\`js
339
+ {
340
+ 'jsdoc/match-description': ['error', {tags: {
341
+ param: true,
342
+ returns: true
343
+ }}]
344
+ }
345
+ \`\`\`
346
+
347
+ Alternatively, you may supply an object with a \`message\` property to indicate
348
+ the error message for that tag.
349
+
350
+ \`\`\`js
351
+ {
352
+ 'jsdoc/match-description': ['error', {tags: {
353
+ param: {message: 'Begin with a hyphen', match: '\\\\- [A-Z].*\\\\.'},
354
+ returns: {message: 'Capitalize for returns (the default)', match: true}
355
+ }}]
356
+ }
357
+ \`\`\`
358
+
359
+ The tags \`@param\`/\`@arg\`/\`@argument\` and \`@property\`/\`@prop\` will be properly
360
+ parsed to ensure that the matched "description" text includes only the text
361
+ after the name.
362
+
363
+ All other tags will treat the text following the tag name, a space, and
364
+ an optional curly-bracketed type expression (and another space) as part of
365
+ its "description" (e.g., for \`@returns {someType} some description\`, the
366
+ description is \`some description\` while for \`@some-tag xyz\`, the description
367
+ is \`xyz\`).`,
239
368
  patternProperties: {
240
369
  '.*': {
241
370
  oneOf: [
@@ -106,28 +106,58 @@ export default iterateJsdoc(({
106
106
  additionalProperties: false,
107
107
  properties: {
108
108
  match: {
109
+ description: `\`match\` is a required option containing an array of objects which determine
110
+ the conditions whereby a name is reported as being problematic.
111
+
112
+ These objects can have any combination of the following groups of optional
113
+ properties, all of which act to confine one another.
114
+
115
+ Note that \`comment\`, even if targeting a specific tag, is used to match the
116
+ whole block. So if a \`comment\` finds its specific tag, it may still apply
117
+ fixes found by the likes of \`disallowName\` even when a different tag has the
118
+ disallowed name. An alternative is to ensure that \`comment\` finds the specific
119
+ tag of the desired tag and/or name and no \`disallowName\` (or \`allowName\`) is
120
+ supplied. In such a case, only one error will be reported, but no fixer will
121
+ be applied, however.
122
+ `,
109
123
  items: {
110
124
  additionalProperties: false,
111
125
  properties: {
112
126
  allowName: {
127
+ description: `Indicates which names are allowed for the given tag (or \`*\`).
128
+ Accepts a string regular expression (optionally wrapped between two
129
+ \`/\` delimiters followed by optional flags) used to match the name.`,
113
130
  type: 'string',
114
131
  },
115
132
  comment: {
133
+ description: 'As with `context` but AST for the JSDoc block comment and types.',
116
134
  type: 'string',
117
135
  },
118
136
  context: {
137
+ description: `AST to confine the allowing or disallowing to JSDoc blocks
138
+ associated with a particular context. See the
139
+ ["AST and Selectors"](../#advanced-ast-and-selectors)
140
+ section of our Advanced docs for more on the expected format.`,
119
141
  type: 'string',
120
142
  },
121
143
  disallowName: {
144
+ description: 'As with `allowName` but indicates names that are not allowed.',
122
145
  type: 'string',
123
146
  },
124
147
  message: {
148
+ description: 'An optional custom message to use when there is a match.',
125
149
  type: 'string',
126
150
  },
127
151
  replacement: {
152
+ description: `If \`disallowName\` is supplied and this value is present, it
153
+ will replace the matched \`disallowName\` text.`,
128
154
  type: 'string',
129
155
  },
130
156
  tags: {
157
+ description: `This array should include tag names or \`*\` to indicate the
158
+ match will apply for all tags (except as confined by any context
159
+ properties). If \`*\` is not used, then these rules will only apply to
160
+ the specified tags. If \`tags\` is omitted, then \`*\` is assumed.`,
131
161
  items: {
132
162
  type: 'string',
133
163
  },
@@ -331,7 +331,7 @@ export default iterateJsdoc(({
331
331
  }).length)
332
332
  ) {
333
333
  utils.reportJSDoc(
334
- 'Multiline jsdoc blocks are prohibited by ' +
334
+ 'Multiline JSDoc blocks are prohibited by ' +
335
335
  'your configuration but fixing would result in a single ' +
336
336
  'line block which you have prohibited with `noSingleLineBlocks`.',
337
337
  );
@@ -342,7 +342,7 @@ export default iterateJsdoc(({
342
342
  if (jsdoc.tags.length > 1) {
343
343
  if (!allowMultipleTags) {
344
344
  utils.reportJSDoc(
345
- 'Multiline jsdoc blocks are prohibited by ' +
345
+ 'Multiline JSDoc blocks are prohibited by ' +
346
346
  'your configuration but the block has multiple tags.',
347
347
  );
348
348
 
@@ -351,7 +351,7 @@ export default iterateJsdoc(({
351
351
  } else if (jsdoc.tags.length === 1 && jsdoc.description.trim()) {
352
352
  if (!allowMultipleTags) {
353
353
  utils.reportJSDoc(
354
- 'Multiline jsdoc blocks are prohibited by ' +
354
+ 'Multiline JSDoc blocks are prohibited by ' +
355
355
  'your configuration but the block has a description with a tag.',
356
356
  );
357
357
 
@@ -419,7 +419,7 @@ export default iterateJsdoc(({
419
419
  };
420
420
 
421
421
  utils.reportJSDoc(
422
- 'Multiline jsdoc blocks are prohibited by ' +
422
+ 'Multiline JSDoc blocks are prohibited by ' +
423
423
  'your configuration.',
424
424
  null,
425
425
  fixer,
@@ -434,7 +434,7 @@ export default iterateJsdoc(({
434
434
  iterateAllJsdocs: true,
435
435
  meta: {
436
436
  docs: {
437
- description: 'Controls how and whether jsdoc blocks can be expressed as single or multiple line blocks.',
437
+ description: 'Controls how and whether JSDoc blocks can be expressed as single or multiple line blocks.',
438
438
  url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/multiline-blocks.md#repos-sticky-header',
439
439
  },
440
440
  fixable: 'code',
@@ -443,9 +443,28 @@ export default iterateJsdoc(({
443
443
  additionalProperties: false,
444
444
  properties: {
445
445
  allowMultipleTags: {
446
+ description: `If \`noMultilineBlocks\` is set to \`true\` with this option and multiple tags are
447
+ found in a block, an error will not be reported.
448
+
449
+ Since multiple-tagged lines cannot be collapsed into a single line, this option
450
+ prevents them from being reported. Set to \`false\` if you really want to report
451
+ any blocks.
452
+
453
+ This option will also be applied when there is a block description and a single
454
+ tag (since a description cannot precede a tag on a single line, and also
455
+ cannot be reliably added after the tag either).
456
+
457
+ Defaults to \`true\`.`,
446
458
  type: 'boolean',
447
459
  },
448
460
  minimumLengthForMultiline: {
461
+ description: `If \`noMultilineBlocks\` is set with this numeric option, multiline blocks will
462
+ be permitted if containing at least the given amount of text.
463
+
464
+ If not set, multiline blocks will not be permitted regardless of length unless
465
+ a relevant tag is present and \`multilineTags\` is set.
466
+
467
+ Defaults to not being in effect.`,
449
468
  type: 'integer',
450
469
  },
451
470
  multilineTags: {
@@ -462,23 +481,76 @@ export default iterateJsdoc(({
462
481
  type: 'array',
463
482
  },
464
483
  ],
484
+ description: `If \`noMultilineBlocks\` is set with this option, multiline blocks may be allowed
485
+ regardless of length as long as a tag or a tag of a certain type is present.
486
+
487
+ If \`*\` is included in the array, the presence of a tags will allow for
488
+ multiline blocks (but not when without any tags unless the amount of text is
489
+ over an amount specified by \`minimumLengthForMultiline\`).
490
+
491
+ If the array does not include \`*\` but lists certain tags, the presence of
492
+ such a tag will cause multiline blocks to be allowed.
493
+
494
+ You may set this to an empty array to prevent any tag from permitting multiple
495
+ lines.
496
+
497
+ Defaults to \`['*']\`.
498
+ `,
465
499
  },
466
500
  noFinalLineText: {
501
+ description: `For multiline blocks, any non-whitespace text preceding the \`*/\` on the final
502
+ line will be reported. (Text preceding a newline is not reported.)
503
+
504
+ \`noMultilineBlocks\` will have priority over this rule if it applies.
505
+
506
+ Defaults to \`true\`.`,
467
507
  type: 'boolean',
468
508
  },
469
509
  noMultilineBlocks: {
510
+ description: `Requires that JSDoc blocks are restricted to single lines only unless impacted
511
+ by the options \`minimumLengthForMultiline\`, \`multilineTags\`, or
512
+ \`allowMultipleTags\`.
513
+
514
+ Defaults to \`false\`.`,
470
515
  type: 'boolean',
471
516
  },
472
517
  noSingleLineBlocks: {
518
+ description: `If this is \`true\`, any single line blocks will be reported, except those which
519
+ are whitelisted in \`singleLineTags\`.
520
+
521
+ Defaults to \`false\`.
522
+ `,
473
523
  type: 'boolean',
474
524
  },
475
525
  noZeroLineText: {
526
+ description: `For multiline blocks, any non-whitespace text immediately after the \`/**\` and
527
+ space will be reported. (Text after a newline is not reported.)
528
+
529
+ \`noMultilineBlocks\` will have priority over this rule if it applies.
530
+
531
+ Defaults to \`true\`.`,
476
532
  type: 'boolean',
477
533
  },
478
534
  requireSingleLineUnderCount: {
535
+ description: `If this number is set, it indicates a minimum line width for a single line of
536
+ JSDoc content spread over a multi-line comment block. If a single line is under
537
+ the minimum length, it will be reported so as to enforce single line JSDoc blocks
538
+ for such cases. Blocks are not reported which have multi-line descriptions,
539
+ multiple tags, a block description and tag, or tags with multi-line types or
540
+ descriptions.
541
+
542
+ Defaults to \`null\`.
543
+ `,
479
544
  type: 'number',
480
545
  },
481
546
  singleLineTags: {
547
+ description: `An array of tags which can nevertheless be allowed as single line blocks when
548
+ \`noSingleLineBlocks\` is set. You may set this to a empty array to
549
+ cause all single line blocks to be reported. If \`'*'\` is present, then
550
+ the presence of a tag will allow single line blocks (but not if a tag is
551
+ missing).
552
+
553
+ Defaults to \`['lends', 'type']\`.`,
482
554
  items: {
483
555
  type: 'string',
484
556
  },
@@ -3,7 +3,7 @@ import {
3
3
  parse as commentParser,
4
4
  } from 'comment-parser';
5
5
 
6
- // Neither a single nor 3+ asterisks are valid jsdoc per
6
+ // Neither a single nor 3+ asterisks are valid JSDoc per
7
7
  // https://jsdoc.app/about-getting-started.html#adding-documentation-comments-to-your-code
8
8
  const commentRegexp = /^\/\*(?!\*)/v;
9
9
  const extraAsteriskCommentRegexp = /^\/\*{3,}/v;
@@ -93,7 +93,7 @@ export default iterateJsdoc(({
93
93
  checkFile: true,
94
94
  meta: {
95
95
  docs: {
96
- description: 'This rule checks for multi-line-style comments which fail to meet the criteria of a jsdoc block.',
96
+ description: 'This rule checks for multi-line-style comments which fail to meet the criteria of a JSDoc block.',
97
97
  url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-bad-blocks.md#repos-sticky-header',
98
98
  },
99
99
  fixable: 'code',
@@ -102,12 +102,21 @@ export default iterateJsdoc(({
102
102
  additionalProperties: false,
103
103
  properties: {
104
104
  ignore: {
105
+ description: `An array of directives that will not be reported if present at the beginning of
106
+ a multi-comment block and at-sign \`/* @\`.
107
+
108
+ Defaults to \`['ts-check', 'ts-expect-error', 'ts-ignore', 'ts-nocheck']\`
109
+ (some directives [used by TypeScript](https://www.typescriptlang.org/docs/handbook/intro-to-js-ts.html#ts-check)).
110
+ `,
105
111
  items: {
106
112
  type: 'string',
107
113
  },
108
114
  type: 'array',
109
115
  },
110
116
  preventAllMultiAsteriskBlocks: {
117
+ description: `A boolean (defaulting to \`false\`) which if \`true\` will prevent all
118
+ JSDoc-like blocks with more than two initial asterisks even those without
119
+ apparent tag content.`,
111
120
  type: 'boolean',
112
121
  },
113
122
  },
@@ -59,7 +59,7 @@ export default iterateJsdoc(({
59
59
  iterateAllJsdocs: true,
60
60
  meta: {
61
61
  docs: {
62
- description: 'Detects and removes extra lines of a blank block description',
62
+ description: 'If tags are present, this rule will prevent empty lines in the block description. If no tags are present, this rule will prevent extra empty lines in the block description.',
63
63
  url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-blank-block-descriptions.md#repos-sticky-header',
64
64
  },
65
65
  fixable: 'whitespace',
@@ -43,9 +43,11 @@ export default iterateJsdoc(({
43
43
  additionalProperties: false,
44
44
  properties: {
45
45
  enableFixer: {
46
+ description: 'Whether or not to auto-remove the blank block. Defaults to `false`.',
46
47
  type: 'boolean',
47
48
  },
48
49
  },
50
+ type: 'object',
49
51
  },
50
52
  ],
51
53
  type: 'suggestion',