Skip to content

Commit 231da2a

Browse files
committed
docs: due to ordering issue, some doc files output under wrong name
1 parent dd0c4bb commit 231da2a

17 files changed

+5549
-5545
lines changed

docs/rules/require-description-complete-sentence.md

Lines changed: 525 additions & 289 deletions
Large diffs are not rendered by default.

docs/rules/require-description.md

Lines changed: 289 additions & 525 deletions
Large diffs are not rendered by default.

docs/rules/require-param-description.md

Lines changed: 116 additions & 1694 deletions
Large diffs are not rendered by default.

docs/rules/require-param-name.md

Lines changed: 58 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,26 @@
1-
<a name="user-content-require-param-description"></a>
2-
<a name="require-param-description"></a>
3-
# <code>require-param-description</code>
1+
<a name="user-content-require-param-name"></a>
2+
<a name="require-param-name"></a>
3+
# <code>require-param-name</code>
44

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)
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)
1210

1311

14-
Requires that each `@param` tag has a `description` value.
12+
Requires that all `@param` tags have names.
1513

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})`).
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)
2017
21-
<a name="user-content-require-param-description-options"></a>
22-
<a name="require-param-description-options"></a>
18+
<a name="user-content-require-param-name-options"></a>
19+
<a name="require-param-name-options"></a>
2320
## Options
2421

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>
22+
<a name="user-content-require-param-name-options-contexts"></a>
23+
<a name="require-param-name-options-contexts"></a>
4424
### <code>contexts</code>
4525

4626
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
5434
See the ["AST and Selectors"](#user-content-eslint-plugin-jsdoc-advanced-ast-and-selectors)
5535
section of our README for more on the expected format.
5636

57-
<a name="user-content-require-param-description-context-and-settings"></a>
58-
<a name="require-param-description-context-and-settings"></a>
37+
<a name="user-content-require-param-name-context-and-settings"></a>
38+
<a name="require-param-name-context-and-settings"></a>
5939
## Context and settings
6040

6141
|||
@@ -64,55 +44,53 @@ section of our README for more on the expected format.
6444
|Tags|`param`|
6545
|Aliases|`arg`, `argument`|
6646
|Recommended|true|
67-
|Options|`setDefaultDestructuredRootDescription`, `defaultDestructuredRootDescription`, `contexts`|
68-
|Settings|`exemptDestructuredRootsFromChecks`|
47+
|Options|`contexts`|
6948

70-
<a name="user-content-require-param-description-failing-examples"></a>
71-
<a name="require-param-description-failing-examples"></a>
49+
<a name="user-content-require-param-name-failing-examples"></a>
50+
<a name="require-param-name-failing-examples"></a>
7251
## Failing examples
7352

7453
The following patterns are considered problems:
7554

7655
````js
7756
/**
78-
* @param foo
57+
* @param
7958
*/
8059
function quux (foo) {
8160

8261
}
83-
// Message: Missing JSDoc @param "foo" description.
62+
// Message: There must be an identifier after @param type.
8463

8564
/**
86-
* @param foo
65+
* @param {string}
8766
*/
8867
function quux (foo) {
8968

9069
}
91-
// "jsdoc/require-param-description": ["error"|"warn", {"contexts":["any"]}]
92-
// Message: Missing JSDoc @param "foo" description.
70+
// Message: There must be an identifier after @param tag.
9371

9472
/**
95-
* @function
96-
* @param foo
73+
* @param {string}
9774
*/
98-
// "jsdoc/require-param-description": ["error"|"warn", {"contexts":["any"]}]
99-
// Message: Missing JSDoc @param "foo" description.
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.
10080

10181
/**
102-
* @callback
103-
* @param foo
82+
* @function
83+
* @param {string}
10484
*/
105-
// "jsdoc/require-param-description": ["error"|"warn", {"contexts":["any"]}]
106-
// Message: Missing JSDoc @param "foo" description.
85+
// "jsdoc/require-param-name": ["error"|"warn", {"contexts":["any"]}]
86+
// Message: There must be an identifier after @param tag.
10787

10888
/**
109-
* @arg foo
89+
* @callback
90+
* @param {string}
11091
*/
111-
function quux (foo) {
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.
11694

11795
/**
11896
* @param foo
@@ -122,117 +100,64 @@ function quux (foo) {
122100
}
123101
// Settings: {"jsdoc":{"tagNamePreference":{"param":false}}}
124102
// 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.
167103
````
168104

169105

170106

171-
<a name="user-content-require-param-description-passing-examples"></a>
172-
<a name="require-param-description-passing-examples"></a>
107+
<a name="user-content-require-param-name-passing-examples"></a>
108+
<a name="require-param-name-passing-examples"></a>
173109
## Passing examples
174110

175111
The following patterns are not considered problems:
176112

177113
````js
178114
/**
179-
*
115+
* @param foo
180116
*/
181117
function quux (foo) {
182118

183119
}
184120

185121
/**
186-
* @param foo Foo.
122+
* @param foo
187123
*/
188124
function quux (foo) {
189125

190126
}
127+
// "jsdoc/require-param-name": ["error"|"warn", {"contexts":["any"]}]
191128

192129
/**
193-
* @param foo Foo.
130+
* @param {string} foo
194131
*/
195132
function quux (foo) {
196133

197134
}
198-
// "jsdoc/require-param-description": ["error"|"warn", {"contexts":["any"]}]
199135

200136
/**
201137
* @function
202-
* @param foo
138+
* @param
203139
*/
204140

205141
/**
206142
* @callback
207-
* @param foo
143+
* @param
208144
*/
209145

210146
/**
211-
* @param props
147+
* @param {Function} [processor=data => data] A function to run
212148
*/
213-
function quux (props) {
214-
149+
function processData(processor) {
150+
return processor(data)
215151
}
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}}) {
234152

153+
/** Example with multi-line param type.
154+
*
155+
* @param {function(
156+
* number
157+
* )} cb Callback.
158+
*/
159+
function example(cb) {
160+
cb(42);
235161
}
236-
// Settings: {"jsdoc":{"exemptDestructuredRootsFromChecks":true}}
237162
````
238163

0 commit comments

Comments
 (0)