eslint-plugin-jsdoc 44.2.3 → 44.2.5
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/dist/WarnSettings.js +0 -1
- package/dist/WarnSettings.js.map +1 -1
- package/dist/alignTransform.js +87 -5
- package/dist/alignTransform.js.map +1 -1
- package/dist/bin/generateRule.js +4 -3
- package/dist/bin/generateRule.js.map +1 -1
- package/dist/exportParser.js +272 -71
- package/dist/exportParser.js.map +1 -1
- package/dist/generateRule.js +4 -3
- package/dist/generateRule.js.map +1 -1
- package/dist/iterateJsdoc.js +921 -357
- package/dist/iterateJsdoc.js.map +1 -1
- package/dist/jsdocUtils.js +270 -168
- package/dist/jsdocUtils.js.map +1 -1
- package/dist/rules/checkAlignment.js +6 -0
- package/dist/rules/checkAlignment.js.map +1 -1
- package/dist/rules/checkExamples.js +73 -9
- package/dist/rules/checkExamples.js.map +1 -1
- package/dist/rules/checkIndentation.js +12 -2
- package/dist/rules/checkIndentation.js.map +1 -1
- package/dist/rules/checkLineAlignment.js +71 -7
- package/dist/rules/checkLineAlignment.js.map +1 -1
- package/dist/rules/checkParamNames.js +29 -11
- package/dist/rules/checkParamNames.js.map +1 -1
- package/dist/rules/checkPropertyNames.js +13 -7
- package/dist/rules/checkPropertyNames.js.map +1 -1
- package/dist/rules/checkTagNames.js +45 -9
- package/dist/rules/checkTagNames.js.map +1 -1
- package/dist/rules/checkTypes.js +98 -41
- package/dist/rules/checkTypes.js.map +1 -1
- package/dist/rules/checkValues.js +7 -7
- package/dist/rules/checkValues.js.map +1 -1
- package/dist/rules/emptyTags.js +8 -1
- package/dist/rules/emptyTags.js.map +1 -1
- package/dist/rules/informativeDocs.js +27 -8
- package/dist/rules/informativeDocs.js.map +1 -1
- package/dist/rules/matchDescription.js +18 -1
- package/dist/rules/matchDescription.js.map +1 -1
- package/dist/rules/matchName.js +2 -2
- package/dist/rules/matchName.js.map +1 -1
- package/dist/rules/multilineBlocks.js +12 -1
- package/dist/rules/multilineBlocks.js.map +1 -1
- package/dist/rules/noBadBlocks.js +4 -6
- package/dist/rules/noBadBlocks.js.map +1 -1
- package/dist/rules/noBlankBlockDescriptions.js +2 -0
- package/dist/rules/noBlankBlockDescriptions.js.map +1 -1
- package/dist/rules/noMissingSyntax.js +53 -16
- package/dist/rules/noMissingSyntax.js.map +1 -1
- package/dist/rules/noMultiAsterisks.js +1 -6
- package/dist/rules/noMultiAsterisks.js.map +1 -1
- package/dist/rules/noRestrictedSyntax.js +12 -5
- package/dist/rules/noRestrictedSyntax.js.map +1 -1
- package/dist/rules/noTypes.js +3 -0
- package/dist/rules/noTypes.js.map +1 -1
- package/dist/rules/noUndefinedTypes.js +65 -27
- package/dist/rules/noUndefinedTypes.js.map +1 -1
- package/dist/rules/requireAsteriskPrefix.js +20 -0
- package/dist/rules/requireAsteriskPrefix.js.map +1 -1
- package/dist/rules/requireDescription.js +6 -2
- package/dist/rules/requireDescription.js.map +1 -1
- package/dist/rules/requireDescriptionCompleteSentence.js +75 -12
- package/dist/rules/requireDescriptionCompleteSentence.js.map +1 -1
- package/dist/rules/requireFileOverview.js +9 -4
- package/dist/rules/requireFileOverview.js.map +1 -1
- package/dist/rules/requireHyphenBeforeParamDescription.js +21 -7
- package/dist/rules/requireHyphenBeforeParamDescription.js.map +1 -1
- package/dist/rules/requireJsdoc.js +150 -29
- package/dist/rules/requireJsdoc.js.map +1 -1
- package/dist/rules/requireParam.js +116 -10
- package/dist/rules/requireParam.js.map +1 -1
- package/dist/rules/requireProperty.js +1 -1
- package/dist/rules/requireProperty.js.map +1 -1
- package/dist/rules/requireReturns.js +2 -3
- package/dist/rules/requireReturns.js.map +1 -1
- package/dist/rules/requireReturnsCheck.js +9 -2
- package/dist/rules/requireReturnsCheck.js.map +1 -1
- package/dist/rules/requireThrows.js +2 -3
- package/dist/rules/requireThrows.js.map +1 -1
- package/dist/rules/requireYields.js +9 -3
- package/dist/rules/requireYields.js.map +1 -1
- package/dist/rules/requireYieldsCheck.js +19 -5
- package/dist/rules/requireYieldsCheck.js.map +1 -1
- package/dist/rules/sortTags.js +67 -9
- package/dist/rules/sortTags.js.map +1 -1
- package/dist/rules/tagLines.js +22 -3
- package/dist/rules/tagLines.js.map +1 -1
- package/dist/rules/textEscaping.js +18 -4
- package/dist/rules/textEscaping.js.map +1 -1
- package/dist/rules/validTypes.js +26 -9
- package/dist/rules/validTypes.js.map +1 -1
- package/dist/tagNames.js +0 -2
- package/dist/tagNames.js.map +1 -1
- package/dist/utils/hasReturnValue.js +77 -48
- package/dist/utils/hasReturnValue.js.map +1 -1
- package/docs/rules/check-line-alignment.md +7 -0
- package/docs/rules/check-tag-names.md +15 -0
- package/docs/rules/no-missing-syntax.md +6 -0
- package/docs/rules/no-undefined-types.md +6 -0
- package/docs/rules/require-description-complete-sentence.md +525 -289
- package/docs/rules/require-description.md +289 -525
- package/docs/rules/require-file-overview.md +7 -0
- package/docs/rules/require-jsdoc.md +1 -1
- package/docs/rules/require-param-description.md +116 -1694
- package/docs/rules/require-param-name.md +58 -133
- package/docs/rules/require-param-type.md +119 -55
- package/docs/rules/require-param.md +1704 -111
- package/docs/rules/require-property-description.md +39 -79
- package/docs/rules/require-property-name.md +21 -30
- package/docs/rules/require-property-type.md +21 -21
- package/docs/rules/require-property.md +82 -33
- package/docs/rules/require-returns-check.md +636 -747
- package/docs/rules/require-returns-description.md +61 -933
- package/docs/rules/require-returns-type.md +42 -79
- package/docs/rules/require-returns.md +1081 -61
- package/docs/rules/require-yields-check.md +238 -517
- package/docs/rules/require-yields.md +517 -238
- package/docs/rules/valid-types.md +1 -1
- package/docs/settings.md +3 -1
- package/package.json +10 -9
- package/tsconfig.json +2 -3
|
@@ -1,46 +1,26 @@
|
|
|
1
|
-
<a name="user-content-require-param-
|
|
2
|
-
<a name="require-param-
|
|
3
|
-
# <code>require-param-
|
|
1
|
+
<a name="user-content-require-param-name"></a>
|
|
2
|
+
<a name="require-param-name"></a>
|
|
3
|
+
# <code>require-param-name</code>
|
|
4
4
|
|
|
5
|
-
* [Options](#user-content-require-param-
|
|
6
|
-
* [`
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
* [
|
|
10
|
-
* [Failing examples](#user-content-require-param-description-failing-examples)
|
|
11
|
-
* [Passing examples](#user-content-require-param-description-passing-examples)
|
|
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)
|
|
12
10
|
|
|
13
11
|
|
|
14
|
-
Requires that
|
|
12
|
+
Requires that all `@param` tags have names.
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
`function someFunc ({child1, child2})`).
|
|
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)
|
|
20
17
|
|
|
21
|
-
<a name="user-content-require-param-
|
|
22
|
-
<a name="require-param-
|
|
18
|
+
<a name="user-content-require-param-name-options"></a>
|
|
19
|
+
<a name="require-param-name-options"></a>
|
|
23
20
|
## Options
|
|
24
21
|
|
|
25
|
-
<a name="user-content-require-param-
|
|
26
|
-
<a name="require-param-
|
|
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>
|
|
22
|
+
<a name="user-content-require-param-name-options-contexts"></a>
|
|
23
|
+
<a name="require-param-name-options-contexts"></a>
|
|
44
24
|
### <code>contexts</code>
|
|
45
25
|
|
|
46
26
|
Set this to an array of strings representing the AST context (or an object with
|
|
@@ -54,8 +34,8 @@ expression, i.e., `@callback` or `@function` (or its aliases `@func` or
|
|
|
54
34
|
See the ["AST and Selectors"](#user-content-eslint-plugin-jsdoc-advanced-ast-and-selectors)
|
|
55
35
|
section of our README for more on the expected format.
|
|
56
36
|
|
|
57
|
-
<a name="user-content-require-param-
|
|
58
|
-
<a name="require-param-
|
|
37
|
+
<a name="user-content-require-param-name-context-and-settings"></a>
|
|
38
|
+
<a name="require-param-name-context-and-settings"></a>
|
|
59
39
|
## Context and settings
|
|
60
40
|
|
|
61
41
|
|||
|
|
@@ -64,55 +44,53 @@ section of our README for more on the expected format.
|
|
|
64
44
|
|Tags|`param`|
|
|
65
45
|
|Aliases|`arg`, `argument`|
|
|
66
46
|
|Recommended|true|
|
|
67
|
-
|Options|`
|
|
68
|
-
|Settings|`exemptDestructuredRootsFromChecks`|
|
|
47
|
+
|Options|`contexts`|
|
|
69
48
|
|
|
70
|
-
<a name="user-content-require-param-
|
|
71
|
-
<a name="require-param-
|
|
49
|
+
<a name="user-content-require-param-name-failing-examples"></a>
|
|
50
|
+
<a name="require-param-name-failing-examples"></a>
|
|
72
51
|
## Failing examples
|
|
73
52
|
|
|
74
53
|
The following patterns are considered problems:
|
|
75
54
|
|
|
76
55
|
````js
|
|
77
56
|
/**
|
|
78
|
-
* @param
|
|
57
|
+
* @param
|
|
79
58
|
*/
|
|
80
59
|
function quux (foo) {
|
|
81
60
|
|
|
82
61
|
}
|
|
83
|
-
// Message:
|
|
62
|
+
// Message: There must be an identifier after @param type.
|
|
84
63
|
|
|
85
64
|
/**
|
|
86
|
-
* @param
|
|
65
|
+
* @param {string}
|
|
87
66
|
*/
|
|
88
67
|
function quux (foo) {
|
|
89
68
|
|
|
90
69
|
}
|
|
91
|
-
//
|
|
92
|
-
// Message: Missing JSDoc @param "foo" description.
|
|
70
|
+
// Message: There must be an identifier after @param tag.
|
|
93
71
|
|
|
94
72
|
/**
|
|
95
|
-
* @
|
|
96
|
-
* @param foo
|
|
73
|
+
* @param {string}
|
|
97
74
|
*/
|
|
98
|
-
|
|
99
|
-
|
|
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.
|
|
100
80
|
|
|
101
81
|
/**
|
|
102
|
-
* @
|
|
103
|
-
* @param
|
|
82
|
+
* @function
|
|
83
|
+
* @param {string}
|
|
104
84
|
*/
|
|
105
|
-
// "jsdoc/require-param-
|
|
106
|
-
// Message:
|
|
85
|
+
// "jsdoc/require-param-name": ["error"|"warn", {"contexts":["any"]}]
|
|
86
|
+
// Message: There must be an identifier after @param tag.
|
|
107
87
|
|
|
108
88
|
/**
|
|
109
|
-
* @
|
|
89
|
+
* @callback
|
|
90
|
+
* @param {string}
|
|
110
91
|
*/
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
// Settings: {"jsdoc":{"tagNamePreference":{"param":"arg"}}}
|
|
115
|
-
// Message: Missing JSDoc @arg "foo" description.
|
|
92
|
+
// "jsdoc/require-param-name": ["error"|"warn", {"contexts":["any"]}]
|
|
93
|
+
// Message: There must be an identifier after @param tag.
|
|
116
94
|
|
|
117
95
|
/**
|
|
118
96
|
* @param foo
|
|
@@ -122,117 +100,64 @@ function quux (foo) {
|
|
|
122
100
|
}
|
|
123
101
|
// Settings: {"jsdoc":{"tagNamePreference":{"param":false}}}
|
|
124
102
|
// 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
103
|
````
|
|
168
104
|
|
|
169
105
|
|
|
170
106
|
|
|
171
|
-
<a name="user-content-require-param-
|
|
172
|
-
<a name="require-param-
|
|
107
|
+
<a name="user-content-require-param-name-passing-examples"></a>
|
|
108
|
+
<a name="require-param-name-passing-examples"></a>
|
|
173
109
|
## Passing examples
|
|
174
110
|
|
|
175
111
|
The following patterns are not considered problems:
|
|
176
112
|
|
|
177
113
|
````js
|
|
178
114
|
/**
|
|
179
|
-
*
|
|
115
|
+
* @param foo
|
|
180
116
|
*/
|
|
181
117
|
function quux (foo) {
|
|
182
118
|
|
|
183
119
|
}
|
|
184
120
|
|
|
185
121
|
/**
|
|
186
|
-
* @param foo
|
|
122
|
+
* @param foo
|
|
187
123
|
*/
|
|
188
124
|
function quux (foo) {
|
|
189
125
|
|
|
190
126
|
}
|
|
127
|
+
// "jsdoc/require-param-name": ["error"|"warn", {"contexts":["any"]}]
|
|
191
128
|
|
|
192
129
|
/**
|
|
193
|
-
* @param foo
|
|
130
|
+
* @param {string} foo
|
|
194
131
|
*/
|
|
195
132
|
function quux (foo) {
|
|
196
133
|
|
|
197
134
|
}
|
|
198
|
-
// "jsdoc/require-param-description": ["error"|"warn", {"contexts":["any"]}]
|
|
199
135
|
|
|
200
136
|
/**
|
|
201
137
|
* @function
|
|
202
|
-
* @param
|
|
138
|
+
* @param
|
|
203
139
|
*/
|
|
204
140
|
|
|
205
141
|
/**
|
|
206
142
|
* @callback
|
|
207
|
-
* @param
|
|
143
|
+
* @param
|
|
208
144
|
*/
|
|
209
145
|
|
|
210
146
|
/**
|
|
211
|
-
* @param
|
|
147
|
+
* @param {Function} [processor=data => data] A function to run
|
|
212
148
|
*/
|
|
213
|
-
function
|
|
214
|
-
|
|
149
|
+
function processData(processor) {
|
|
150
|
+
return processor(data)
|
|
215
151
|
}
|
|
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
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);
|
|
235
161
|
}
|
|
236
|
-
// Settings: {"jsdoc":{"exemptDestructuredRootsFromChecks":true}}
|
|
237
162
|
````
|
|
238
163
|
|
|
@@ -1,26 +1,45 @@
|
|
|
1
|
-
<a name="user-content-require-param-
|
|
2
|
-
<a name="require-param-
|
|
3
|
-
# <code>require-param-
|
|
1
|
+
<a name="user-content-require-param-type"></a>
|
|
2
|
+
<a name="require-param-type"></a>
|
|
3
|
+
# <code>require-param-type</code>
|
|
4
4
|
|
|
5
|
-
* [Options](#user-content-require-param-
|
|
6
|
-
* [`
|
|
7
|
-
* [
|
|
8
|
-
* [
|
|
9
|
-
* [
|
|
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)
|
|
10
12
|
|
|
11
13
|
|
|
12
|
-
Requires that
|
|
14
|
+
Requires that each `@param` tag has a `type` value (within curly brackets).
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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})`).
|
|
17
20
|
|
|
18
|
-
<a name="user-content-require-param-
|
|
19
|
-
<a name="require-param-
|
|
21
|
+
<a name="user-content-require-param-type-options"></a>
|
|
22
|
+
<a name="require-param-type-options"></a>
|
|
20
23
|
## Options
|
|
21
24
|
|
|
22
|
-
<a name="user-content-require-param-
|
|
23
|
-
<a name="require-param-
|
|
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>
|
|
24
43
|
### <code>contexts</code>
|
|
25
44
|
|
|
26
45
|
Set this to an array of strings representing the AST context (or an object with
|
|
@@ -34,8 +53,8 @@ expression, i.e., `@callback` or `@function` (or its aliases `@func` or
|
|
|
34
53
|
See the ["AST and Selectors"](#user-content-eslint-plugin-jsdoc-advanced-ast-and-selectors)
|
|
35
54
|
section of our README for more on the expected format.
|
|
36
55
|
|
|
37
|
-
<a name="user-content-require-param-
|
|
38
|
-
<a name="require-param-
|
|
56
|
+
<a name="user-content-require-param-type-context-and-settings"></a>
|
|
57
|
+
<a name="require-param-type-context-and-settings"></a>
|
|
39
58
|
## Context and settings
|
|
40
59
|
|
|
41
60
|
|||
|
|
@@ -44,53 +63,62 @@ section of our README for more on the expected format.
|
|
|
44
63
|
|Tags|`param`|
|
|
45
64
|
|Aliases|`arg`, `argument`|
|
|
46
65
|
|Recommended|true|
|
|
47
|
-
|Options|`contexts`|
|
|
66
|
+
|Options|`setDefaultDestructuredRootType`, `defaultDestructuredRootType`, `contexts`|
|
|
67
|
+
|Settings|`exemptDestructuredRootsFromChecks`|
|
|
48
68
|
|
|
49
|
-
<a name="user-content-require-param-
|
|
50
|
-
<a name="require-param-
|
|
69
|
+
<a name="user-content-require-param-type-failing-examples"></a>
|
|
70
|
+
<a name="require-param-type-failing-examples"></a>
|
|
51
71
|
## Failing examples
|
|
52
72
|
|
|
53
73
|
The following patterns are considered problems:
|
|
54
74
|
|
|
55
75
|
````js
|
|
56
76
|
/**
|
|
57
|
-
* @param
|
|
77
|
+
* @param foo
|
|
58
78
|
*/
|
|
59
79
|
function quux (foo) {
|
|
60
80
|
|
|
61
81
|
}
|
|
62
|
-
// Message:
|
|
82
|
+
// Message: Missing JSDoc @param "foo" type.
|
|
63
83
|
|
|
64
84
|
/**
|
|
65
|
-
* @param {
|
|
85
|
+
* @param {a xxx
|
|
66
86
|
*/
|
|
67
|
-
function quux (
|
|
68
|
-
|
|
87
|
+
function quux () {
|
|
69
88
|
}
|
|
70
|
-
// Message:
|
|
89
|
+
// Message: Missing JSDoc @param "" type.
|
|
71
90
|
|
|
72
91
|
/**
|
|
73
|
-
* @param
|
|
92
|
+
* @param foo
|
|
74
93
|
*/
|
|
75
94
|
function quux (foo) {
|
|
76
95
|
|
|
77
96
|
}
|
|
78
|
-
// "jsdoc/require-param-
|
|
79
|
-
// Message:
|
|
97
|
+
// "jsdoc/require-param-type": ["error"|"warn", {"contexts":["any"]}]
|
|
98
|
+
// Message: Missing JSDoc @param "foo" type.
|
|
80
99
|
|
|
81
100
|
/**
|
|
82
101
|
* @function
|
|
83
|
-
* @param
|
|
102
|
+
* @param foo
|
|
84
103
|
*/
|
|
85
|
-
// "jsdoc/require-param-
|
|
86
|
-
// Message:
|
|
104
|
+
// "jsdoc/require-param-type": ["error"|"warn", {"contexts":["any"]}]
|
|
105
|
+
// Message: Missing JSDoc @param "foo" type.
|
|
87
106
|
|
|
88
107
|
/**
|
|
89
108
|
* @callback
|
|
90
|
-
* @param
|
|
109
|
+
* @param foo
|
|
91
110
|
*/
|
|
92
|
-
// "jsdoc/require-param-
|
|
93
|
-
// Message:
|
|
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.
|
|
94
122
|
|
|
95
123
|
/**
|
|
96
124
|
* @param foo
|
|
@@ -100,64 +128,100 @@ function quux (foo) {
|
|
|
100
128
|
}
|
|
101
129
|
// Settings: {"jsdoc":{"tagNamePreference":{"param":false}}}
|
|
102
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.
|
|
103
164
|
````
|
|
104
165
|
|
|
105
166
|
|
|
106
167
|
|
|
107
|
-
<a name="user-content-require-param-
|
|
108
|
-
<a name="require-param-
|
|
168
|
+
<a name="user-content-require-param-type-passing-examples"></a>
|
|
169
|
+
<a name="require-param-type-passing-examples"></a>
|
|
109
170
|
## Passing examples
|
|
110
171
|
|
|
111
172
|
The following patterns are not considered problems:
|
|
112
173
|
|
|
113
174
|
````js
|
|
114
175
|
/**
|
|
115
|
-
*
|
|
176
|
+
*
|
|
116
177
|
*/
|
|
117
178
|
function quux (foo) {
|
|
118
179
|
|
|
119
180
|
}
|
|
120
181
|
|
|
121
182
|
/**
|
|
122
|
-
* @param foo
|
|
183
|
+
* @param {number} foo
|
|
123
184
|
*/
|
|
124
185
|
function quux (foo) {
|
|
125
186
|
|
|
126
187
|
}
|
|
127
|
-
// "jsdoc/require-param-name": ["error"|"warn", {"contexts":["any"]}]
|
|
128
188
|
|
|
129
189
|
/**
|
|
130
|
-
* @param {
|
|
190
|
+
* @param {number} foo
|
|
131
191
|
*/
|
|
132
192
|
function quux (foo) {
|
|
133
193
|
|
|
134
194
|
}
|
|
195
|
+
// "jsdoc/require-param-type": ["error"|"warn", {"contexts":["any"]}]
|
|
135
196
|
|
|
136
197
|
/**
|
|
137
198
|
* @function
|
|
138
|
-
* @param
|
|
199
|
+
* @param foo
|
|
139
200
|
*/
|
|
140
201
|
|
|
141
202
|
/**
|
|
142
203
|
* @callback
|
|
143
|
-
* @param
|
|
204
|
+
* @param foo
|
|
144
205
|
*/
|
|
145
206
|
|
|
146
207
|
/**
|
|
147
|
-
* @param {
|
|
208
|
+
* @param {number} foo
|
|
209
|
+
* @param root
|
|
210
|
+
* @param {boolean} baz
|
|
148
211
|
*/
|
|
149
|
-
function
|
|
150
|
-
|
|
212
|
+
function quux (foo, {bar}, baz) {
|
|
213
|
+
|
|
151
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}}) {
|
|
152
223
|
|
|
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
224
|
}
|
|
225
|
+
// Settings: {"jsdoc":{"exemptDestructuredRootsFromChecks":true}}
|
|
162
226
|
````
|
|
163
227
|
|