eslint-plugin-jsdoc 46.4.6 → 46.5.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 (187) hide show
  1. package/README.md +31 -0
  2. package/dist/index.js +21 -10
  3. package/dist/index.js.map +1 -1
  4. package/package.json +14 -12
  5. package/dist/WarnSettings.d.ts +0 -17
  6. package/dist/WarnSettings.d.ts.map +0 -1
  7. package/dist/alignTransform.d.ts +0 -32
  8. package/dist/alignTransform.d.ts.map +0 -1
  9. package/dist/defaultTagOrder.d.ts +0 -5
  10. package/dist/defaultTagOrder.d.ts.map +0 -1
  11. package/dist/exportParser.d.ts +0 -41
  12. package/dist/exportParser.d.ts.map +0 -1
  13. package/dist/getDefaultTagStructureForMode.d.ts +0 -11
  14. package/dist/getDefaultTagStructureForMode.d.ts.map +0 -1
  15. package/dist/index.d.ts +0 -10
  16. package/dist/index.d.ts.map +0 -1
  17. package/dist/iterateJsdoc.d.ts +0 -460
  18. package/dist/iterateJsdoc.d.ts.map +0 -1
  19. package/dist/jsdocUtils.d.ts +0 -421
  20. package/dist/jsdocUtils.d.ts.map +0 -1
  21. package/dist/rules/checkAccess.d.ts +0 -3
  22. package/dist/rules/checkAccess.d.ts.map +0 -1
  23. package/dist/rules/checkAlignment.d.ts +0 -3
  24. package/dist/rules/checkAlignment.d.ts.map +0 -1
  25. package/dist/rules/checkExamples.d.ts +0 -4
  26. package/dist/rules/checkExamples.d.ts.map +0 -1
  27. package/dist/rules/checkIndentation.d.ts +0 -3
  28. package/dist/rules/checkIndentation.d.ts.map +0 -1
  29. package/dist/rules/checkLineAlignment.d.ts +0 -10
  30. package/dist/rules/checkLineAlignment.d.ts.map +0 -1
  31. package/dist/rules/checkParamNames.d.ts +0 -3
  32. package/dist/rules/checkParamNames.d.ts.map +0 -1
  33. package/dist/rules/checkPropertyNames.d.ts +0 -3
  34. package/dist/rules/checkPropertyNames.d.ts.map +0 -1
  35. package/dist/rules/checkSyntax.d.ts +0 -3
  36. package/dist/rules/checkSyntax.d.ts.map +0 -1
  37. package/dist/rules/checkTagNames.d.ts +0 -3
  38. package/dist/rules/checkTagNames.d.ts.map +0 -1
  39. package/dist/rules/checkTypes.d.ts +0 -3
  40. package/dist/rules/checkTypes.d.ts.map +0 -1
  41. package/dist/rules/checkValues.d.ts +0 -3
  42. package/dist/rules/checkValues.d.ts.map +0 -1
  43. package/dist/rules/emptyTags.d.ts +0 -3
  44. package/dist/rules/emptyTags.d.ts.map +0 -1
  45. package/dist/rules/implementsOnClasses.d.ts +0 -3
  46. package/dist/rules/implementsOnClasses.d.ts.map +0 -1
  47. package/dist/rules/importsAsDependencies.d.ts +0 -3
  48. package/dist/rules/importsAsDependencies.d.ts.map +0 -1
  49. package/dist/rules/informativeDocs.d.ts +0 -3
  50. package/dist/rules/informativeDocs.d.ts.map +0 -1
  51. package/dist/rules/matchDescription.d.ts +0 -3
  52. package/dist/rules/matchDescription.d.ts.map +0 -1
  53. package/dist/rules/matchName.d.ts +0 -3
  54. package/dist/rules/matchName.d.ts.map +0 -1
  55. package/dist/rules/multilineBlocks.d.ts +0 -3
  56. package/dist/rules/multilineBlocks.d.ts.map +0 -1
  57. package/dist/rules/noBadBlocks.d.ts +0 -3
  58. package/dist/rules/noBadBlocks.d.ts.map +0 -1
  59. package/dist/rules/noBlankBlockDescriptions.d.ts +0 -3
  60. package/dist/rules/noBlankBlockDescriptions.d.ts.map +0 -1
  61. package/dist/rules/noBlankBlocks.d.ts +0 -3
  62. package/dist/rules/noBlankBlocks.d.ts.map +0 -1
  63. package/dist/rules/noDefaults.d.ts +0 -3
  64. package/dist/rules/noDefaults.d.ts.map +0 -1
  65. package/dist/rules/noMissingSyntax.d.ts +0 -10
  66. package/dist/rules/noMissingSyntax.d.ts.map +0 -1
  67. package/dist/rules/noMultiAsterisks.d.ts +0 -3
  68. package/dist/rules/noMultiAsterisks.d.ts.map +0 -1
  69. package/dist/rules/noRestrictedSyntax.d.ts +0 -3
  70. package/dist/rules/noRestrictedSyntax.d.ts.map +0 -1
  71. package/dist/rules/noTypes.d.ts +0 -3
  72. package/dist/rules/noTypes.d.ts.map +0 -1
  73. package/dist/rules/noUndefinedTypes.d.ts +0 -3
  74. package/dist/rules/noUndefinedTypes.d.ts.map +0 -1
  75. package/dist/rules/requireAsteriskPrefix.d.ts +0 -3
  76. package/dist/rules/requireAsteriskPrefix.d.ts.map +0 -1
  77. package/dist/rules/requireDescription.d.ts +0 -3
  78. package/dist/rules/requireDescription.d.ts.map +0 -1
  79. package/dist/rules/requireDescriptionCompleteSentence.d.ts +0 -3
  80. package/dist/rules/requireDescriptionCompleteSentence.d.ts.map +0 -1
  81. package/dist/rules/requireExample.d.ts +0 -3
  82. package/dist/rules/requireExample.d.ts.map +0 -1
  83. package/dist/rules/requireFileOverview.d.ts +0 -3
  84. package/dist/rules/requireFileOverview.d.ts.map +0 -1
  85. package/dist/rules/requireHyphenBeforeParamDescription.d.ts +0 -3
  86. package/dist/rules/requireHyphenBeforeParamDescription.d.ts.map +0 -1
  87. package/dist/rules/requireJsdoc.d.ts +0 -9
  88. package/dist/rules/requireJsdoc.d.ts.map +0 -1
  89. package/dist/rules/requireParam.d.ts +0 -4
  90. package/dist/rules/requireParam.d.ts.map +0 -1
  91. package/dist/rules/requireParamDescription.d.ts +0 -3
  92. package/dist/rules/requireParamDescription.d.ts.map +0 -1
  93. package/dist/rules/requireParamName.d.ts +0 -3
  94. package/dist/rules/requireParamName.d.ts.map +0 -1
  95. package/dist/rules/requireParamType.d.ts +0 -3
  96. package/dist/rules/requireParamType.d.ts.map +0 -1
  97. package/dist/rules/requireProperty.d.ts +0 -3
  98. package/dist/rules/requireProperty.d.ts.map +0 -1
  99. package/dist/rules/requirePropertyDescription.d.ts +0 -3
  100. package/dist/rules/requirePropertyDescription.d.ts.map +0 -1
  101. package/dist/rules/requirePropertyName.d.ts +0 -3
  102. package/dist/rules/requirePropertyName.d.ts.map +0 -1
  103. package/dist/rules/requirePropertyType.d.ts +0 -3
  104. package/dist/rules/requirePropertyType.d.ts.map +0 -1
  105. package/dist/rules/requireReturns.d.ts +0 -3
  106. package/dist/rules/requireReturns.d.ts.map +0 -1
  107. package/dist/rules/requireReturnsCheck.d.ts +0 -3
  108. package/dist/rules/requireReturnsCheck.d.ts.map +0 -1
  109. package/dist/rules/requireReturnsDescription.d.ts +0 -3
  110. package/dist/rules/requireReturnsDescription.d.ts.map +0 -1
  111. package/dist/rules/requireReturnsType.d.ts +0 -3
  112. package/dist/rules/requireReturnsType.d.ts.map +0 -1
  113. package/dist/rules/requireThrows.d.ts +0 -3
  114. package/dist/rules/requireThrows.d.ts.map +0 -1
  115. package/dist/rules/requireYields.d.ts +0 -3
  116. package/dist/rules/requireYields.d.ts.map +0 -1
  117. package/dist/rules/requireYieldsCheck.d.ts +0 -3
  118. package/dist/rules/requireYieldsCheck.d.ts.map +0 -1
  119. package/dist/rules/sortTags.d.ts +0 -3
  120. package/dist/rules/sortTags.d.ts.map +0 -1
  121. package/dist/rules/tagLines.d.ts +0 -3
  122. package/dist/rules/tagLines.d.ts.map +0 -1
  123. package/dist/rules/textEscaping.d.ts +0 -3
  124. package/dist/rules/textEscaping.d.ts.map +0 -1
  125. package/dist/rules/validTypes.d.ts +0 -3
  126. package/dist/rules/validTypes.d.ts.map +0 -1
  127. package/dist/tagNames.d.ts +0 -16
  128. package/dist/tagNames.d.ts.map +0 -1
  129. package/dist/utils/hasReturnValue.d.ts +0 -20
  130. package/dist/utils/hasReturnValue.d.ts.map +0 -1
  131. package/docs/advanced.md +0 -102
  132. package/docs/rules/check-access.md +0 -193
  133. package/docs/rules/check-alignment.md +0 -169
  134. package/docs/rules/check-examples.md +0 -784
  135. package/docs/rules/check-indentation.md +0 -296
  136. package/docs/rules/check-line-alignment.md +0 -1002
  137. package/docs/rules/check-param-names.md +0 -1035
  138. package/docs/rules/check-property-names.md +0 -244
  139. package/docs/rules/check-syntax.md +0 -80
  140. package/docs/rules/check-tag-names.md +0 -1132
  141. package/docs/rules/check-types.md +0 -1198
  142. package/docs/rules/check-values.md +0 -409
  143. package/docs/rules/empty-tags.md +0 -220
  144. package/docs/rules/implements-on-classes.md +0 -219
  145. package/docs/rules/imports-as-dependencies.md +0 -99
  146. package/docs/rules/informative-docs.md +0 -400
  147. package/docs/rules/match-description.md +0 -1008
  148. package/docs/rules/match-name.md +0 -249
  149. package/docs/rules/multiline-blocks.md +0 -398
  150. package/docs/rules/no-bad-blocks.md +0 -174
  151. package/docs/rules/no-blank-block-descriptions.md +0 -91
  152. package/docs/rules/no-blank-blocks.md +0 -98
  153. package/docs/rules/no-defaults.md +0 -207
  154. package/docs/rules/no-missing-syntax.md +0 -275
  155. package/docs/rules/no-multi-asterisks.md +0 -278
  156. package/docs/rules/no-restricted-syntax.md +0 -383
  157. package/docs/rules/no-types.md +0 -168
  158. package/docs/rules/no-undefined-types.md +0 -789
  159. package/docs/rules/require-asterisk-prefix.md +0 -297
  160. package/docs/rules/require-description-complete-sentence.md +0 -820
  161. package/docs/rules/require-description.md +0 -585
  162. package/docs/rules/require-example.md +0 -390
  163. package/docs/rules/require-file-overview.md +0 -324
  164. package/docs/rules/require-hyphen-before-param-description.md +0 -281
  165. package/docs/rules/require-jsdoc.md +0 -1857
  166. package/docs/rules/require-param-description.md +0 -238
  167. package/docs/rules/require-param-name.md +0 -163
  168. package/docs/rules/require-param-type.md +0 -227
  169. package/docs/rules/require-param.md +0 -1820
  170. package/docs/rules/require-property-description.md +0 -88
  171. package/docs/rules/require-property-name.md +0 -79
  172. package/docs/rules/require-property-type.md +0 -79
  173. package/docs/rules/require-property.md +0 -128
  174. package/docs/rules/require-returns-check.md +0 -1053
  175. package/docs/rules/require-returns-description.md +0 -181
  176. package/docs/rules/require-returns-type.md +0 -144
  177. package/docs/rules/require-returns.md +0 -1191
  178. package/docs/rules/require-throws.md +0 -326
  179. package/docs/rules/require-yields-check.md +0 -544
  180. package/docs/rules/require-yields.md +0 -823
  181. package/docs/rules/sort-tags.md +0 -635
  182. package/docs/rules/tag-lines.md +0 -551
  183. package/docs/rules/text-escaping.md +0 -177
  184. package/docs/rules/valid-types.md +0 -881
  185. package/docs/settings.md +0 -362
  186. package/tsconfig-prod.json +0 -20
  187. package/tsconfig.json +0 -21
