eslint-plugin-jsdoc 46.4.5 → 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.
- package/README.md +31 -0
- package/dist/alignTransform.js +5 -5
- package/dist/alignTransform.js.map +1 -1
- package/dist/index.js +21 -10
- package/dist/index.js.map +1 -1
- package/dist/iterateJsdoc.js +1 -1
- package/dist/iterateJsdoc.js.map +1 -1
- package/dist/rules/checkExamples.js +12 -6
- package/dist/rules/checkExamples.js.map +1 -1
- package/package.json +19 -15
- package/docs/advanced.md +0 -102
- package/docs/rules/check-access.md +0 -193
- package/docs/rules/check-alignment.md +0 -169
- package/docs/rules/check-examples.md +0 -784
- package/docs/rules/check-indentation.md +0 -296
- package/docs/rules/check-line-alignment.md +0 -1002
- package/docs/rules/check-param-names.md +0 -1035
- package/docs/rules/check-property-names.md +0 -244
- package/docs/rules/check-syntax.md +0 -80
- package/docs/rules/check-tag-names.md +0 -1132
- package/docs/rules/check-types.md +0 -1198
- package/docs/rules/check-values.md +0 -409
- package/docs/rules/empty-tags.md +0 -220
- package/docs/rules/implements-on-classes.md +0 -219
- package/docs/rules/imports-as-dependencies.md +0 -99
- package/docs/rules/informative-docs.md +0 -400
- package/docs/rules/match-description.md +0 -1008
- package/docs/rules/match-name.md +0 -249
- package/docs/rules/multiline-blocks.md +0 -398
- package/docs/rules/no-bad-blocks.md +0 -174
- package/docs/rules/no-blank-block-descriptions.md +0 -91
- package/docs/rules/no-blank-blocks.md +0 -98
- package/docs/rules/no-defaults.md +0 -207
- package/docs/rules/no-missing-syntax.md +0 -275
- package/docs/rules/no-multi-asterisks.md +0 -278
- package/docs/rules/no-restricted-syntax.md +0 -383
- package/docs/rules/no-types.md +0 -168
- package/docs/rules/no-undefined-types.md +0 -789
- package/docs/rules/require-asterisk-prefix.md +0 -297
- package/docs/rules/require-description-complete-sentence.md +0 -820
- package/docs/rules/require-description.md +0 -585
- package/docs/rules/require-example.md +0 -390
- package/docs/rules/require-file-overview.md +0 -324
- package/docs/rules/require-hyphen-before-param-description.md +0 -281
- package/docs/rules/require-jsdoc.md +0 -1857
- package/docs/rules/require-param-description.md +0 -238
- package/docs/rules/require-param-name.md +0 -163
- package/docs/rules/require-param-type.md +0 -227
- package/docs/rules/require-param.md +0 -1820
- package/docs/rules/require-property-description.md +0 -88
- package/docs/rules/require-property-name.md +0 -79
- package/docs/rules/require-property-type.md +0 -79
- package/docs/rules/require-property.md +0 -128
- package/docs/rules/require-returns-check.md +0 -1053
- package/docs/rules/require-returns-description.md +0 -181
- package/docs/rules/require-returns-type.md +0 -144
- package/docs/rules/require-returns.md +0 -1191
- package/docs/rules/require-throws.md +0 -326
- package/docs/rules/require-yields-check.md +0 -544
- package/docs/rules/require-yields.md +0 -823
- package/docs/rules/sort-tags.md +0 -635
- package/docs/rules/tag-lines.md +0 -551
- package/docs/rules/text-escaping.md +0 -177
- package/docs/rules/valid-types.md +0 -881
- package/docs/settings.md +0 -362
- package/tsconfig.json +0 -22
|
@@ -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
|
-
|