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,238 +0,0 @@
1
- <a name="user-content-require-param-description"></a>
2
- <a name="require-param-description"></a>
3
- # <code>require-param-description</code>
4
-
5
- * [Options](#user-content-require-param-description-options)
6
- * [`setDefaultDestructuredRootDescription`](#user-content-require-param-description-options-setdefaultdestructuredrootdescription)
7
- * [`defaultDestructuredRootDescription`](#user-content-require-param-description-options-defaultdestructuredrootdescription)
8
- * [`contexts`](#user-content-require-param-description-options-contexts)
9
- * [Context and settings](#user-content-require-param-description-context-and-settings)
10
- * [Failing examples](#user-content-require-param-description-failing-examples)
11
- * [Passing examples](#user-content-require-param-description-passing-examples)
12
-
13
-
14
- Requires that each `@param` tag has a `description` value.
15
-
16
- Will exempt destructured roots and their children if
17
- `settings.exemptDestructuredRootsFromChecks` is set to `true` (e.g.,
18
- `@param {object} props` will be exempted from requiring a description given
19
- `function someFunc ({child1, child2})`).
20
-
21
- <a name="user-content-require-param-description-options"></a>
22
- <a name="require-param-description-options"></a>
23
- ## Options
24
-
25
- <a name="user-content-require-param-description-options-setdefaultdestructuredrootdescription"></a>
26
- <a name="require-param-description-options-setdefaultdestructuredrootdescription"></a>
27
- ### <code>setDefaultDestructuredRootDescription</code>
28
-
29
- Whether to set a default destructured root description. For example, you may
30
- wish to avoid manually having to set the description for a `@param`
31
- corresponding to a destructured root object as it should always be the same
32
- type of object. Uses `defaultDestructuredRootDescription` for the description
33
- string. Defaults to `false`.
34
-
35
- <a name="user-content-require-param-description-options-defaultdestructuredrootdescription"></a>
36
- <a name="require-param-description-options-defaultdestructuredrootdescription"></a>
37
- ### <code>defaultDestructuredRootDescription</code>
38
-
39
- The description string to set by default for destructured roots. Defaults to
40
- "The root object".
41
-
42
- <a name="user-content-require-param-description-options-contexts"></a>
43
- <a name="require-param-description-options-contexts"></a>
44
- ### <code>contexts</code>
45
-
46
- Set this to an array of strings representing the AST context (or an object with
47
- `context` and `comment` properties) where you wish the rule to be applied.
48
- Overrides the default contexts (see below). Set to `"any"` if you want
49
- the rule to apply to any jsdoc block throughout your files (as is necessary
50
- for finding function blocks not attached to a function declaration or
51
- expression, i.e., `@callback` or `@function` (or its aliases `@func` or
52
- `@method`) (including those associated with an `@interface`).
53
-
54
- See the ["AST and Selectors"](#user-content-eslint-plugin-jsdoc-advanced-ast-and-selectors)
55
- section of our README for more on the expected format.
56
-
57
- <a name="user-content-require-param-description-context-and-settings"></a>
58
- <a name="require-param-description-context-and-settings"></a>
59
- ## Context and settings
60
-
61
- |||
62
- |---|---|
63
- |Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled|
64
- |Tags|`param`|
65
- |Aliases|`arg`, `argument`|
66
- |Recommended|true|
67
- |Options|`contexts`, `defaultDestructuredRootDescription`, `setDefaultDestructuredRootDescription`|
68
- |Settings|`exemptDestructuredRootsFromChecks`|
69
-
70
- <a name="user-content-require-param-description-failing-examples"></a>
71
- <a name="require-param-description-failing-examples"></a>
72
- ## Failing examples
73
-
74
- The following patterns are considered problems:
75
-
76
- ````js
77
- /**
78
- * @param foo
79
- */
80
- function quux (foo) {
81
-
82
- }
83
- // Message: Missing JSDoc @param "foo" description.
84
-
85
- /**
86
- * @param foo
87
- */
88
- function quux (foo) {
89
-
90
- }
91
- // "jsdoc/require-param-description": ["error"|"warn", {"contexts":["any"]}]
92
- // Message: Missing JSDoc @param "foo" description.
93
-
94
- /**
95
- * @function
96
- * @param foo
97
- */
98
- // "jsdoc/require-param-description": ["error"|"warn", {"contexts":["any"]}]
99
- // Message: Missing JSDoc @param "foo" description.
100
-
101
- /**
102
- * @callback
103
- * @param foo
104
- */
105
- // "jsdoc/require-param-description": ["error"|"warn", {"contexts":["any"]}]
106
- // Message: Missing JSDoc @param "foo" description.
107
-
108
- /**
109
- * @arg foo
110
- */
111
- function quux (foo) {
112
-
113
- }
114
- // Settings: {"jsdoc":{"tagNamePreference":{"param":"arg"}}}
115
- // Message: Missing JSDoc @arg "foo" description.
116
-
117
- /**
118
- * @param foo
119
- */
120
- function quux (foo) {
121
-
122
- }
123
- // Settings: {"jsdoc":{"tagNamePreference":{"param":false}}}
124
- // Message: Unexpected tag `@param`
125
-
126
- /**
127
- * @param foo
128
- */
129
- function quux (foo) {
130
-
131
- }
132
- // "jsdoc/require-param-description": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock:has(JsdocTag:not([name=props]))","context":"FunctionDeclaration"}]}]
133
- // Message: Missing JSDoc @param "foo" description.
134
-
135
- /**
136
- * @param {number} foo Foo description
137
- * @param {object} root
138
- * @param {boolean} baz Baz description
139
- */
140
- function quux (foo, {bar}, baz) {
141
-
142
- }
143
- // "jsdoc/require-param-description": ["error"|"warn", {"setDefaultDestructuredRootDescription":true}]
144
- // Message: Missing root description for @param.
145
-
146
- /**
147
- * @param {number} foo Foo description
148
- * @param {object} root
149
- * @param {boolean} baz Baz description
150
- */
151
- function quux (foo, {bar}, baz) {
152
-
153
- }
154
- // "jsdoc/require-param-description": ["error"|"warn", {"defaultDestructuredRootDescription":"Root description","setDefaultDestructuredRootDescription":true}]
155
- // Message: Missing root description for @param.
156
-
157
- /**
158
- * @param {number} foo Foo description
159
- * @param {object} root
160
- * @param {boolean} baz Baz description
161
- */
162
- function quux (foo, {bar}, baz) {
163
-
164
- }
165
- // "jsdoc/require-param-description": ["error"|"warn", {"setDefaultDestructuredRootDescription":false}]
166
- // Message: Missing JSDoc @param "root" description.
167
- ````
168
-
169
-
170
-
171
- <a name="user-content-require-param-description-passing-examples"></a>
172
- <a name="require-param-description-passing-examples"></a>
173
- ## Passing examples
174
-
175
- The following patterns are not considered problems:
176
-
177
- ````js
178
- /**
179
- *
180
- */
181
- function quux (foo) {
182
-
183
- }
184
-
185
- /**
186
- * @param foo Foo.
187
- */
188
- function quux (foo) {
189
-
190
- }
191
-
192
- /**
193
- * @param foo Foo.
194
- */
195
- function quux (foo) {
196
-
197
- }
198
- // "jsdoc/require-param-description": ["error"|"warn", {"contexts":["any"]}]
199
-
200
- /**
201
- * @function
202
- * @param foo
203
- */
204
-
205
- /**
206
- * @callback
207
- * @param foo
208
- */
209
-
210
- /**
211
- * @param props
212
- */
213
- function quux (props) {
214
-
215
- }
216
- // "jsdoc/require-param-description": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock:has(JsdocTag:not([name=props]))","context":"FunctionDeclaration"}]}]
217
-
218
- /**
219
- * @param {number} foo Foo description
220
- * @param {object} root
221
- * @param {boolean} baz Baz description
222
- */
223
- function quux (foo, {bar}, baz) {
224
-
225
- }
226
- // Settings: {"jsdoc":{"exemptDestructuredRootsFromChecks":true}}
227
-
228
- /**
229
- * @param {number} foo Foo description
230
- * @param {object} root
231
- * @param {object} root.bar
232
- */
233
- function quux (foo, {bar: {baz}}) {
234
-
235
- }
236
- // Settings: {"jsdoc":{"exemptDestructuredRootsFromChecks":true}}
237
- ````
238
-
@@ -1,163 +0,0 @@
1
- <a name="user-content-require-param-name"></a>
2
- <a name="require-param-name"></a>
3
- # <code>require-param-name</code>
4
-
5
- * [Options](#user-content-require-param-name-options)
6
- * [`contexts`](#user-content-require-param-name-options-contexts)
7
- * [Context and settings](#user-content-require-param-name-context-and-settings)
8
- * [Failing examples](#user-content-require-param-name-failing-examples)
9
- * [Passing examples](#user-content-require-param-name-passing-examples)
10
-
11
-
12
- Requires that all `@param` tags have names.
13
-
14
- > The `@param` tag requires you to specify the name of the parameter you are documenting. You can also include the parameter's type, enclosed in curly brackets, and a description of the parameter.
15
- >
16
- > [JSDoc](https://jsdoc.app/tags-param.html#overview)
17
-
18
- <a name="user-content-require-param-name-options"></a>
19
- <a name="require-param-name-options"></a>
20
- ## Options
21
-
22
- <a name="user-content-require-param-name-options-contexts"></a>
23
- <a name="require-param-name-options-contexts"></a>
24
- ### <code>contexts</code>
25
-
26
- Set this to an array of strings representing the AST context (or an object with
27
- `context` and `comment` properties) where you wish the rule to be applied.
28
- Overrides the default contexts (see below). Set to `"any"` if you want
29
- the rule to apply to any jsdoc block throughout your files (as is necessary
30
- for finding function blocks not attached to a function declaration or
31
- expression, i.e., `@callback` or `@function` (or its aliases `@func` or
32
- `@method`) (including those associated with an `@interface`).
33
-
34
- See the ["AST and Selectors"](#user-content-eslint-plugin-jsdoc-advanced-ast-and-selectors)
35
- section of our README for more on the expected format.
36
-
37
- <a name="user-content-require-param-name-context-and-settings"></a>
38
- <a name="require-param-name-context-and-settings"></a>
39
- ## Context and settings
40
-
41
- |||
42
- |---|---|
43
- |Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled|
44
- |Tags|`param`|
45
- |Aliases|`arg`, `argument`|
46
- |Recommended|true|
47
- |Options|`contexts`|
48
-
49
- <a name="user-content-require-param-name-failing-examples"></a>
50
- <a name="require-param-name-failing-examples"></a>
51
- ## Failing examples
52
-
53
- The following patterns are considered problems:
54
-
55
- ````js
56
- /**
57
- * @param
58
- */
59
- function quux (foo) {
60
-
61
- }
62
- // Message: There must be an identifier after @param type.
63
-
64
- /**
65
- * @param {string}
66
- */
67
- function quux (foo) {
68
-
69
- }
70
- // Message: There must be an identifier after @param tag.
71
-
72
- /**
73
- * @param {string}
74
- */
75
- function quux (foo) {
76
-
77
- }
78
- // "jsdoc/require-param-name": ["error"|"warn", {"contexts":["any"]}]
79
- // Message: There must be an identifier after @param tag.
80
-
81
- /**
82
- * @function
83
- * @param {string}
84
- */
85
- // "jsdoc/require-param-name": ["error"|"warn", {"contexts":["any"]}]
86
- // Message: There must be an identifier after @param tag.
87
-
88
- /**
89
- * @callback
90
- * @param {string}
91
- */
92
- // "jsdoc/require-param-name": ["error"|"warn", {"contexts":["any"]}]
93
- // Message: There must be an identifier after @param tag.
94
-
95
- /**
96
- * @param foo
97
- */
98
- function quux (foo) {
99
-
100
- }
101
- // Settings: {"jsdoc":{"tagNamePreference":{"param":false}}}
102
- // Message: Unexpected tag `@param`
103
- ````
104
-
105
-
106
-
107
- <a name="user-content-require-param-name-passing-examples"></a>
108
- <a name="require-param-name-passing-examples"></a>
109
- ## Passing examples
110
-
111
- The following patterns are not considered problems:
112
-
113
- ````js
114
- /**
115
- * @param foo
116
- */
117
- function quux (foo) {
118
-
119
- }
120
-
121
- /**
122
- * @param foo
123
- */
124
- function quux (foo) {
125
-
126
- }
127
- // "jsdoc/require-param-name": ["error"|"warn", {"contexts":["any"]}]
128
-
129
- /**
130
- * @param {string} foo
131
- */
132
- function quux (foo) {
133
-
134
- }
135
-
136
- /**
137
- * @function
138
- * @param
139
- */
140
-
141
- /**
142
- * @callback
143
- * @param
144
- */
145
-
146
- /**
147
- * @param {Function} [processor=data => data] A function to run
148
- */
149
- function processData(processor) {
150
- return processor(data)
151
- }
152
-
153
- /** Example with multi-line param type.
154
- *
155
- * @param {function(
156
- * number
157
- * )} cb Callback.
158
- */
159
- function example(cb) {
160
- cb(42);
161
- }
162
- ````
163
-
@@ -1,227 +0,0 @@
1
- <a name="user-content-require-param-type"></a>
2
- <a name="require-param-type"></a>
3
- # <code>require-param-type</code>
4
-
5
- * [Options](#user-content-require-param-type-options)
6
- * [`setDefaultDestructuredRootType`](#user-content-require-param-type-options-setdefaultdestructuredroottype)
7
- * [`defaultDestructuredRootType`](#user-content-require-param-type-options-defaultdestructuredroottype)
8
- * [`contexts`](#user-content-require-param-type-options-contexts)
9
- * [Context and settings](#user-content-require-param-type-context-and-settings)
10
- * [Failing examples](#user-content-require-param-type-failing-examples)
11
- * [Passing examples](#user-content-require-param-type-passing-examples)
12
-
13
-
14
- Requires that each `@param` tag has a `type` value (within curly brackets).
15
-
16
- Will exempt destructured roots and their children if
17
- `settings.exemptDestructuredRootsFromChecks` is set to `true` (e.g.,
18
- `@param props` will be exempted from requiring a type given
19
- `function someFunc ({child1, child2})`).
20
-
21
- <a name="user-content-require-param-type-options"></a>
22
- <a name="require-param-type-options"></a>
23
- ## Options
24
-
25
- <a name="user-content-require-param-type-options-setdefaultdestructuredroottype"></a>
26
- <a name="require-param-type-options-setdefaultdestructuredroottype"></a>
27
- ### <code>setDefaultDestructuredRootType</code>
28
-
29
- Whether to set a default destructured root type. For example, you may wish
30
- to avoid manually having to set the type for a `@param`
31
- corresponding to a destructured root object as it is always going to be an
32
- object. Uses `defaultDestructuredRootType` for the type string. Defaults to
33
- `false`.
34
-
35
- <a name="user-content-require-param-type-options-defaultdestructuredroottype"></a>
36
- <a name="require-param-type-options-defaultdestructuredroottype"></a>
37
- ### <code>defaultDestructuredRootType</code>
38
-
39
- The type string to set by default for destructured roots. Defaults to "object".
40
-
41
- <a name="user-content-require-param-type-options-contexts"></a>
42
- <a name="require-param-type-options-contexts"></a>
43
- ### <code>contexts</code>
44
-
45
- Set this to an array of strings representing the AST context (or an object with
46
- `context` and `comment` properties) where you wish the rule to be applied.
47
- Overrides the default contexts (see below). Set to `"any"` if you want
48
- the rule to apply to any jsdoc block throughout your files (as is necessary
49
- for finding function blocks not attached to a function declaration or
50
- expression, i.e., `@callback` or `@function` (or its aliases `@func` or
51
- `@method`) (including those associated with an `@interface`).
52
-
53
- See the ["AST and Selectors"](#user-content-eslint-plugin-jsdoc-advanced-ast-and-selectors)
54
- section of our README for more on the expected format.
55
-
56
- <a name="user-content-require-param-type-context-and-settings"></a>
57
- <a name="require-param-type-context-and-settings"></a>
58
- ## Context and settings
59
-
60
- |||
61
- |---|---|
62
- |Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled|
63
- |Tags|`param`|
64
- |Aliases|`arg`, `argument`|
65
- |Recommended|true|
66
- |Options|`contexts`, `defaultDestructuredRootType`, `setDefaultDestructuredRootType`|
67
- |Settings|`exemptDestructuredRootsFromChecks`|
68
-
69
- <a name="user-content-require-param-type-failing-examples"></a>
70
- <a name="require-param-type-failing-examples"></a>
71
- ## Failing examples
72
-
73
- The following patterns are considered problems:
74
-
75
- ````js
76
- /**
77
- * @param foo
78
- */
79
- function quux (foo) {
80
-
81
- }
82
- // Message: Missing JSDoc @param "foo" type.
83
-
84
- /**
85
- * @param {a xxx
86
- */
87
- function quux () {
88
- }
89
- // Message: Missing JSDoc @param "" type.
90
-
91
- /**
92
- * @param foo
93
- */
94
- function quux (foo) {
95
-
96
- }
97
- // "jsdoc/require-param-type": ["error"|"warn", {"contexts":["any"]}]
98
- // Message: Missing JSDoc @param "foo" type.
99
-
100
- /**
101
- * @function
102
- * @param foo
103
- */
104
- // "jsdoc/require-param-type": ["error"|"warn", {"contexts":["any"]}]
105
- // Message: Missing JSDoc @param "foo" type.
106
-
107
- /**
108
- * @callback
109
- * @param foo
110
- */
111
- // "jsdoc/require-param-type": ["error"|"warn", {"contexts":["any"]}]
112
- // Message: Missing JSDoc @param "foo" type.
113
-
114
- /**
115
- * @arg foo
116
- */
117
- function quux (foo) {
118
-
119
- }
120
- // Settings: {"jsdoc":{"tagNamePreference":{"param":"arg"}}}
121
- // Message: Missing JSDoc @arg "foo" type.
122
-
123
- /**
124
- * @param foo
125
- */
126
- function quux (foo) {
127
-
128
- }
129
- // Settings: {"jsdoc":{"tagNamePreference":{"param":false}}}
130
- // Message: Unexpected tag `@param`
131
-
132
- /**
133
- * @param {number} foo
134
- * @param root
135
- * @param {boolean} baz
136
- */
137
- function quux (foo, {bar}, baz) {
138
-
139
- }
140
- // "jsdoc/require-param-type": ["error"|"warn", {"setDefaultDestructuredRootType":true}]
141
- // Message: Missing root type for @param.
142
-
143
- /**
144
- * @param {number} foo
145
- * @param root
146
- * @param {boolean} baz
147
- */
148
- function quux (foo, {bar}, baz) {
149
-
150
- }
151
- // "jsdoc/require-param-type": ["error"|"warn", {"defaultDestructuredRootType":"Object","setDefaultDestructuredRootType":true}]
152
- // Message: Missing root type for @param.
153
-
154
- /**
155
- * @param {number} foo
156
- * @param root
157
- * @param {boolean} baz
158
- */
159
- function quux (foo, {bar}, baz) {
160
-
161
- }
162
- // "jsdoc/require-param-type": ["error"|"warn", {"setDefaultDestructuredRootType":false}]
163
- // Message: Missing JSDoc @param "root" type.
164
- ````
165
-
166
-
167
-
168
- <a name="user-content-require-param-type-passing-examples"></a>
169
- <a name="require-param-type-passing-examples"></a>
170
- ## Passing examples
171
-
172
- The following patterns are not considered problems:
173
-
174
- ````js
175
- /**
176
- *
177
- */
178
- function quux (foo) {
179
-
180
- }
181
-
182
- /**
183
- * @param {number} foo
184
- */
185
- function quux (foo) {
186
-
187
- }
188
-
189
- /**
190
- * @param {number} foo
191
- */
192
- function quux (foo) {
193
-
194
- }
195
- // "jsdoc/require-param-type": ["error"|"warn", {"contexts":["any"]}]
196
-
197
- /**
198
- * @function
199
- * @param foo
200
- */
201
-
202
- /**
203
- * @callback
204
- * @param foo
205
- */
206
-
207
- /**
208
- * @param {number} foo
209
- * @param root
210
- * @param {boolean} baz
211
- */
212
- function quux (foo, {bar}, baz) {
213
-
214
- }
215
- // Settings: {"jsdoc":{"exemptDestructuredRootsFromChecks":true}}
216
-
217
- /**
218
- * @param {number} foo
219
- * @param root
220
- * @param root.bar
221
- */
222
- function quux (foo, {bar: {baz}}) {
223
-
224
- }
225
- // Settings: {"jsdoc":{"exemptDestructuredRootsFromChecks":true}}
226
- ````
227
-