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
@@ -34,9 +34,13 @@ import {
34
34
  /** @type {import('json-schema').JSONSchema4} */
35
35
  const OPTIONS_SCHEMA = {
36
36
  additionalProperties: false,
37
+ description: 'Has the following optional keys.\n',
37
38
  properties: {
38
39
  checkConstructors: {
39
40
  default: true,
41
+ description: `A value indicating whether \`constructor\`s should be checked. Defaults to
42
+ \`true\`. When \`true\`, \`exemptEmptyConstructors\` may still avoid reporting when
43
+ no parameters or return values are found.`,
40
44
  type: 'boolean',
41
45
  },
42
46
  checkGetters: {
@@ -52,6 +56,12 @@ const OPTIONS_SCHEMA = {
52
56
  },
53
57
  ],
54
58
  default: true,
59
+ description: `A value indicating whether getters should be checked. Besides setting as a
60
+ boolean, this option can be set to the string \`"no-setter"\` to indicate that
61
+ getters should be checked but only when there is no setter. This may be useful
62
+ if one only wishes documentation on one of the two accessors. Defaults to
63
+ \`false\`.
64
+ `,
55
65
  },
56
66
  checkSetters: {
57
67
  anyOf: [
@@ -66,8 +76,28 @@ const OPTIONS_SCHEMA = {
66
76
  },
67
77
  ],
68
78
  default: true,
79
+ description: `A value indicating whether setters should be checked. Besides setting as a
80
+ boolean, this option can be set to the string \`"no-getter"\` to indicate that
81
+ setters should be checked but only when there is no getter. This may be useful
82
+ if one only wishes documentation on one of the two accessors. Defaults to
83
+ \`false\`.`,
69
84
  },
70
85
  contexts: {
86
+ description: `Set this to an array of strings or objects representing the additional AST
87
+ contexts where you wish the rule to be applied (e.g., \`Property\` for
88
+ properties). If specified as an object, it should have a \`context\` property
89
+ and can have an \`inlineCommentBlock\` property which, if set to \`true\`, will
90
+ add an inline \`/** */\` instead of the regular, multi-line, indented jsdoc
91
+ block which will otherwise be added. Defaults to an empty array. Contexts
92
+ may also have their own \`minLineCount\` property which is an integer
93
+ indicating a minimum number of lines expected for a node in order
94
+ for it to require documentation.
95
+
96
+ Note that you may need to disable \`require\` items (e.g., \`MethodDefinition\`)
97
+ if you are specifying a more precise form in \`contexts\` (e.g., \`MethodDefinition:not([accessibility="private"] > FunctionExpression\`).
98
+
99
+ See the ["AST and Selectors"](../#advanced-ast-and-selectors)
100
+ section of our Advanced docs for more on the expected format.`,
71
101
  items: {
72
102
  anyOf: [
73
103
  {
@@ -94,28 +124,62 @@ const OPTIONS_SCHEMA = {
94
124
  },
95
125
  enableFixer: {
96
126
  default: true,
127
+ description: `A boolean on whether to enable the fixer (which adds an empty JSDoc block).
128
+ Defaults to \`true\`.`,
97
129
  type: 'boolean',
98
130
  },
99
131
  exemptEmptyConstructors: {
100
132
  default: false,
133
+ description: `When \`true\`, the rule will not report missing JSDoc blocks above constructors
134
+ with no parameters or return values (this is enabled by default as the class
135
+ name or description should be seen as sufficient to convey intent).
136
+
137
+ Defaults to \`true\`.`,
101
138
  type: 'boolean',
102
139
  },
103
140
  exemptEmptyFunctions: {
104
141
  default: false,
142
+ description: `When \`true\`, the rule will not report missing JSDoc blocks above
143
+ functions/methods with no parameters or return values (intended where
144
+ function/method names are sufficient for themselves as documentation).
145
+
146
+ Defaults to \`false\`.
147
+ `,
105
148
  type: 'boolean',
106
149
  },
107
150
  exemptOverloadedImplementations: {
108
151
  default: false,
152
+ description: `If set to \`true\` will avoid checking an overloaded function's implementation.
153
+
154
+ Defaults to \`false\`.`,
109
155
  type: 'boolean',
110
156
  },
111
157
  fixerMessage: {
112
158
  default: '',
159
+ description: `An optional message to add to the inserted JSDoc block. Defaults to the
160
+ empty string.`,
113
161
  type: 'string',
114
162
  },
115
163
  minLineCount: {
164
+ description: `An integer to indicate a minimum number of lines expected for a node in order
165
+ for it to require documentation. Defaults to \`undefined\`. This option will
166
+ apply to any context; see \`contexts\` for line counts specific to a context.`,
116
167
  type: 'integer',
117
168
  },
118
169
  publicOnly: {
170
+ description: `This option will insist that missing JSDoc blocks are only reported for
171
+ function bodies / class declarations that are exported from the module.
172
+ May be a boolean or object. If set to \`true\`, the defaults below will be
173
+ used. If unset, JSDoc block reporting will not be limited to exports.
174
+
175
+ This object supports the following optional boolean keys (\`false\` unless
176
+ otherwise noted):
177
+
178
+ - \`ancestorsOnly\` - Optimization to only check node ancestors to check if node is exported
179
+ - \`esm\` - ESM exports are checked for JSDoc comments (Defaults to \`true\`)
180
+ - \`cjs\` - CommonJS exports are checked for JSDoc comments (Defaults to \`true\`)
181
+ - \`window\` - Window global exports are checked for JSDoc comments
182
+ `,
119
183
  oneOf: [
120
184
  {
121
185
  default: false,
@@ -145,29 +209,37 @@ const OPTIONS_SCHEMA = {
145
209
  require: {
146
210
  additionalProperties: false,
147
211
  default: {},
212
+ description: `An object with the following optional boolean keys which all default to
213
+ \`false\` except for \`FunctionDeclaration\` which defaults to \`true\`.`,
148
214
  properties: {
149
215
  ArrowFunctionExpression: {
150
216
  default: false,
217
+ description: 'Whether to check arrow functions like `() => {}`',
151
218
  type: 'boolean',
152
219
  },
153
220
  ClassDeclaration: {
154
221
  default: false,
222
+ description: 'Whether to check declarations like `class A {}`',
155
223
  type: 'boolean',
156
224
  },
157
225
  ClassExpression: {
158
226
  default: false,
227
+ description: 'Whether to check class expressions like `const myClass = class {}`',
159
228
  type: 'boolean',
160
229
  },
161
230
  FunctionDeclaration: {
162
231
  default: true,
232
+ description: 'Whether to check function declarations like `function a {}`',
163
233
  type: 'boolean',
164
234
  },
165
235
  FunctionExpression: {
166
236
  default: false,
237
+ description: 'Whether to check function expressions like `const a = function {}`',
167
238
  type: 'boolean',
168
239
  },
169
240
  MethodDefinition: {
170
241
  default: false,
242
+ description: 'Whether to check method definitions like `class A { someMethodDefinition () {} }`',
171
243
  type: 'boolean',
172
244
  },
173
245
  },
@@ -175,6 +247,13 @@ const OPTIONS_SCHEMA = {
175
247
  },
176
248
  skipInterveningOverloadedDeclarations: {
177
249
  default: true,
250
+ description: `If \`true\`, will skip above uncommented overloaded functions to check
251
+ for a comment block (e.g., at the top of a set of overloaded functions).
252
+
253
+ If \`false\`, will force each overloaded function to be checked for a
254
+ comment block.
255
+
256
+ Defaults to \`true\`.`,
178
257
  type: 'boolean',
179
258
  },
180
259
  },
@@ -790,7 +869,7 @@ export default {
790
869
  meta: {
791
870
  docs: {
792
871
  category: 'Stylistic Issues',
793
- description: 'Require JSDoc comments',
872
+ description: 'Checks for presence of JSDoc comments, on functions and potentially other contexts (optionally limited to exports).',
794
873
  recommended: true,
795
874
  url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-jsdoc.md#repos-sticky-header',
796
875
  },
@@ -517,7 +517,7 @@ export default iterateJsdoc(({
517
517
  contextDefaults: true,
518
518
  meta: {
519
519
  docs: {
520
- description: 'Requires that all function parameters are documented.',
520
+ description: 'Requires that all function parameters are documented with a `@param` tag.',
521
521
  url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-param.md#repos-sticky-header',
522
522
  },
523
523
  fixable: 'code',
@@ -527,36 +527,150 @@ export default iterateJsdoc(({
527
527
  properties: {
528
528
  autoIncrementBase: {
529
529
  default: 0,
530
+ description: `Numeric to indicate the number at which to begin auto-incrementing roots.
531
+ Defaults to \`0\`.
532
+ `,
530
533
  type: 'integer',
531
534
  },
532
535
  checkConstructors: {
533
536
  default: true,
537
+ description: `A value indicating whether \`constructor\`s should be checked. Defaults to
538
+ \`true\`.
539
+ `,
534
540
  type: 'boolean',
535
541
  },
536
542
  checkDestructured: {
537
543
  default: true,
544
+ description: 'Whether to require destructured properties. Defaults to `true`.',
538
545
  type: 'boolean',
539
546
  },
540
547
  checkDestructuredRoots: {
541
548
  default: true,
549
+ description: `Whether to check the existence of a corresponding \`@param\` for root objects
550
+ of destructured properties (e.g., that for \`function ({a, b}) {}\`, that there
551
+ is something like \`@param myRootObj\` defined that can correspond to
552
+ the \`{a, b}\` object parameter).
553
+
554
+ If \`checkDestructuredRoots\` is \`false\`, \`checkDestructured\` will also be
555
+ implied to be \`false\` (i.e., the inside of the roots will not be checked
556
+ either, e.g., it will also not complain if \`a\` or \`b\` do not have their own
557
+ documentation). Defaults to \`true\`.
558
+ `,
542
559
  type: 'boolean',
543
560
  },
544
561
  checkGetters: {
545
562
  default: false,
563
+ description: 'A value indicating whether getters should be checked. Defaults to `false`.',
546
564
  type: 'boolean',
547
565
  },
548
566
  checkRestProperty: {
549
567
  default: false,
568
+ description: `If set to \`true\`, will report (and add fixer insertions) for missing rest
569
+ properties. Defaults to \`false\`.
570
+
571
+ If set to \`true\`, note that you can still document the subproperties of the
572
+ rest property using other jsdoc features, e.g., \`@typedef\`:
573
+
574
+ \`\`\`js
575
+ /**
576
+ * @typedef ExtraOptions
577
+ * @property innerProp1
578
+ * @property innerProp2
579
+ */
580
+
581
+ /**
582
+ * @param cfg
583
+ * @param cfg.num
584
+ * @param {ExtraOptions} extra
585
+ */
586
+ function quux ({num, ...extra}) {
587
+ }
588
+ \`\`\`
589
+
590
+ Setting this option to \`false\` (the default) may be useful in cases where
591
+ you already have separate \`@param\` definitions for each of the properties
592
+ within the rest property.
593
+
594
+ For example, with the option disabled, this will not give an error despite
595
+ \`extra\` not having any definition:
596
+
597
+ \`\`\`js
598
+ /**
599
+ * @param cfg
600
+ * @param cfg.num
601
+ */
602
+ function quux ({num, ...extra}) {
603
+ }
604
+ \`\`\`
605
+
606
+ Nor will this:
607
+
608
+ \`\`\`js
609
+ /**
610
+ * @param cfg
611
+ * @param cfg.num
612
+ * @param cfg.innerProp1
613
+ * @param cfg.innerProp2
614
+ */
615
+ function quux ({num, ...extra}) {
616
+ }
617
+ \`\`\`
618
+ `,
550
619
  type: 'boolean',
551
620
  },
552
621
  checkSetters: {
553
622
  default: false,
623
+ description: 'A value indicating whether setters should be checked. Defaults to `false`.',
554
624
  type: 'boolean',
555
625
  },
556
626
  checkTypesPattern: {
627
+ description: `When one specifies a type, unless it is of a generic type, like \`object\`
628
+ or \`array\`, it may be considered unnecessary to have that object's
629
+ destructured components required, especially where generated docs will
630
+ link back to the specified type. For example:
631
+
632
+ \`\`\`js
633
+ /**
634
+ * @param {SVGRect} bbox - a SVGRect
635
+ */
636
+ export const bboxToObj = function ({x, y, width, height}) {
637
+ return {x, y, width, height};
638
+ };
639
+ \`\`\`
640
+
641
+ By default \`checkTypesPattern\` is set to
642
+ \`/^(?:[oO]bject|[aA]rray|PlainObject|Generic(?:Object|Array))$/v\`,
643
+ meaning that destructuring will be required only if the type of the \`@param\`
644
+ (the text between curly brackets) is a match for "Object" or "Array" (with or
645
+ without initial caps), "PlainObject", or "GenericObject", "GenericArray" (or
646
+ if no type is present). So in the above example, the lack of a match will
647
+ mean that no complaint will be given about the undocumented destructured
648
+ parameters.
649
+
650
+ Note that the \`/\` delimiters are optional, but necessary to add flags.
651
+
652
+ Defaults to using (only) the \`v\` flag, so to add your own flags, encapsulate
653
+ your expression as a string, but like a literal, e.g., \`/^object$/vi\`.
654
+
655
+ You could set this regular expression to a more expansive list, or you
656
+ could restrict it such that even types matching those strings would not
657
+ need destructuring.`,
557
658
  type: 'string',
558
659
  },
559
660
  contexts: {
661
+ description: `Set this to an array of strings representing the AST context (or an object with
662
+ optional \`context\` and \`comment\` properties) where you wish the rule to be applied.
663
+
664
+ \`context\` defaults to \`any\` and \`comment\` defaults to no specific comment context.
665
+
666
+ Overrides the default contexts (\`ArrowFunctionExpression\`, \`FunctionDeclaration\`,
667
+ \`FunctionExpression\`). May be useful for adding such as
668
+ \`TSMethodSignature\` in TypeScript or restricting the contexts
669
+ which are checked.
670
+
671
+ See the ["AST and Selectors"](../#advanced-ast-and-selectors)
672
+ section of our Advanced docs for more on the expected format.
673
+ `,
560
674
  items: {
561
675
  anyOf: [
562
676
  {
@@ -579,33 +693,131 @@ export default iterateJsdoc(({
579
693
  type: 'array',
580
694
  },
581
695
  enableFixer: {
696
+ description: 'Whether to enable the fixer. Defaults to `true`.',
582
697
  type: 'boolean',
583
698
  },
584
699
  enableRestElementFixer: {
700
+ description: `Whether to enable the rest element fixer.
701
+
702
+ The fixer will automatically report/insert
703
+ [JSDoc repeatable parameters](https://jsdoc.app/tags-param.html#multiple-types-and-repeatable-parameters)
704
+ if missing.
705
+
706
+ \`\`\`js
707
+ /**
708
+ * @param {GenericArray} cfg
709
+ * @param {number} cfg."0"
710
+ */
711
+ function baar ([a, ...extra]) {
712
+ //
713
+ }
714
+ \`\`\`
715
+
716
+ ...becomes:
717
+
718
+ \`\`\`js
719
+ /**
720
+ * @param {GenericArray} cfg
721
+ * @param {number} cfg."0"
722
+ * @param {...any} cfg."1"
723
+ */
724
+ function baar ([a, ...extra]) {
725
+ //
726
+ }
727
+ \`\`\`
728
+
729
+ Note that the type \`any\` is included since we don't know of any specific
730
+ type to use.
731
+
732
+ Defaults to \`true\`.
733
+ `,
585
734
  type: 'boolean',
586
735
  },
587
736
  enableRootFixer: {
737
+ description: `Whether to enable the auto-adding of incrementing roots.
738
+
739
+ The default behavior of \`true\` is for "root" to be auto-inserted for missing
740
+ roots, followed by a 0-based auto-incrementing number.
741
+
742
+ So for:
743
+
744
+ \`\`\`js
745
+ function quux ({foo}, {bar}, {baz}) {
746
+ }
747
+ \`\`\`
748
+
749
+ ...the default JSDoc that would be added if the fixer is enabled would be:
750
+
751
+ \`\`\`js
752
+ /**
753
+ * @param root0
754
+ * @param root0.foo
755
+ * @param root1
756
+ * @param root1.bar
757
+ * @param root2
758
+ * @param root2.baz
759
+ */
760
+ \`\`\`
761
+
762
+ Has no effect if \`enableFixer\` is set to \`false\`.`,
588
763
  type: 'boolean',
589
764
  },
590
765
  exemptedBy: {
766
+ description: `Array of tags (e.g., \`['type']\`) whose presence on the document block
767
+ avoids the need for a \`@param\`. Defaults to an array with
768
+ \`inheritdoc\`. If you set this array, it will overwrite the default,
769
+ so be sure to add back \`inheritdoc\` if you wish its presence to cause
770
+ exemption of the rule.`,
591
771
  items: {
592
772
  type: 'string',
593
773
  },
594
774
  type: 'array',
595
775
  },
596
776
  ignoreWhenAllParamsMissing: {
777
+ description: `Set to \`true\` to ignore reporting when all params are missing. Defaults to
778
+ \`false\`.`,
597
779
  type: 'boolean',
598
780
  },
599
781
  interfaceExemptsParamsCheck: {
782
+ description: `Set if you wish TypeScript interfaces to exempt checks for the existence of
783
+ \`@param\`'s.
784
+
785
+ Will check for a type defining the function itself (on a variable
786
+ declaration) or if there is a single destructured object with a type.
787
+ Defaults to \`false\`.`,
600
788
  type: 'boolean',
601
789
  },
602
790
  unnamedRootBase: {
791
+ description: `An array of root names to use in the fixer when roots are missing. Defaults
792
+ to \`['root']\`. Note that only when all items in the array besides the last
793
+ are exhausted will auto-incrementing occur. So, with
794
+ \`unnamedRootBase: ['arg', 'config']\`, the following:
795
+
796
+ \`\`\`js
797
+ function quux ({foo}, [bar], {baz}) {
798
+ }
799
+ \`\`\`
800
+
801
+ ...will get the following JSDoc block added:
802
+
803
+ \`\`\`js
804
+ /**
805
+ * @param arg
806
+ * @param arg.foo
807
+ * @param config0
808
+ * @param config0."0" (\`bar\`)
809
+ * @param config1
810
+ * @param config1.baz
811
+ */
812
+ \`\`\``,
603
813
  items: {
604
814
  type: 'string',
605
815
  },
606
816
  type: 'array',
607
817
  },
608
818
  useDefaultObjectProperties: {
819
+ description: `Set to \`true\` if you wish to expect documentation of properties on objects
820
+ supplied as default values. Defaults to \`false\`.`,
609
821
  type: 'boolean',
610
822
  },
611
823
  },
@@ -53,6 +53,20 @@ export default iterateJsdoc(({
53
53
  additionalProperties: false,
54
54
  properties: {
55
55
  contexts: {
56
+ description: `Set this to an array of strings representing the AST context (or an object with
57
+ optional \`context\` and \`comment\` properties) where you wish the rule to be applied.
58
+
59
+ \`context\` defaults to \`any\` and \`comment\` defaults to no specific comment context.
60
+
61
+ Overrides the default contexts (\`ArrowFunctionExpression\`, \`FunctionDeclaration\`,
62
+ \`FunctionExpression\`). Set to \`"any"\` if you want
63
+ the rule to apply to any JSDoc block throughout your files (as is necessary
64
+ for finding function blocks not attached to a function declaration or
65
+ expression, i.e., \`@callback\` or \`@function\` (or its aliases \`@func\` or
66
+ \`@method\`) (including those associated with an \`@interface\`).
67
+
68
+ See the ["AST and Selectors"](../#advanced-ast-and-selectors)
69
+ section of our Advanced docs for more on the expected format.`,
56
70
  items: {
57
71
  anyOf: [
58
72
  {
@@ -75,9 +89,16 @@ export default iterateJsdoc(({
75
89
  type: 'array',
76
90
  },
77
91
  defaultDestructuredRootDescription: {
92
+ description: `The description string to set by default for destructured roots. Defaults to
93
+ "The root object".`,
78
94
  type: 'string',
79
95
  },
80
96
  setDefaultDestructuredRootDescription: {
97
+ description: `Whether to set a default destructured root description. For example, you may
98
+ wish to avoid manually having to set the description for a \`@param\`
99
+ corresponding to a destructured root object as it should always be the same
100
+ type of object. Uses \`defaultDestructuredRootDescription\` for the description
101
+ string. Defaults to \`false\`.`,
81
102
  type: 'boolean',
82
103
  },
83
104
  },
@@ -17,7 +17,7 @@ export default iterateJsdoc(({
17
17
  contextDefaults: true,
18
18
  meta: {
19
19
  docs: {
20
- description: 'Requires that all function parameters have names.',
20
+ description: 'Requires that all `@param` tags have names.',
21
21
  url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-param-name.md#repos-sticky-header',
22
22
  },
23
23
  schema: [
@@ -25,6 +25,21 @@ export default iterateJsdoc(({
25
25
  additionalProperties: false,
26
26
  properties: {
27
27
  contexts: {
28
+ description: `Set this to an array of strings representing the AST context (or an object with
29
+ optional \`context\` and \`comment\` properties) where you wish the rule to be applied.
30
+
31
+ \`context\` defaults to \`any\` and \`comment\` defaults to no specific comment context.
32
+
33
+ Overrides the default contexts (\`ArrowFunctionExpression\`, \`FunctionDeclaration\`,
34
+ \`FunctionExpression\`). Set to \`"any"\` if you want
35
+ the rule to apply to any JSDoc block throughout your files (as is necessary
36
+ for finding function blocks not attached to a function declaration or
37
+ expression, i.e., \`@callback\` or \`@function\` (or its aliases \`@func\` or
38
+ \`@method\`) (including those associated with an \`@interface\`).
39
+
40
+ See the ["AST and Selectors"](../#advanced-ast-and-selectors)
41
+ section of our Advanced docs for more on the expected format.
42
+ `,
28
43
  items: {
29
44
  anyOf: [
30
45
  {
@@ -44,7 +44,7 @@ export default iterateJsdoc(({
44
44
  contextDefaults: true,
45
45
  meta: {
46
46
  docs: {
47
- description: 'Requires that each `@param` tag has a `type` value.',
47
+ description: 'Requires that each `@param` tag has a type value (in curly brackets).',
48
48
  url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-param-type.md#repos-sticky-header',
49
49
  },
50
50
  fixable: 'code',
@@ -53,6 +53,20 @@ export default iterateJsdoc(({
53
53
  additionalProperties: false,
54
54
  properties: {
55
55
  contexts: {
56
+ description: `Set this to an array of strings representing the AST context (or an object with
57
+ optional \`context\` and \`comment\` properties) where you wish the rule to be applied.
58
+
59
+ \`context\` defaults to \`any\` and \`comment\` defaults to no specific comment context.
60
+
61
+ Overrides the default contexts (\`ArrowFunctionExpression\`, \`FunctionDeclaration\`,
62
+ \`FunctionExpression\`). Set to \`"any"\` if you want
63
+ the rule to apply to any JSDoc block throughout your files (as is necessary
64
+ for finding function blocks not attached to a function declaration or
65
+ expression, i.e., \`@callback\` or \`@function\` (or its aliases \`@func\` or
66
+ \`@method\`) (including those associated with an \`@interface\`).
67
+
68
+ See the ["AST and Selectors"](../#advanced-ast-and-selectors)
69
+ section of our Advanced docs for more on the expected format.`,
56
70
  items: {
57
71
  anyOf: [
58
72
  {
@@ -75,9 +89,15 @@ export default iterateJsdoc(({
75
89
  type: 'array',
76
90
  },
77
91
  defaultDestructuredRootType: {
92
+ description: 'The type string to set by default for destructured roots. Defaults to "object".',
78
93
  type: 'string',
79
94
  },
80
95
  setDefaultDestructuredRootType: {
96
+ description: `Whether to set a default destructured root type. For example, you may wish
97
+ to avoid manually having to set the type for a \`@param\`
98
+ corresponding to a destructured root object as it is always going to be an
99
+ object. Uses \`defaultDestructuredRootType\` for the type string. Defaults to
100
+ \`false\`.`,
81
101
  type: 'boolean',
82
102
  },
83
103
  },
@@ -17,7 +17,7 @@ export default iterateJsdoc(({
17
17
  iterateAllJsdocs: true,
18
18
  meta: {
19
19
  docs: {
20
- description: 'Requires that all function `@property` tags have names.',
20
+ description: 'Requires that all `@property` tags have names.',
21
21
  url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-property-name.md#repos-sticky-header',
22
22
  },
23
23
  type: 'suggestion',
@@ -17,7 +17,7 @@ export default iterateJsdoc(({
17
17
  iterateAllJsdocs: true,
18
18
  meta: {
19
19
  docs: {
20
- description: 'Requires that each `@property` tag has a `type` value.',
20
+ description: 'Requires that each `@property` tag has a type value (in curly brackets).',
21
21
  url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-property-type.md#repos-sticky-header',
22
22
  },
23
23
  type: 'suggestion',