@@ -1,1035 +0,0 @@
1
- <a name="user-content-check-param-names"></a>
2
- <a name="check-param-names"></a>
3
- # <code>check-param-names</code>
4
-
5
- * [Fixer](#user-content-check-param-names-fixer)
6
- * [Destructuring](#user-content-check-param-names-destructuring)
7
- * [Options](#user-content-check-param-names-options)
8
- * [`checkRestProperty`](#user-content-check-param-names-options-checkrestproperty)
9
- * [`checkTypesPattern`](#user-content-check-param-names-options-checktypespattern)
10
- * [`enableFixer`](#user-content-check-param-names-options-enablefixer)
11
- * [`allowExtraTrailingParamDocs`](#user-content-check-param-names-options-allowextratrailingparamdocs)
12
- * [`checkDestructured`](#user-content-check-param-names-options-checkdestructured)
13
- * [`useDefaultObjectProperties`](#user-content-check-param-names-options-usedefaultobjectproperties)
14
- * [`disableExtraPropertyReporting`](#user-content-check-param-names-options-disableextrapropertyreporting)
15
- * [Context and settings](#user-content-check-param-names-context-and-settings)
16
- * [Failing examples](#user-content-check-param-names-failing-examples)
17
- * [Passing examples](#user-content-check-param-names-passing-examples)
18
-
19
-
20
- Ensures that parameter names in JSDoc are matched by corresponding items in
21
- the function declaration.
22
-
23
- <a name="user-content-check-param-names-fixer"></a>
24
- <a name="check-param-names-fixer"></a>
25
- ## Fixer
26
-
27
- (Todo)
28
-
29
- <a name="user-content-check-param-names-destructuring"></a>
30
- <a name="check-param-names-destructuring"></a>
31
- ## Destructuring
32
-
33
- Note that by default the rule will not report parameters present on the docs
34
- but non-existing on the function signature when an object rest property is part
35
- of that function signature since the seemingly non-existing properties might
36
- actually be a part of the object rest property.
37
-
38
- ```js
39
- /**
40
- * @param options
41
- * @param options.foo
42
- */
43
- function quux ({foo, ...extra}) {}
44
- ```
45
-
46
- To require that `extra` be documented--and that any extraneous properties
47
- get reported--e.g., if there had been a `@param options.bar` above--you
48
- can use the `checkRestProperty` option which insists that the rest
49
- property be documented (and that there be no other implicit properties).
50
- Note, however, that jsdoc [does not appear](https://github.com/jsdoc/jsdoc/issues/1773)
51
- to currently support syntax or output to distinguish rest properties from
52
- other properties, so in looking at the docs alone without looking at the
53
- function signature, the disadvantage of enabling this option is that it
54
- may appear that there is an actual property named `extra`.
55
-
56
- <a name="user-content-check-param-names-options"></a>
57
- <a name="check-param-names-options"></a>
58
- ## Options
59
-
60
- <a name="user-content-check-param-names-options-checkrestproperty"></a>
61
- <a name="check-param-names-options-checkrestproperty"></a>
62
- ### <code>checkRestProperty</code>
63
-
64
- See the "Destructuring" section. Defaults to `false`.
65
-
66
- <a name="user-content-check-param-names-options-checktypespattern"></a>
67
- <a name="check-param-names-options-checktypespattern"></a>
68
- ### <code>checkTypesPattern</code>
69
-
70
- See `require-param` under the option of the same name.
71
-
72
- <a name="user-content-check-param-names-options-enablefixer"></a>
73
- <a name="check-param-names-options-enablefixer"></a>
74
- ### <code>enableFixer</code>
75
-
76
- Set to `true` to auto-remove `@param` duplicates (based on identical
77
- names).
78
-
79
- Note that this option will remove duplicates of the same name even if
80
- the definitions do not match in other ways (e.g., the second param will
81
- be removed even if it has a different type or description).
82
-
83
- <a name="user-content-check-param-names-options-allowextratrailingparamdocs"></a>
84
- <a name="check-param-names-options-allowextratrailingparamdocs"></a>
85
- ### <code>allowExtraTrailingParamDocs</code>
86
-
87
- If set to `true`, this option will allow extra `@param` definitions (e.g.,
88
- representing future expected or virtual params) to be present without needing
89
- their presence within the function signature. Other inconsistencies between
90
- `@param`'s and present function parameters will still be reported.
91
-
92
- <a name="user-content-check-param-names-options-checkdestructured"></a>
93
- <a name="check-param-names-options-checkdestructured"></a>
94
- ### <code>checkDestructured</code>
95
-
96
- Whether to check destructured properties. Defaults to `true`.
97
-
98
- <a name="user-content-check-param-names-options-usedefaultobjectproperties"></a>
99
- <a name="check-param-names-options-usedefaultobjectproperties"></a>
100
- ### <code>useDefaultObjectProperties</code>
101
-
102
- Set to `true` if you wish to avoid reporting of child property documentation
103
- where instead of destructuring, a whole plain object is supplied as default
104
- value but you wish its keys to be considered as signalling that the properties
105
- are present and can therefore be documented. Defaults to `false`.
106
-
107
- <a name="user-content-check-param-names-options-disableextrapropertyreporting"></a>
108
- <a name="check-param-names-options-disableextrapropertyreporting"></a>
109
- ### <code>disableExtraPropertyReporting</code>
110
-
111
- Whether to check for extra destructured properties. Defaults to `false`. Change
112
- to `true` if you want to be able to document properties which are not actually
113
- destructured. Keep as `false` if you expect properties to be documented in
114
- their own types. Note that extra properties will always be reported if another
115
- item at the same level is destructured as destructuring will prevent other
116
- access and this option is only intended to permit documenting extra properties
117
- that are available and actually used in the function.
118
-
119
- <a name="user-content-check-param-names-context-and-settings"></a>
120
- <a name="check-param-names-context-and-settings"></a>
121
- ## Context and settings
122
-
123
- |||
124
- |---|---|
125
- |Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`|
126
- |Options|`allowExtraTrailingParamDocs`, `checkDestructured`, `checkRestProperty`, `checkTypesPattern`, `disableExtraPropertyReporting`, `enableFixer`, `useDefaultObjectProperties`|
127
- |Tags|`param`|
128
- |Aliases|`arg`, `argument`|
129
- |Recommended|true|
130
-
131
- <a name="user-content-check-param-names-failing-examples"></a>
132
- <a name="check-param-names-failing-examples"></a>
133
- ## Failing examples
134
-
135
- The following patterns are considered problems:
136
-
137
- ````js
138
- /**
139
- * @param Foo
140
- */
141
- function quux (foo = 'FOO') {
142
-
143
- }
144
- // Message: Expected @param names to be "foo". Got "Foo".
145
-
146
- /**
147
- * @arg Foo
148
- */
149
- function quux (foo = 'FOO') {
150
-
151
- }
152
- // Settings: {"jsdoc":{"tagNamePreference":{"param":"arg"}}}
153
- // Message: Expected @arg names to be "foo". Got "Foo".
154
-
155
- /**
156
- * @param Foo
157
- */
158
- function quux (foo) {
159
-
160
- }
161
- // Message: Expected @param names to be "foo". Got "Foo".
162
-
163
- /**
164
- * @param Foo.Bar
165
- */
166
- function quux (foo) {
167
-
168
- }
169
- // Message: @param path declaration ("Foo.Bar") appears before any real parameter.
170
-
171
- /**
172
- * @param foo
173
- * @param Foo.Bar
174
- */
175
- function quux (foo) {
176
-
177
- }
178
- // Message: @param path declaration ("Foo.Bar") root node name ("Foo") does not match previous real parameter name ("foo").
179
-
180
- /**
181
- * Assign the project to a list of employees.
182
- * @param {string} employees[].name - The name of an employee.
183
- * @param {string} employees[].department - The employee's department.
184
- */
185
- function assign (employees) {
186
-
187
- };
188
- // Message: @param path declaration ("employees[].name") appears before any real parameter.
189
-
190
- /**
191
- * Assign the project to a list of employees.
192
- * @param {string} employees[].name - The name of an employee.
193
- * @param {string} employees[].name - The employee's department.
194
- */
195
- function assign (employees) {
196
-
197
- };
198
- // "jsdoc/check-param-names": ["error"|"warn", {"enableFixer":true}]
199
- // Message: Duplicate @param "employees[].name"
200
-
201
- /**
202
- * @param foo
203
- * @param foo.bar
204
- * @param bar
205
- */
206
- function quux (bar, foo) {
207
-
208
- }
209
- // Message: Expected @param names to be "bar, foo". Got "foo, bar".
210
-
211
- /**
212
- * @param foo
213
- * @param bar
214
- */
215
- function quux (foo) {
216
-
217
- }
218
- // Message: @param "bar" does not match an existing function parameter.
219
-
220
- /**
221
- * @param foo
222
- * @param foo
223
- */
224
- function quux (foo) {
225
-
226
- }
227
- // "jsdoc/check-param-names": ["error"|"warn", {"enableFixer":true}]
228
- // Message: Duplicate @param "foo"
229
-
230
- class bar {
231
- /**
232
- * @param foo
233
- * @param foo
234
- */
235
- quux (foo) {
236
-
237
- }
238
- }
239
- // "jsdoc/check-param-names": ["error"|"warn", {"enableFixer":true}]
240
- // Message: Duplicate @param "foo"
241
-
242
- /**
243
- * @param foo
244
- * @param foo
245
- */
246
- function quux (foo, bar) {
247
-
248
- }
249
- // "jsdoc/check-param-names": ["error"|"warn", {"enableFixer":true}]
250
- // Message: Duplicate @param "foo"
251
-
252
- /**
253
- * @param foo
254
- * @param foo
255
- */
256
- function quux (foo, foo) {
257
-
258
- }
259
- // "jsdoc/check-param-names": ["error"|"warn", {"enableFixer":true}]
260
- // Message: Duplicate @param "foo"
261
-
262
- /**
263
- * @param cfg
264
- * @param cfg.foo
265
- * @param cfg.foo
266
- */
267
- function quux ({foo}) {
268
-
269
- }
270
- // "jsdoc/check-param-names": ["error"|"warn", {"enableFixer":true}]
271
- // Message: Duplicate @param "cfg.foo"
272
-
273
- /**
274
- * @param cfg
275
- * @param cfg.foo
276
- * @param cfg.foo
277
- */
278
- function quux ({foo}) {
279
-
280
- }
281
- // Message: Duplicate @param "cfg.foo"
282
-
283
- /**
284
- * @param cfg
285
- * @param cfg.foo
286
- */
287
- function quux ({foo, bar}) {
288
-
289
- }
290
- // Message: Missing @param "cfg.bar"
291
-
292
- /**
293
- * @param cfg
294
- * @param cfg.foo
295
- * @param [cfg.foo]
296
- * @param baz
297
- */
298
- function quux ({foo}, baz) {
299
-
300
- }
301
- // "jsdoc/check-param-names": ["error"|"warn", {"enableFixer":true}]
302
- // Message: Duplicate @param "cfg.foo"
303
-
304
- /**
305
- * @param cfg
306
- * @param cfg.foo
307
- * @param [cfg.foo="with a default"]
308
- * @param baz
309
- */
310
- function quux ({foo, bar}, baz) {
311
-
312
- }
313
- // Message: Missing @param "cfg.bar"
314
-
315
- /**
316
- * @param cfg
317
- * @param cfg.foo
318
- * @param [cfg.foo="with a default"]
319
- * @param baz
320
- */
321
- function quux ({foo}, baz) {
322
-
323
- }
324
- // "jsdoc/check-param-names": ["error"|"warn", {"enableFixer":true}]
325
- // Message: Duplicate @param "cfg.foo"
326
-
327
- /**
328
- * @param cfg
329
- * @param [cfg.foo="with a default"]
330
- * @param baz
331
- */
332
- function quux ({foo, bar}, baz) {
333
-
334
- }
335
- // Message: Missing @param "cfg.bar"
336
-
337
- /**
338
- * @param args
339
- */
340
- function quux ({a, b}) {
341
-
342
- }
343
- // Message: Missing @param "args.a"
344
-
345
- /**
346
- * @param args
347
- */
348
- function quux ({a, b} = {}) {
349
-
350
- }
351
- // Message: Missing @param "args.a"
352
-
353
- export class SomeClass {
354
- /**
355
- * @param prop
356
- */
357
- constructor(private property: string) {}
358
- }
359
- // Message: Expected @param names to be "property". Got "prop".
360
-
361
- export class SomeClass {
362
- /**
363
- * @param prop
364
- * @param prop.foo
365
- */
366
- constructor(prop: { foo: string, bar: string }) {}
367
- }
368
- // Message: Missing @param "prop.bar"
369
-
370
- export class SomeClass {
371
- /**
372
- * @param prop
373
- * @param prop.foo
374
- * @param prop.bar
375
- */
376
- constructor(options: { foo: string, bar: string }) {}
377
- }
378
- // Message: @param "prop" does not match parameter name "options"
379
-
380
- export class SomeClass {
381
- /**
382
- * @param options
383
- * @param options.foo
384
- * @param options.bar
385
- */
386
- constructor(options: { foo: string }) {}
387
- }
388
- // Message: @param "options.bar" does not exist on options
389
-
390
- /**
391
- * @param foo
392
- */
393
- function quux (foo) {
394
-
395
- }
396
- // Settings: {"jsdoc":{"tagNamePreference":{"param":false}}}
397
- // Message: Unexpected tag `@param`
398
-
399
- /**
400
- * @param {Error} error Exit code
401
- * @param {number} [code = 1] Exit code
402
- */
403
- function quux (error, cde = 1) {
404
- };
405
- // Message: Expected @param names to be "error, cde". Got "error, code".
406
-
407
- /**
408
- * @param foo
409
- */
410
- function quux ([a, b] = []) {
411
-
412
- }
413
- // Message: Missing @param "foo."0""
414
-
415
- /**
416
- * @param options
417
- * @param options.foo
418
- */
419
- function quux ({foo, ...extra}) {
420
- }
421
- // "jsdoc/check-param-names": ["error"|"warn", {"checkRestProperty":true}]
422
- // Message: Missing @param "options.extra"
423
-
424
- /**
425
- * @param cfg
426
- * @param cfg.foo
427
- * @param cfg.bar
428
- * @param cfg.extra
429
- */
430
- function quux ({foo, ...extra}) {
431
-
432
- }
433
- // "jsdoc/check-param-names": ["error"|"warn", {"checkRestProperty":true}]
434
- // Message: @param "cfg.bar" does not exist on cfg
435
-
436
- /**
437
- * Converts an SVGRect into an object.
438
- * @param {SVGRect} bbox - a SVGRect
439
- */
440
- const bboxToObj = function ({x, y, width, height}) {
441
- return {x, y, width, height};
442
- };
443
- // "jsdoc/check-param-names": ["error"|"warn", {"checkTypesPattern":"SVGRect"}]
444
- // Message: Missing @param "bbox.x"
445
-
446
- /**
447
- * Converts an SVGRect into an object.
448
- * @param {object} bbox - a SVGRect
449
- */
450
- const bboxToObj = function ({x, y, width, height}) {
451
- return {x, y, width, height};
452
- };
453
- // Message: Missing @param "bbox.x"
454
-
455
- module.exports = class GraphQL {
456
- /**
457
- * @param fetchOptions
458
- * @param cacheKey
459
- */
460
- fetch = ({ url, ...options }, cacheKey) => {
461
- }
462
- };
463
- // "jsdoc/check-param-names": ["error"|"warn", {"checkRestProperty":true}]
464
- // Message: Missing @param "fetchOptions.url"
465
-
466
- /**
467
- * Testing
468
- *
469
- * @param options
470
- * @param options.one One
471
- * @param options.two Two
472
- * @param options.four Four
473
- */
474
- function testingEslint(options: {
475
- one: string;
476
- two: string;
477
- three: string;
478
- }): string {
479
- return one + two + three;
480
- }
481
- // Message: Missing @param "options.three"
482
-
483
- /**
484
- *
485
- */
486
- function quux() {
487
-
488
- }
489
- // Settings: {"jsdoc":{"structuredTags":{"see":{"name":false,"required":["name"]}}}}
490
- // Message: Cannot add "name" to `require` with the tag's `name` set to `false`
491
-
492
- /**
493
- * @param root
494
- * @param foo
495
- */
496
- function quux ({foo, bar}, baz) {
497
-
498
- }
499
- // "jsdoc/check-param-names": ["error"|"warn", {"checkDestructured":false}]
500
- // Message: Expected @param names to be "root, baz". Got "root, foo".
501
-
502
- /**
503
- * Description.
504
- * @param {Object} options
505
- * @param {FooBar} foo
506
- */
507
- function quux ({ foo: { bar } }) {}
508
- // Message: Missing @param "options.foo"
509
-
510
- /**
511
- * Description.
512
- * @param {Object} options
513
- * @param options.foo
514
- */
515
- function quux ({ foo: { bar } }) {}
516
- // Message: Missing @param "options.foo.bar"
517
-
518
- /**
519
- * Description.
520
- * @param {object} options Options.
521
- * @param {object} options.foo A description.
522
- * @param {object} options.foo.bar
523
- */
524
- function foo({ foo: { bar: { baz } }}) {}
525
- // Message: Missing @param "options.foo.bar.baz"
526
-
527
- /**
528
- * Returns a number.
529
- * @param {Object} props Props.
530
- * @param {Object} props.prop Prop.
531
- * @param {string} props.prop.a String.
532
- * @param {string} props.prop.b String.
533
- * @return {number} A number.
534
- */
535
- export function testFn1 ({ prop = { a: 1, b: 2 } }) {
536
- }
537
- // "jsdoc/check-param-names": ["error"|"warn", {"useDefaultObjectProperties":false}]
538
- // Message: @param "props.prop.a" does not exist on props
539
-
540
- /**
541
- * @param {object} cfg
542
- * @param {string} cfg.foo
543
- * @param {string} cfg.bar
544
- * @param {object} cfg.extra
545
- */
546
- function quux ({foo}) {
547
-
548
- }
549
- // Message: @param "cfg.bar" does not exist on cfg
550
-
551
- /**
552
- * @param {object} cfg
553
- * @param {string} cfg.foo
554
- * @param {string} cfg.bar
555
- * @param {object} cfg.extra
556
- */
557
- function quux ({foo}) {
558
-
559
- }
560
- // "jsdoc/check-param-names": ["error"|"warn", {"disableExtraPropertyReporting":true}]
561
- // Message: @param "cfg.bar" does not exist on cfg
562
-
563
- /**
564
- * @param {object} root
565
- * @param {object} root.cfg
566
- * @param {object} root.cfg.a
567
- * @param {string} root.cfg.a.foo
568
- * @param {string} root.cfg.a.bar
569
- * @param {object} root.cfg.a.extra
570
- */
571
- function quux ({cfg: {a: {foo}}}) {
572
-
573
- }
574
- // Message: @param "root.cfg.a.bar" does not exist on root
575
-
576
- /**
577
- * @param {object} root
578
- * @param {object} root.cfg
579
- * @param {object} root.cfg.a
580
- * @param {string} root.cfg.a.foo
581
- * @param {string} root.cfg.a.bar
582
- * @param {object} root.cfg.a.extra
583
- */
584
- function quux ({cfg: {a: {foo}}}) {
585
-
586
- }
587
- // "jsdoc/check-param-names": ["error"|"warn", {"disableExtraPropertyReporting":true}]
588
- // Message: @param "root.cfg.a.bar" does not exist on root
589
-
590
- /**
591
- * @param {object} root
592
- * @param {object} root.cfg
593
- * @param {string} root.cfg.foo
594
- * @param {string} root.cfg.bar
595
- * @param {object} root.cfg.extra
596
- */
597
- function quux ({cfg}) {
598
-
599
- }
600
- // Message: @param "root.cfg.foo" does not exist on root
601
-
602
- /**
603
- * @param foo
604
- * @param foo
605
- * on another line
606
- */
607
- function quux (foo) {
608
-
609
- }
610
- // "jsdoc/check-param-names": ["error"|"warn", {"enableFixer":true}]
611
- // Message: Duplicate @param "foo"
612
-
613
- /**
614
- * @param barr This is the description of bar. Oops, we misspelled "bar" as "barr".
615
- */
616
- declare function foo(bar: number) {}
617
- // Message: Expected @param names to be "bar". Got "barr".
618
- ````
619
-
620
-
621
-
622
- <a name="user-content-check-param-names-passing-examples"></a>
623
- <a name="check-param-names-passing-examples"></a>
624
- ## Passing examples
625
-
626
- The following patterns are not considered problems:
627
-
628
- ````js
629
- /**
630
- *
631
- */
632
- function quux (foo) {
633
-
634
- }
635
-
636
- /**
637
- * @param foo
638
- */
639
- function quux (foo) {
640
-
641
- }
642
-
643
- /**
644
- * @param foo
645
- * @param bar
646
- */
647
- function quux (foo, bar) {
648
-
649
- }
650
-
651
- /**
652
- * @param foo
653
- * @param bar
654
- */
655
- function quux (foo, bar, baz) {
656
-
657
- }
658
-
659
- /**
660
- * @param foo
661
- * @param foo.foo
662
- * @param bar
663
- */
664
- function quux (foo, bar) {
665
-
666
- }
667
-
668
- /**
669
- * @param args
670
- */
671
- function quux (...args) {
672
-
673
- }
674
-
675
- /**
676
- * @param foo
677
- * @param foo.a
678
- * @param foo.b
679
- */
680
- function quux ({a, b}) {
681
-
682
- }
683
-
684
- /**
685
- * @param foo
686
- * @param foo.a
687
- * @param foo.b
688
- */
689
- function quux ({"a": A, b}) {
690
-
691
- }
692
-
693
- /**
694
- * @param foo
695
- * @param foo."a"
696
- * @param foo.b
697
- */
698
- function quux ({a: A, b}) {
699
-
700
- }
701
-
702
- /**
703
- * @param foo
704
- * @param foo."a-b"
705
- * @param foo.b
706
- */
707
- function quux ({"a-b": A, b}) {
708
-
709
- }
710
-
711
- /**
712
- * @param foo
713
- * @param foo.bar
714
- * @param foo.baz
715
- * @param bar
716
- */
717
- function quux (foo, bar) {
718
-
719
- }
720
-
721
- /**
722
- * Assign the project to a list of employees.
723
- * @param {object[]} employees - The employees who are responsible for the project.
724
- * @param {string} employees[].name - The name of an employee.
725
- * @param {string} employees[].department - The employee's department.
726
- */
727
- function assign (employees) {
728
-
729
- };
730
-
731
- export class SomeClass {
732
- /**
733
- * @param property
734
- */
735
- constructor(private property: string) {}
736
- }
737
-
738
- export class SomeClass {
739
- /**
740
- * @param options
741
- * @param options.foo
742
- * @param options.bar
743
- */
744
- constructor(options: { foo: string, bar: string }) {}
745
- }
746
-
747
- export class SomeClass {
748
- /**
749
- * @param options
750
- * @param options.foo
751
- * @param options.bar
752
- */
753
- constructor({ foo, bar }: { foo: string, bar: string }) {}
754
- }
755
-
756
- export class SomeClass {
757
- /**
758
- * @param options
759
- * @param options.foo
760
- * @param options.bar
761
- */
762
- constructor({ foo, bar }: { foo: string, bar: string }) {}
763
- }
764
-
765
- /**
766
- * @param {Error} error Exit code
767
- * @param {number} [code = 1] Exit code
768
- */
769
- function quux (error, code = 1) {
770
- };
771
-
772
- /**
773
- * @param foo
774
- * @param bar
775
- */
776
- function quux (foo) {
777
-
778
- }
779
- // "jsdoc/check-param-names": ["error"|"warn", {"allowExtraTrailingParamDocs":true}]
780
-
781
- /**
782
- * @param cfg
783
- * @param cfg.foo
784
- * @param baz
785
- */
786
- function quux ({foo}, baz) {
787
-
788
- }
789
-
790
- /**
791
- * @param cfg
792
- * @param cfg.foo
793
- * @param cfg2
794
- */
795
- function quux ({foo}, cfg2) {
796
-
797
- }
798
-
799
- /**
800
- * @param cfg
801
- * @param cfg.foo
802
- * @param baz
803
- * @param baz.cfg
804
- */
805
- function quux ({foo}, {cfg}) {
806
-
807
- }
808
-
809
- /**
810
- * @param options
811
- * @param options.foo
812
- */
813
- function quux ({foo, ...extra}) {
814
- }
815
-
816
- /**
817
- * @param foo
818
- * @param bar
819
- */
820
- function quux (foo, bar, ...extra) {
821
-
822
- }
823
-
824
- /**
825
- * Converts an SVGRect into an object.
826
- * @param {SVGRect} bbox - a SVGRect
827
- */
828
- const bboxToObj = function ({x, y, width, height}) {
829
- return {x, y, width, height};
830
- };
831
-
832
- /**
833
- * Converts an SVGRect into an object.
834
- * @param {SVGRect} bbox - a SVGRect
835
- */
836
- const bboxToObj = function ({x, y, width, height}) {
837
- return {x, y, width, height};
838
- };
839
-
840
- /**
841
- * Converts an SVGRect into an object.
842
- * @param {object} bbox - a SVGRect
843
- */
844
- const bboxToObj = function ({x, y, width, height}) {
845
- return {x, y, width, height};
846
- };
847
- // "jsdoc/check-param-names": ["error"|"warn", {"checkTypesPattern":"SVGRect"}]
848
-
849
- class CSS {
850
- /**
851
- * Set one or more CSS properties for the set of matched elements.
852
- *
853
- * @param {Object} propertyObject - An object of property-value pairs to set.
854
- */
855
- setCssObject(propertyObject: {[key: string]: string | number}): void {
856
- }
857
- }
858
-
859
- /**
860
- * Logs a string.
861
- *
862
- * @param input - String to output.
863
- */
864
- export default function (input: {
865
- [foo: string]: { a: string; b: string };
866
- }): void {
867
- input;
868
- }
869
-
870
- export class Thing {
871
- foo: any;
872
-
873
- /**
874
- * @param {} C
875
- */
876
- constructor(C: { new (): any }) {
877
- this.foo = new C();
878
- }
879
- }
880
-
881
- /**
882
- * @param foo
883
- * @param root
884
- */
885
- function quux (foo, {bar}) {
886
-
887
- }
888
- // "jsdoc/check-param-names": ["error"|"warn", {"checkDestructured":false}]
889
-
890
- class A {
891
- /**
892
- * Show a prompt.
893
- * @param hideButton true if button should be hidden, false otherwise
894
- * @param onHidden delegate to call when the prompt is hidden
895
- */
896
- public async showPrompt(hideButton: boolean, onHidden: {(): void}): Promise<void>
897
- {
898
- }
899
- }
900
-
901
- /**
902
- * Description.
903
- * @param {Object} options Options.
904
- * @param {FooBar} options.foo foo description.
905
- */
906
- function quux ({ foo: { bar }}) {}
907
-
908
- /**
909
- * Description.
910
- * @param {FooBar} options
911
- * @param {Object} options.foo
912
- */
913
- function quux ({ foo: { bar } }) {}
914
- // "jsdoc/check-param-names": ["error"|"warn", {"checkTypesPattern":"FooBar"}]
915
-
916
- /**
917
- * Description.
918
- * @param {Object} options
919
- * @param {FooBar} options.foo
920
- * @param {FooBar} options.baz
921
- */
922
- function quux ({ foo: { bar }, baz: { cfg } }) {}
923
-
924
- /**
925
- * Item
926
- *
927
- * @param {object} props
928
- * @param {object} props.data - case data
929
- * @param {string} props.data.className - additional css class
930
- * @param props.val
931
- */
932
- export default function Item({
933
- data: {
934
- className,
935
- } = {},
936
- val = 4
937
- }) {
938
- }
939
-
940
- /**
941
- * @param obj
942
- * @param obj.data
943
- * @param obj.data."0"
944
- * @param obj.data."1"
945
- * @param obj.data."2"
946
- * @param obj.defaulting
947
- * @param obj.defaulting."0"
948
- * @param obj.defaulting."1"
949
- */
950
- function Item({
951
- data: [foo, bar, ...baz],
952
- defaulting: [quux, xyz] = []
953
- }) {
954
- }
955
-
956
- /**
957
- * Returns a number.
958
- * @param {Object} props Props.
959
- * @param {Object} props.prop Prop.
960
- * @param {string} props.prop.a String.
961
- * @param {string} props.prop.b String.
962
- * @return {number} A number.
963
- */
964
- export function testFn1 ({ prop = { a: 1, b: 2 } }) {
965
- }
966
- // "jsdoc/check-param-names": ["error"|"warn", {"useDefaultObjectProperties":true}]
967
-
968
- /**
969
- * @param {object} root
970
- * @param {object} root.cfg
971
- * @param {string} root.cfg.foo
972
- * @param {string} root.cfg.bar
973
- * @param {object} root.cfg.extra
974
- */
975
- function quux ({cfg}) {
976
-
977
- }
978
- // "jsdoc/check-param-names": ["error"|"warn", {"disableExtraPropertyReporting":true}]
979
-
980
- class A {
981
- /**
982
- * @param cfg
983
- * @param cfg.abc
984
- */
985
- constructor({
986
- [new.target.prop]: cX,
987
- abc
988
- }) {
989
- }
990
- }
991
-
992
- /**
993
- * @param root
994
- * @param root."0" Ignored
995
- * @param root."1" Our "b"
996
- */
997
- const foo = ([, b]) => b;
998
-
999
- /**
1000
- * @param arg1 This is the description for arg1.
1001
- */
1002
- function foo(this: void, arg1: number): void;
1003
-
1004
- declare global {
1005
- /**
1006
- * @param arg1 This is the number for foo.
1007
- */
1008
- function foo(this: void, arg1: number): void;
1009
- }
1010
-
1011
- declare global {
1012
- /**
1013
- * @param r Range is 0-1.
1014
- * @param g Range is 0-1.
1015
- * @param b Range is 0-1.
1016
- */
1017
- function Color(
1018
- this: void,
1019
- r: float,
1020
- g: float,
1021
- b: float,
1022
- ): Color;
1023
- }
1024
-
1025
- /**
1026
- * @param this desc
1027
- * @param bar number to return
1028
- * @returns number returned back to caller
1029
- */
1030
- function foo(this: T, bar: number): number {
1031
- console.log(this.name);
1032
- return bar;
1033
- }
1034
- ````
1035
-