eslint-plugin-jsdoc 58.1.0 → 59.0.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 +66 -60
- package/dist/buildForbidRuleDefinition.cjs +0 -1
- package/dist/buildForbidRuleDefinition.cjs.map +1 -1
- package/dist/buildRejectOrPreferRuleDefinition.cjs +7 -2
- package/dist/buildRejectOrPreferRuleDefinition.cjs.map +1 -1
- package/dist/cjs/rules/convertToJsdocComments.d.ts +7 -0
- package/dist/generateDocs.cjs +129 -3
- package/dist/generateDocs.cjs.map +1 -1
- package/dist/generateRule.cjs +3 -1
- package/dist/generateRule.cjs.map +1 -1
- package/dist/generateRuleTypes.cjs +5 -5
- package/dist/generateRuleTypes.cjs.map +1 -1
- package/dist/index-cjs.cjs +30 -0
- package/dist/index-cjs.cjs.map +1 -1
- package/dist/index.cjs +30 -0
- package/dist/index.cjs.map +1 -1
- package/dist/rules/checkAccess.cjs +1 -1
- package/dist/rules/checkAccess.cjs.map +1 -1
- package/dist/rules/checkAlignment.cjs +4 -1
- package/dist/rules/checkAlignment.cjs.map +1 -1
- package/dist/rules/checkExamples.cjs +1 -1
- package/dist/rules/checkExamples.cjs.map +1 -1
- package/dist/rules/checkIndentation.cjs +19 -0
- package/dist/rules/checkIndentation.cjs.map +1 -1
- package/dist/rules/checkLineAlignment.cjs +25 -1
- package/dist/rules/checkLineAlignment.cjs.map +1 -1
- package/dist/rules/checkParamNames.cjs +62 -1
- package/dist/rules/checkParamNames.cjs.map +1 -1
- package/dist/rules/checkPropertyNames.cjs +6 -0
- package/dist/rules/checkPropertyNames.cjs.map +1 -1
- package/dist/rules/checkTagNames.cjs +71 -0
- package/dist/rules/checkTagNames.cjs.map +1 -1
- package/dist/rules/checkTypes.cjs +16 -1
- package/dist/rules/checkTypes.cjs.map +1 -1
- package/dist/rules/checkValues.cjs +17 -1
- package/dist/rules/checkValues.cjs.map +1 -1
- package/dist/rules/convertToJsdocComments.cjs +48 -0
- package/dist/rules/convertToJsdocComments.cjs.map +1 -1
- package/dist/rules/convertToJsdocComments.d.ts +7 -0
- package/dist/rules/emptyTags.cjs +10 -1
- package/dist/rules/emptyTags.cjs.map +1 -1
- package/dist/rules/implementsOnClasses.cjs +15 -1
- package/dist/rules/implementsOnClasses.cjs.map +1 -1
- package/dist/rules/informativeDocs.cjs +45 -0
- package/dist/rules/informativeDocs.cjs.map +1 -1
- package/dist/rules/linesBeforeBlock.cjs +14 -0
- package/dist/rules/linesBeforeBlock.cjs.map +1 -1
- package/dist/rules/matchDescription.cjs +129 -0
- package/dist/rules/matchDescription.cjs.map +1 -1
- package/dist/rules/matchName.cjs +30 -0
- package/dist/rules/matchName.cjs.map +1 -1
- package/dist/rules/multilineBlocks.cjs +78 -6
- package/dist/rules/multilineBlocks.cjs.map +1 -1
- package/dist/rules/noBadBlocks.cjs +11 -2
- package/dist/rules/noBadBlocks.cjs.map +1 -1
- package/dist/rules/noBlankBlockDescriptions.cjs +1 -1
- package/dist/rules/noBlankBlockDescriptions.cjs.map +1 -1
- package/dist/rules/noBlankBlocks.cjs +3 -1
- package/dist/rules/noBlankBlocks.cjs.map +1 -1
- package/dist/rules/noDefaults.cjs +19 -0
- package/dist/rules/noDefaults.cjs.map +1 -1
- package/dist/rules/noMissingSyntax.cjs +22 -2
- package/dist/rules/noMissingSyntax.cjs.map +1 -1
- package/dist/rules/noMultiAsterisks.cjs +29 -0
- package/dist/rules/noMultiAsterisks.cjs.map +1 -1
- package/dist/rules/noRestrictedSyntax.cjs +17 -1
- package/dist/rules/noRestrictedSyntax.cjs.map +1 -1
- package/dist/rules/noTypes.cjs +17 -1
- package/dist/rules/noTypes.cjs.map +1 -1
- package/dist/rules/noUndefinedTypes.cjs +11 -1
- package/dist/rules/noUndefinedTypes.cjs.map +1 -1
- package/dist/rules/requireAsteriskPrefix.cjs +28 -0
- package/dist/rules/requireAsteriskPrefix.cjs.map +1 -1
- package/dist/rules/requireDescription.cjs +30 -1
- package/dist/rules/requireDescription.cjs.map +1 -1
- package/dist/rules/requireDescriptionCompleteSentence.cjs +27 -0
- package/dist/rules/requireDescriptionCompleteSentence.cjs.map +1 -1
- package/dist/rules/requireExample.cjs +26 -1
- package/dist/rules/requireExample.cjs.map +1 -1
- package/dist/rules/requireFileOverview.cjs +61 -0
- package/dist/rules/requireFileOverview.cjs.map +1 -1
- package/dist/rules/requireHyphenBeforeParamDescription.cjs +20 -2
- package/dist/rules/requireHyphenBeforeParamDescription.cjs.map +1 -1
- package/dist/rules/requireJsdoc.cjs +82 -3
- package/dist/rules/requireJsdoc.cjs.map +1 -1
- package/dist/rules/requireParam.cjs +213 -1
- package/dist/rules/requireParam.cjs.map +1 -1
- package/dist/rules/requireParamDescription.cjs +21 -0
- package/dist/rules/requireParamDescription.cjs.map +1 -1
- package/dist/rules/requireParamName.cjs +16 -1
- package/dist/rules/requireParamName.cjs.map +1 -1
- package/dist/rules/requireParamType.cjs +21 -1
- package/dist/rules/requireParamType.cjs.map +1 -1
- package/dist/rules/requirePropertyName.cjs +1 -1
- package/dist/rules/requirePropertyName.cjs.map +1 -1
- package/dist/rules/requirePropertyType.cjs +1 -1
- package/dist/rules/requirePropertyType.cjs.map +1 -1
- package/dist/rules/requireReturns.cjs +54 -1
- package/dist/rules/requireReturns.cjs.map +1 -1
- package/dist/rules/requireReturnsCheck.cjs +22 -1
- package/dist/rules/requireReturnsCheck.cjs.map +1 -1
- package/dist/rules/requireReturnsDescription.cjs +15 -1
- package/dist/rules/requireReturnsDescription.cjs.map +1 -1
- package/dist/rules/requireReturnsType.cjs +15 -1
- package/dist/rules/requireReturnsType.cjs.map +1 -1
- package/dist/rules/requireTemplate.cjs +17 -1
- package/dist/rules/requireTemplate.cjs.map +1 -1
- package/dist/rules/requireThrows.cjs +18 -1
- package/dist/rules/requireThrows.cjs.map +1 -1
- package/dist/rules/requireYields.cjs +50 -1
- package/dist/rules/requireYields.cjs.map +1 -1
- package/dist/rules/requireYieldsCheck.cjs +25 -7
- package/dist/rules/requireYieldsCheck.cjs.map +1 -1
- package/dist/rules/sortTags.cjs +200 -1
- package/dist/rules/sortTags.cjs.map +1 -1
- package/dist/rules/tagLines.cjs +32 -2
- package/dist/rules/tagLines.cjs.map +1 -1
- package/dist/rules/textEscaping.cjs +5 -1
- package/dist/rules/textEscaping.cjs.map +1 -1
- package/dist/rules/typeFormatting.cjs +64 -16
- package/dist/rules/typeFormatting.cjs.map +1 -1
- package/dist/rules/validTypes.cjs +8 -1
- package/dist/rules/validTypes.cjs.map +1 -1
- package/dist/rules.d.ts +2130 -32
- package/package.json +1 -1
- package/src/buildForbidRuleDefinition.js +0 -1
- package/src/buildRejectOrPreferRuleDefinition.js +12 -2
- package/src/index-cjs.js +36 -0
- package/src/index.js +36 -0
- package/src/rules/checkAccess.js +1 -1
- package/src/rules/checkAlignment.js +3 -0
- package/src/rules/checkExamples.js +1 -1
- package/src/rules/checkIndentation.js +19 -0
- package/src/rules/checkLineAlignment.js +24 -0
- package/src/rules/checkParamNames.js +62 -1
- package/src/rules/checkPropertyNames.js +6 -0
- package/src/rules/checkTagNames.js +71 -0
- package/src/rules/checkTypes.js +16 -1
- package/src/rules/checkValues.js +16 -0
- package/src/rules/convertToJsdocComments.js +48 -0
- package/src/rules/emptyTags.js +10 -1
- package/src/rules/implementsOnClasses.js +15 -1
- package/src/rules/informativeDocs.js +45 -0
- package/src/rules/linesBeforeBlock.js +14 -0
- package/src/rules/matchDescription.js +129 -0
- package/src/rules/matchName.js +30 -0
- package/src/rules/multilineBlocks.js +77 -5
- package/src/rules/noBadBlocks.js +11 -2
- package/src/rules/noBlankBlockDescriptions.js +1 -1
- package/src/rules/noBlankBlocks.js +2 -0
- package/src/rules/noDefaults.js +19 -0
- package/src/rules/noMissingSyntax.js +22 -2
- package/src/rules/noMultiAsterisks.js +29 -0
- package/src/rules/noRestrictedSyntax.js +17 -1
- package/src/rules/noTypes.js +17 -1
- package/src/rules/noUndefinedTypes.js +11 -1
- package/src/rules/requireAsteriskPrefix.js +28 -0
- package/src/rules/requireDescription.js +30 -1
- package/src/rules/requireDescriptionCompleteSentence.js +27 -0
- package/src/rules/requireExample.js +26 -1
- package/src/rules/requireFileOverview.js +61 -0
- package/src/rules/requireHyphenBeforeParamDescription.js +19 -1
- package/src/rules/requireJsdoc.js +80 -1
- package/src/rules/requireParam.js +213 -1
- package/src/rules/requireParamDescription.js +21 -0
- package/src/rules/requireParamName.js +16 -1
- package/src/rules/requireParamType.js +21 -1
- package/src/rules/requirePropertyName.js +1 -1
- package/src/rules/requirePropertyType.js +1 -1
- package/src/rules/requireReturns.js +54 -1
- package/src/rules/requireReturnsCheck.js +22 -1
- package/src/rules/requireReturnsDescription.js +15 -1
- package/src/rules/requireReturnsType.js +15 -1
- package/src/rules/requireTemplate.js +17 -1
- package/src/rules/requireThrows.js +18 -1
- package/src/rules/requireYields.js +50 -1
- package/src/rules/requireYieldsCheck.js +25 -7
- package/src/rules/sortTags.js +200 -1
- package/src/rules/tagLines.js +30 -0
- package/src/rules/textEscaping.js +5 -1
- package/src/rules/typeFormatting.js +57 -19
- package/src/rules/validTypes.js +8 -1
- package/src/rules.d.ts +2130 -32
- package/typings/gitdown.d.ts +4 -0
package/dist/rules.d.ts
CHANGED
|
@@ -7,11 +7,15 @@ export interface Rules {
|
|
|
7
7
|
| []
|
|
8
8
|
| [
|
|
9
9
|
{
|
|
10
|
+
/**
|
|
11
|
+
* Set to 0 if you wish to avoid the normal requirement for an inner indentation of
|
|
12
|
+
* one space. Defaults to 1 (one space of normal inner indentation).
|
|
13
|
+
*/
|
|
10
14
|
innerIndent?: number;
|
|
11
15
|
}
|
|
12
16
|
];
|
|
13
17
|
|
|
14
|
-
/** Ensures that (JavaScript)
|
|
18
|
+
/** Ensures that (JavaScript) samples within `@example` tags adhere to ESLint rules. */
|
|
15
19
|
"jsdoc/check-examples":
|
|
16
20
|
| []
|
|
17
21
|
| [
|
|
@@ -43,6 +47,27 @@ export interface Rules {
|
|
|
43
47
|
| []
|
|
44
48
|
| [
|
|
45
49
|
{
|
|
50
|
+
/**
|
|
51
|
+
* Array of tags (e.g., `['example', 'description']`) whose content will be
|
|
52
|
+
* "hidden" from the `check-indentation` rule. Defaults to `['example']`.
|
|
53
|
+
*
|
|
54
|
+
* By default, the whole JSDoc block will be checked for invalid padding.
|
|
55
|
+
* That would include `@example` blocks too, which can get in the way
|
|
56
|
+
* of adding full, readable examples of code without ending up with multiple
|
|
57
|
+
* linting issues.
|
|
58
|
+
*
|
|
59
|
+
* When disabled (by passing `excludeTags: []` option), the following code *will*
|
|
60
|
+
* report a padding issue:
|
|
61
|
+
*
|
|
62
|
+
* ```js
|
|
63
|
+
* /**
|
|
64
|
+
* * @example
|
|
65
|
+
* * anArray.filter((a) => {
|
|
66
|
+
* * return a.b;
|
|
67
|
+
* * });
|
|
68
|
+
* * /
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
46
71
|
excludeTags?: string[];
|
|
47
72
|
}
|
|
48
73
|
];
|
|
@@ -54,32 +79,144 @@ export interface Rules {
|
|
|
54
79
|
| [
|
|
55
80
|
"always" | "never" | "any",
|
|
56
81
|
{
|
|
82
|
+
/**
|
|
83
|
+
* An object with any of the following spacing keys set to an integer.
|
|
84
|
+
* If a spacing is not defined, it defaults to one.
|
|
85
|
+
*
|
|
86
|
+
*/
|
|
57
87
|
customSpacings?: {
|
|
88
|
+
/**
|
|
89
|
+
* Affects spacing after the asterisk (e.g., `* @param`)
|
|
90
|
+
*/
|
|
58
91
|
postDelimiter?: number;
|
|
92
|
+
/**
|
|
93
|
+
* Affects spacing after any hyphens in the description (e.g., `* @param {someType} name - A description`)
|
|
94
|
+
*/
|
|
59
95
|
postHyphen?: number;
|
|
96
|
+
/**
|
|
97
|
+
* Affects spacing after the name (e.g., `* @param {someType} name `)
|
|
98
|
+
*/
|
|
60
99
|
postName?: number;
|
|
100
|
+
/**
|
|
101
|
+
* Affects spacing after the tag (e.g., `* @param `)
|
|
102
|
+
*/
|
|
61
103
|
postTag?: number;
|
|
104
|
+
/**
|
|
105
|
+
* Affects spacing after the type (e.g., `* @param {someType} `)
|
|
106
|
+
*/
|
|
62
107
|
postType?: number;
|
|
63
108
|
};
|
|
109
|
+
/**
|
|
110
|
+
* Disables `wrapIndent`; existing wrap indentation is preserved without changes.
|
|
111
|
+
*/
|
|
64
112
|
disableWrapIndent?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* A boolean to determine whether to preserve the post-delimiter spacing of the
|
|
115
|
+
* main description. If `false` or unset, will be set to a single space.
|
|
116
|
+
*/
|
|
65
117
|
preserveMainDescriptionPostDelimiter?: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Use this to change the tags which are sought for alignment changes. Defaults to an array of
|
|
120
|
+
* `['param', 'arg', 'argument', 'property', 'prop', 'returns', 'return', 'template']`.
|
|
121
|
+
*/
|
|
66
122
|
tags?: string[];
|
|
123
|
+
/**
|
|
124
|
+
* The indent that will be applied for tag text after the first line.
|
|
125
|
+
* Default to the empty string (no indent).
|
|
126
|
+
*/
|
|
67
127
|
wrapIndent?: string;
|
|
68
128
|
}
|
|
69
129
|
];
|
|
70
130
|
|
|
71
|
-
/**
|
|
131
|
+
/** Checks for dupe `@param` names, that nested param names have roots, and that parameter names in function declarations match JSDoc param names. */
|
|
72
132
|
"jsdoc/check-param-names":
|
|
73
133
|
| []
|
|
74
134
|
| [
|
|
75
135
|
{
|
|
136
|
+
/**
|
|
137
|
+
* If set to `true`, this option will allow extra `@param` definitions (e.g.,
|
|
138
|
+
* representing future expected or virtual params) to be present without needing
|
|
139
|
+
* their presence within the function signature. Other inconsistencies between
|
|
140
|
+
* `@param`'s and present function parameters will still be reported.
|
|
141
|
+
*/
|
|
76
142
|
allowExtraTrailingParamDocs?: boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Whether to check destructured properties. Defaults to `true`.
|
|
145
|
+
*/
|
|
77
146
|
checkDestructured?: boolean;
|
|
147
|
+
/**
|
|
148
|
+
* If set to `true`, will require that rest properties are documented and
|
|
149
|
+
* that any extraneous properties (which may have been within the rest property)
|
|
150
|
+
* are documented. Defaults to `false`.
|
|
151
|
+
*/
|
|
78
152
|
checkRestProperty?: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* Defines a regular expression pattern to indicate which types should be
|
|
155
|
+
* checked for destructured content (and that those not matched should not
|
|
156
|
+
* be checked).
|
|
157
|
+
*
|
|
158
|
+
* When one specifies a type, unless it is of a generic type, like `object`
|
|
159
|
+
* or `array`, it may be considered unnecessary to have that object's
|
|
160
|
+
* destructured components required, especially where generated docs will
|
|
161
|
+
* link back to the specified type. For example:
|
|
162
|
+
*
|
|
163
|
+
* ```js
|
|
164
|
+
* /**
|
|
165
|
+
* * @param {SVGRect} bbox - a SVGRect
|
|
166
|
+
* * /
|
|
167
|
+
* export const bboxToObj = function ({x, y, width, height}) {
|
|
168
|
+
* return {x, y, width, height};
|
|
169
|
+
* };
|
|
170
|
+
* ```
|
|
171
|
+
*
|
|
172
|
+
* By default `checkTypesPattern` is set to
|
|
173
|
+
* `/^(?:[oO]bject|[aA]rray|PlainObject|Generic(?:Object|Array))$/v`,
|
|
174
|
+
* meaning that destructuring will be required only if the type of the `@param`
|
|
175
|
+
* (the text between curly brackets) is a match for "Object" or "Array" (with or
|
|
176
|
+
* without initial caps), "PlainObject", or "GenericObject", "GenericArray" (or
|
|
177
|
+
* if no type is present). So in the above example, the lack of a match will
|
|
178
|
+
* mean that no complaint will be given about the undocumented destructured
|
|
179
|
+
* parameters.
|
|
180
|
+
*
|
|
181
|
+
* Note that the `/` delimiters are optional, but necessary to add flags.
|
|
182
|
+
*
|
|
183
|
+
* Defaults to using (only) the `v` flag, so to add your own flags, encapsulate
|
|
184
|
+
* your expression as a string, but like a literal, e.g., `/^object$/vi`.
|
|
185
|
+
*
|
|
186
|
+
* You could set this regular expression to a more expansive list, or you
|
|
187
|
+
* could restrict it such that even types matching those strings would not
|
|
188
|
+
* need destructuring.
|
|
189
|
+
*/
|
|
79
190
|
checkTypesPattern?: string;
|
|
191
|
+
/**
|
|
192
|
+
* Whether to check for extra destructured properties. Defaults to `false`. Change
|
|
193
|
+
* to `true` if you want to be able to document properties which are not actually
|
|
194
|
+
* destructured. Keep as `false` if you expect properties to be documented in
|
|
195
|
+
* their own types. Note that extra properties will always be reported if another
|
|
196
|
+
* item at the same level is destructured as destructuring will prevent other
|
|
197
|
+
* access and this option is only intended to permit documenting extra properties
|
|
198
|
+
* that are available and actually used in the function.
|
|
199
|
+
*/
|
|
80
200
|
disableExtraPropertyReporting?: boolean;
|
|
201
|
+
/**
|
|
202
|
+
* Whether to avoid checks for missing `@param` definitions. Defaults to `false`. Change to `true` if you want to be able to omit properties.
|
|
203
|
+
*/
|
|
81
204
|
disableMissingParamChecks?: boolean;
|
|
205
|
+
/**
|
|
206
|
+
* Set to `true` to auto-remove `@param` duplicates (based on identical
|
|
207
|
+
* names).
|
|
208
|
+
*
|
|
209
|
+
* Note that this option will remove duplicates of the same name even if
|
|
210
|
+
* the definitions do not match in other ways (e.g., the second param will
|
|
211
|
+
* be removed even if it has a different type or description).
|
|
212
|
+
*/
|
|
82
213
|
enableFixer?: boolean;
|
|
214
|
+
/**
|
|
215
|
+
* Set to `true` if you wish to avoid reporting of child property documentation
|
|
216
|
+
* where instead of destructuring, a whole plain object is supplied as default
|
|
217
|
+
* value but you wish its keys to be considered as signalling that the properties
|
|
218
|
+
* are present and can therefore be documented. Defaults to `false`.
|
|
219
|
+
*/
|
|
83
220
|
useDefaultObjectProperties?: boolean;
|
|
84
221
|
}
|
|
85
222
|
];
|
|
@@ -89,6 +226,14 @@ export interface Rules {
|
|
|
89
226
|
| []
|
|
90
227
|
| [
|
|
91
228
|
{
|
|
229
|
+
/**
|
|
230
|
+
* Set to `true` to auto-remove `@property` duplicates (based on
|
|
231
|
+
* identical names).
|
|
232
|
+
*
|
|
233
|
+
* Note that this option will remove duplicates of the same name even if
|
|
234
|
+
* the definitions do not match in other ways (e.g., the second property will
|
|
235
|
+
* be removed even if it has a different type or description).
|
|
236
|
+
*/
|
|
92
237
|
enableFixer?: boolean;
|
|
93
238
|
}
|
|
94
239
|
];
|
|
@@ -101,9 +246,88 @@ export interface Rules {
|
|
|
101
246
|
| []
|
|
102
247
|
| [
|
|
103
248
|
{
|
|
249
|
+
/**
|
|
250
|
+
* Use an array of `definedTags` strings to configure additional, allowed tags.
|
|
251
|
+
* The format is as follows:
|
|
252
|
+
*
|
|
253
|
+
* ```json
|
|
254
|
+
* {
|
|
255
|
+
* "definedTags": ["note", "record"]
|
|
256
|
+
* }
|
|
257
|
+
* ```
|
|
258
|
+
*/
|
|
104
259
|
definedTags?: string[];
|
|
260
|
+
/**
|
|
261
|
+
* Set to `false` to disable auto-removal of types that are redundant with the [`typed` option](#typed).
|
|
262
|
+
*/
|
|
105
263
|
enableFixer?: boolean;
|
|
264
|
+
/**
|
|
265
|
+
* If this is set to `true`, all of the following tags used to control JSX output are allowed:
|
|
266
|
+
*
|
|
267
|
+
* ```
|
|
268
|
+
* jsx
|
|
269
|
+
* jsxFrag
|
|
270
|
+
* jsxImportSource
|
|
271
|
+
* jsxRuntime
|
|
272
|
+
* ```
|
|
273
|
+
*
|
|
274
|
+
* For more information, see the [babel documentation](https://babeljs.io/docs/en/babel-plugin-transform-react-jsx).
|
|
275
|
+
*/
|
|
106
276
|
jsxTags?: boolean;
|
|
277
|
+
/**
|
|
278
|
+
* If this is set to `true`, additionally checks for tag names that are redundant when using a type checker such as TypeScript.
|
|
279
|
+
*
|
|
280
|
+
* These tags are always unnecessary when using TypeScript or similar:
|
|
281
|
+
*
|
|
282
|
+
* ```
|
|
283
|
+
* augments
|
|
284
|
+
* callback
|
|
285
|
+
* class
|
|
286
|
+
* enum
|
|
287
|
+
* implements
|
|
288
|
+
* private
|
|
289
|
+
* property
|
|
290
|
+
* protected
|
|
291
|
+
* public
|
|
292
|
+
* readonly
|
|
293
|
+
* this
|
|
294
|
+
* type
|
|
295
|
+
* typedef
|
|
296
|
+
* ```
|
|
297
|
+
*
|
|
298
|
+
* These tags are unnecessary except when inside a TypeScript `declare` context:
|
|
299
|
+
*
|
|
300
|
+
* ```
|
|
301
|
+
* abstract
|
|
302
|
+
* access
|
|
303
|
+
* class
|
|
304
|
+
* constant
|
|
305
|
+
* constructs
|
|
306
|
+
* default
|
|
307
|
+
* enum
|
|
308
|
+
* export
|
|
309
|
+
* exports
|
|
310
|
+
* function
|
|
311
|
+
* global
|
|
312
|
+
* inherits
|
|
313
|
+
* instance
|
|
314
|
+
* interface
|
|
315
|
+
* member
|
|
316
|
+
* memberof
|
|
317
|
+
* memberOf
|
|
318
|
+
* method
|
|
319
|
+
* mixes
|
|
320
|
+
* mixin
|
|
321
|
+
* module
|
|
322
|
+
* name
|
|
323
|
+
* namespace
|
|
324
|
+
* override
|
|
325
|
+
* property
|
|
326
|
+
* requires
|
|
327
|
+
* static
|
|
328
|
+
* this
|
|
329
|
+
* ```
|
|
330
|
+
*/
|
|
107
331
|
typed?: boolean;
|
|
108
332
|
}
|
|
109
333
|
];
|
|
@@ -111,18 +335,41 @@ export interface Rules {
|
|
|
111
335
|
/** Checks that any `@template` names are actually used in the connected `@typedef` or type alias. */
|
|
112
336
|
"jsdoc/check-template-names": [];
|
|
113
337
|
|
|
114
|
-
/** Reports invalid
|
|
338
|
+
/** Reports types deemed invalid (customizable and with defaults, for preventing and/or recommending replacements). */
|
|
115
339
|
"jsdoc/check-types":
|
|
116
340
|
| []
|
|
117
341
|
| [
|
|
118
342
|
{
|
|
343
|
+
/**
|
|
344
|
+
* Avoids reporting when a bad type is found on a specified tag.
|
|
345
|
+
*/
|
|
119
346
|
exemptTagContexts?: {
|
|
347
|
+
/**
|
|
348
|
+
* Set a key `tag` to the tag to exempt
|
|
349
|
+
*/
|
|
120
350
|
tag?: string;
|
|
351
|
+
/**
|
|
352
|
+
* Set to `true` to indicate that any types on that tag will be allowed,
|
|
353
|
+
* or to an array of strings which will only allow specific bad types.
|
|
354
|
+
* If an array of strings is given, these must match the type exactly,
|
|
355
|
+
* e.g., if you only allow `"object"`, it will not allow
|
|
356
|
+
* `"object<string, string>"`. Note that this is different from the
|
|
357
|
+
* behavior of `settings.jsdoc.preferredTypes`. This option is useful
|
|
358
|
+
* for normally restricting generic types like `object` with
|
|
359
|
+
* `preferredTypes`, but allowing `typedef` to indicate that its base
|
|
360
|
+
* type is `object`.
|
|
361
|
+
*/
|
|
121
362
|
types?: boolean | string[];
|
|
122
363
|
}[];
|
|
364
|
+
/**
|
|
365
|
+
* Insists that only the supplied option type
|
|
366
|
+
* map is to be used, and that the default preferences (such as "string"
|
|
367
|
+
* over "String") will not be enforced. The option's default is `false`.
|
|
368
|
+
*/
|
|
123
369
|
noDefaults?: boolean;
|
|
124
370
|
/**
|
|
125
|
-
* @deprecated Use the `preferredTypes[preferredType]` setting of the same name instead
|
|
371
|
+
* @deprecated Use the `preferredTypes[preferredType]` setting of the same name instead.
|
|
372
|
+
* If this option is `true`, will currently override `unifyParentAndChildTypeChecks` on the `preferredTypes` setting.
|
|
126
373
|
*/
|
|
127
374
|
unifyParentAndChildTypeChecks?: boolean;
|
|
128
375
|
}
|
|
@@ -133,9 +380,33 @@ export interface Rules {
|
|
|
133
380
|
| []
|
|
134
381
|
| [
|
|
135
382
|
{
|
|
383
|
+
/**
|
|
384
|
+
* An array of allowable author values. If absent, only non-whitespace will
|
|
385
|
+
* be checked for.
|
|
386
|
+
*/
|
|
136
387
|
allowedAuthors?: string[];
|
|
388
|
+
/**
|
|
389
|
+
* An array of allowable license values or `true` to allow any license text.
|
|
390
|
+
* If present as an array, will be used in place of [SPDX identifiers](https://spdx.org/licenses/).
|
|
391
|
+
*/
|
|
137
392
|
allowedLicenses?: string[] | boolean;
|
|
393
|
+
/**
|
|
394
|
+
* A string to be converted into a `RegExp` (with `v` flag) and whose first
|
|
395
|
+
* parenthetical grouping, if present, will match the portion of the license
|
|
396
|
+
* description to check (if no grouping is present, then the whole portion
|
|
397
|
+
* matched will be used). Defaults to `/([^\n\r]*)/gv`, i.e., the SPDX expression
|
|
398
|
+
* is expected before any line breaks.
|
|
399
|
+
*
|
|
400
|
+
* Note that the `/` delimiters are optional, but necessary to add flags.
|
|
401
|
+
*
|
|
402
|
+
* Defaults to using the `v` flag, so to add your own flags, encapsulate
|
|
403
|
+
* your expression as a string, but like a literal, e.g., `/^mit$/vi`.
|
|
404
|
+
*/
|
|
138
405
|
licensePattern?: string;
|
|
406
|
+
/**
|
|
407
|
+
* Whether to enable validation that `@variation` must be a number. Defaults to
|
|
408
|
+
* `false`.
|
|
409
|
+
*/
|
|
139
410
|
numericOnlyVariation?: boolean;
|
|
140
411
|
}
|
|
141
412
|
];
|
|
@@ -145,7 +416,23 @@ export interface Rules {
|
|
|
145
416
|
| []
|
|
146
417
|
| [
|
|
147
418
|
{
|
|
419
|
+
/**
|
|
420
|
+
* An array of prefixes to allow at the beginning of a comment.
|
|
421
|
+
*
|
|
422
|
+
* Defaults to `['@ts-', 'istanbul ', 'c8 ', 'v8 ', 'eslint', 'prettier-']`.
|
|
423
|
+
*
|
|
424
|
+
* Supplying your own value overrides the defaults.
|
|
425
|
+
*/
|
|
148
426
|
allowedPrefixes?: string[];
|
|
427
|
+
/**
|
|
428
|
+
* The contexts array which will be checked for preceding content.
|
|
429
|
+
*
|
|
430
|
+
* Can either be strings or an object with a `context` string and an optional, default `false` `inlineCommentBlock` boolean.
|
|
431
|
+
*
|
|
432
|
+
* Defaults to `ArrowFunctionExpression`, `FunctionDeclaration`,
|
|
433
|
+
* `FunctionExpression`, `TSDeclareFunction`.
|
|
434
|
+
*
|
|
435
|
+
*/
|
|
149
436
|
contexts?: (
|
|
150
437
|
| string
|
|
151
438
|
| {
|
|
@@ -153,6 +440,13 @@ export interface Rules {
|
|
|
153
440
|
inlineCommentBlock?: boolean;
|
|
154
441
|
}
|
|
155
442
|
)[];
|
|
443
|
+
/**
|
|
444
|
+
* The contexts array which will be checked for content on the same line after.
|
|
445
|
+
*
|
|
446
|
+
* Can either be strings or an object with a `context` string and an optional, default `false` `inlineCommentBlock` boolean.
|
|
447
|
+
*
|
|
448
|
+
* Defaults to an empty array.
|
|
449
|
+
*/
|
|
156
450
|
contextsAfter?: (
|
|
157
451
|
| string
|
|
158
452
|
| {
|
|
@@ -160,6 +454,14 @@ export interface Rules {
|
|
|
160
454
|
inlineCommentBlock?: boolean;
|
|
161
455
|
}
|
|
162
456
|
)[];
|
|
457
|
+
/**
|
|
458
|
+
* The contexts array which will be checked for content before and on the same
|
|
459
|
+
* line after.
|
|
460
|
+
*
|
|
461
|
+
* Can either be strings or an object with a `context` string and an optional, default `false` `inlineCommentBlock` boolean.
|
|
462
|
+
*
|
|
463
|
+
* Defaults to `VariableDeclarator`, `TSPropertySignature`, `PropertyDefinition`.
|
|
464
|
+
*/
|
|
163
465
|
contextsBeforeAndAfter?: (
|
|
164
466
|
| string
|
|
165
467
|
| {
|
|
@@ -167,26 +469,84 @@ export interface Rules {
|
|
|
167
469
|
inlineCommentBlock?: boolean;
|
|
168
470
|
}
|
|
169
471
|
)[];
|
|
472
|
+
/**
|
|
473
|
+
* Set to `false` to disable fixing.
|
|
474
|
+
*/
|
|
170
475
|
enableFixer?: boolean;
|
|
476
|
+
/**
|
|
477
|
+
* What policy to enforce on the conversion of non-JSDoc comments without
|
|
478
|
+
* line breaks. (Non-JSDoc (mulitline) comments with line breaks will always
|
|
479
|
+
* be converted to `multi` style JSDoc comments.)
|
|
480
|
+
*
|
|
481
|
+
* - `multi` - Convert to multi-line style
|
|
482
|
+
* ```js
|
|
483
|
+
* /**
|
|
484
|
+
* * Some text
|
|
485
|
+
* * /
|
|
486
|
+
* ```
|
|
487
|
+
* - `single` - Convert to single-line style
|
|
488
|
+
* ```js
|
|
489
|
+
* /** Some text * /
|
|
490
|
+
* ```
|
|
491
|
+
*
|
|
492
|
+
* Defaults to `multi`.
|
|
493
|
+
*
|
|
494
|
+
*/
|
|
171
495
|
enforceJsdocLineStyle?: "multi" | "single";
|
|
496
|
+
/**
|
|
497
|
+
* What style of comments to which to apply JSDoc conversion.
|
|
498
|
+
*
|
|
499
|
+
* - `block` - Applies to block-style comments (`/* ... * /`)
|
|
500
|
+
* - `line` - Applies to line-style comments (`// ...`)
|
|
501
|
+
* - `both` - Applies to both block and line-style comments
|
|
502
|
+
*
|
|
503
|
+
* Defaults to `both`.
|
|
504
|
+
*/
|
|
172
505
|
lineOrBlockStyle?: "block" | "line" | "both";
|
|
173
506
|
}
|
|
174
507
|
];
|
|
175
508
|
|
|
176
|
-
/**
|
|
509
|
+
/** Checks tags that are expected to be empty (e.g., `@abstract` or `@async`), reporting if they have content */
|
|
177
510
|
"jsdoc/empty-tags":
|
|
178
511
|
| []
|
|
179
512
|
| [
|
|
180
513
|
{
|
|
514
|
+
/**
|
|
515
|
+
* If you want additional tags to be checked for their descriptions, you may
|
|
516
|
+
* add them within this option.
|
|
517
|
+
*
|
|
518
|
+
* ```js
|
|
519
|
+
* {
|
|
520
|
+
* 'jsdoc/empty-tags': ['error', {tags: ['event']}]
|
|
521
|
+
* }
|
|
522
|
+
* ```
|
|
523
|
+
*
|
|
524
|
+
*/
|
|
181
525
|
tags?: string[];
|
|
182
526
|
}
|
|
183
527
|
];
|
|
184
528
|
|
|
185
|
-
/**
|
|
529
|
+
/** Prohibits use of `@implements` on non-constructor functions (to enforce the tag only being used on classes/constructors). */
|
|
186
530
|
"jsdoc/implements-on-classes":
|
|
187
531
|
| []
|
|
188
532
|
| [
|
|
189
533
|
{
|
|
534
|
+
/**
|
|
535
|
+
* Set this to an array of strings representing the AST context (or an object with
|
|
536
|
+
* `context` and `comment` properties) where you wish the rule to be applied.
|
|
537
|
+
*
|
|
538
|
+
* `context` defaults to `any` and `comment` defaults to no specific comment context.
|
|
539
|
+
*
|
|
540
|
+
* Overrides the default contexts (`ArrowFunctionExpression`, `FunctionDeclaration`,
|
|
541
|
+
* `FunctionExpression`). Set to `"any"` if you want
|
|
542
|
+
* the rule to apply to any JSDoc block throughout your files (as is necessary
|
|
543
|
+
* for finding function blocks not attached to a function declaration or
|
|
544
|
+
* expression, i.e., `@callback` or `@function` (or its aliases `@func` or
|
|
545
|
+
* `@method`) (including those associated with an `@interface`).
|
|
546
|
+
*
|
|
547
|
+
* See the ["AST and Selectors"](../#advanced-ast-and-selectors)
|
|
548
|
+
* section of our Advanced docs for more on the expected format.
|
|
549
|
+
*/
|
|
190
550
|
contexts?: (
|
|
191
551
|
| string
|
|
192
552
|
| {
|
|
@@ -205,6 +565,25 @@ export interface Rules {
|
|
|
205
565
|
| []
|
|
206
566
|
| [
|
|
207
567
|
{
|
|
568
|
+
/**
|
|
569
|
+
* The `aliases` option allows indicating words as synonyms (aliases) of each other.
|
|
570
|
+
*
|
|
571
|
+
* For example, with `{ aliases: { emoji: ["smiley", "winkey"] } }`, the following comment would be considered uninformative:
|
|
572
|
+
*
|
|
573
|
+
* ```js
|
|
574
|
+
* /** A smiley/winkey. * /
|
|
575
|
+
* let emoji;
|
|
576
|
+
* ```
|
|
577
|
+
*
|
|
578
|
+
* The default `aliases` option is:
|
|
579
|
+
*
|
|
580
|
+
* ```json
|
|
581
|
+
* {
|
|
582
|
+
* "a": ["an", "our"]
|
|
583
|
+
* }
|
|
584
|
+
* ```
|
|
585
|
+
*
|
|
586
|
+
*/
|
|
208
587
|
aliases?: {
|
|
209
588
|
/**
|
|
210
589
|
* This interface was referenced by `undefined`'s JSON-Schema definition
|
|
@@ -212,7 +591,39 @@ export interface Rules {
|
|
|
212
591
|
*/
|
|
213
592
|
[k: string]: string[];
|
|
214
593
|
};
|
|
594
|
+
/**
|
|
595
|
+
* Tags that should not be checked for valid contents.
|
|
596
|
+
*
|
|
597
|
+
* For example, with `{ excludedTags: ["category"] }`, the following comment would not be considered uninformative:
|
|
598
|
+
*
|
|
599
|
+
* ```js
|
|
600
|
+
* /** @category Types * /
|
|
601
|
+
* function computeTypes(node) {
|
|
602
|
+
* // ...
|
|
603
|
+
* }
|
|
604
|
+
* ```
|
|
605
|
+
*
|
|
606
|
+
* No tags are excluded by default.
|
|
607
|
+
*
|
|
608
|
+
*/
|
|
215
609
|
excludedTags?: string[];
|
|
610
|
+
/**
|
|
611
|
+
* Words that are ignored when searching for one that adds meaning.
|
|
612
|
+
*
|
|
613
|
+
* For example, with `{ uselessWords: ["our"] }`, the following comment would be considered uninformative:
|
|
614
|
+
*
|
|
615
|
+
* ```js
|
|
616
|
+
* /** Our text. * /
|
|
617
|
+
* let text;
|
|
618
|
+
* ```
|
|
619
|
+
*
|
|
620
|
+
* The default `uselessWords` option is:
|
|
621
|
+
*
|
|
622
|
+
* ```json
|
|
623
|
+
* ["a", "an", "i", "in", "of", "s", "the"]
|
|
624
|
+
* ```
|
|
625
|
+
*
|
|
626
|
+
*/
|
|
216
627
|
uselessWords?: string[];
|
|
217
628
|
}
|
|
218
629
|
];
|
|
@@ -222,10 +633,34 @@ export interface Rules {
|
|
|
222
633
|
| []
|
|
223
634
|
| [
|
|
224
635
|
{
|
|
636
|
+
/**
|
|
637
|
+
* Whether to additionally check the start of blocks, such as classes or functions.
|
|
638
|
+
* Defaults to `false`.
|
|
639
|
+
*
|
|
640
|
+
*/
|
|
225
641
|
checkBlockStarts?: boolean;
|
|
642
|
+
/**
|
|
643
|
+
* An array of tags whose presence in the JSDoc block will prevent the
|
|
644
|
+
* application of the rule. Defaults to `['type']` (i.e., if `@type` is present,
|
|
645
|
+
* lines before the block will not be added).
|
|
646
|
+
*
|
|
647
|
+
*/
|
|
226
648
|
excludedTags?: string[];
|
|
649
|
+
/**
|
|
650
|
+
* This option excludes cases where the JSDoc block occurs on the same line as a
|
|
651
|
+
* preceding code or comment. Defaults to `true`.
|
|
652
|
+
*
|
|
653
|
+
*/
|
|
227
654
|
ignoreSameLine?: boolean;
|
|
655
|
+
/**
|
|
656
|
+
* This option excludes cases where the JSDoc block is only one line long.
|
|
657
|
+
* Defaults to `true`.
|
|
658
|
+
*
|
|
659
|
+
*/
|
|
228
660
|
ignoreSingleLines?: boolean;
|
|
661
|
+
/**
|
|
662
|
+
* The minimum number of lines to require. Defaults to 1.
|
|
663
|
+
*/
|
|
229
664
|
lines?: number;
|
|
230
665
|
}
|
|
231
666
|
];
|
|
@@ -235,6 +670,21 @@ export interface Rules {
|
|
|
235
670
|
| []
|
|
236
671
|
| [
|
|
237
672
|
{
|
|
673
|
+
/**
|
|
674
|
+
* Set this to an array of strings representing the AST context (or an object with
|
|
675
|
+
* optional `context` and `comment` properties) where you wish the rule to be applied (e.g.,
|
|
676
|
+
* `ClassDeclaration` for ES6 classes).
|
|
677
|
+
*
|
|
678
|
+
* `context` defaults to `any` and `comment` defaults to no specific comment context.
|
|
679
|
+
*
|
|
680
|
+
* Overrides the default contexts (`ArrowFunctionExpression`, `FunctionDeclaration`,
|
|
681
|
+
* `FunctionExpression`). Set to `"any"` if you want the rule to apply to any
|
|
682
|
+
* JSDoc block throughout your files.
|
|
683
|
+
*
|
|
684
|
+
* See the ["AST and Selectors"](../#advanced-ast-and-selectors)
|
|
685
|
+
* section of our Advanced docs for more on the expected format.
|
|
686
|
+
*
|
|
687
|
+
*/
|
|
238
688
|
contexts?: (
|
|
239
689
|
| string
|
|
240
690
|
| {
|
|
@@ -242,6 +692,44 @@ export interface Rules {
|
|
|
242
692
|
context?: string;
|
|
243
693
|
}
|
|
244
694
|
)[];
|
|
695
|
+
/**
|
|
696
|
+
* If you wish to override the main block description without changing the
|
|
697
|
+
* default `match-description` (which can cascade to the `tags` with `true`),
|
|
698
|
+
* you may use `mainDescription`:
|
|
699
|
+
*
|
|
700
|
+
* ```js
|
|
701
|
+
* {
|
|
702
|
+
* 'jsdoc/match-description': ['error', {
|
|
703
|
+
* mainDescription: '[A-Z].*\\.',
|
|
704
|
+
* tags: {
|
|
705
|
+
* param: true,
|
|
706
|
+
* returns: true
|
|
707
|
+
* }
|
|
708
|
+
* }]
|
|
709
|
+
* }
|
|
710
|
+
* ```
|
|
711
|
+
*
|
|
712
|
+
* There is no need to add `mainDescription: true`, as by default, the main
|
|
713
|
+
* block description (and only the main block description) is linted, though you
|
|
714
|
+
* may disable checking it by setting it to `false`.
|
|
715
|
+
*
|
|
716
|
+
* You may also provide an object with `message`:
|
|
717
|
+
*
|
|
718
|
+
* ```js
|
|
719
|
+
* {
|
|
720
|
+
* 'jsdoc/match-description': ['error', {
|
|
721
|
+
* mainDescription: {
|
|
722
|
+
* message: 'Capitalize first word of JSDoc block descriptions',
|
|
723
|
+
* match: '[A-Z].*\\.'
|
|
724
|
+
* },
|
|
725
|
+
* tags: {
|
|
726
|
+
* param: true,
|
|
727
|
+
* returns: true
|
|
728
|
+
* }
|
|
729
|
+
* }]
|
|
730
|
+
* }
|
|
731
|
+
* ```
|
|
732
|
+
*/
|
|
245
733
|
mainDescription?:
|
|
246
734
|
| string
|
|
247
735
|
| boolean
|
|
@@ -249,9 +737,97 @@ export interface Rules {
|
|
|
249
737
|
match?: string | boolean;
|
|
250
738
|
message?: string;
|
|
251
739
|
};
|
|
740
|
+
/**
|
|
741
|
+
* You can supply your own expression to override the default, passing a
|
|
742
|
+
* `matchDescription` string on the options object.
|
|
743
|
+
*
|
|
744
|
+
* Defaults to using (only) the `v` flag, so
|
|
745
|
+
* to add your own flags, encapsulate your expression as a string, but like a
|
|
746
|
+
* literal, e.g., `/[A-Z].*\./vi`.
|
|
747
|
+
*
|
|
748
|
+
* ```js
|
|
749
|
+
* {
|
|
750
|
+
* 'jsdoc/match-description': ['error', {matchDescription: '[A-Z].*\\.'}]
|
|
751
|
+
* }
|
|
752
|
+
* ```
|
|
753
|
+
*/
|
|
252
754
|
matchDescription?: string;
|
|
755
|
+
/**
|
|
756
|
+
* You may provide a custom default message by using the following format:
|
|
757
|
+
*
|
|
758
|
+
* ```js
|
|
759
|
+
* {
|
|
760
|
+
* 'jsdoc/match-description': ['error', {
|
|
761
|
+
* message: 'The default description should begin with a capital letter.'
|
|
762
|
+
* }]
|
|
763
|
+
* }
|
|
764
|
+
* ```
|
|
765
|
+
*
|
|
766
|
+
* This can be overridden per tag or for the main block description by setting
|
|
767
|
+
* `message` within `tags` or `mainDescription`, respectively.
|
|
768
|
+
*
|
|
769
|
+
*/
|
|
253
770
|
message?: string;
|
|
771
|
+
/**
|
|
772
|
+
* If not set to `false`, will enforce that the following tags have at least
|
|
773
|
+
* some content:
|
|
774
|
+
*
|
|
775
|
+
* - `@copyright`
|
|
776
|
+
* - `@example`
|
|
777
|
+
* - `@see`
|
|
778
|
+
* - `@todo`
|
|
779
|
+
*
|
|
780
|
+
* If you supply your own tag description for any of the above tags in `tags`,
|
|
781
|
+
* your description will take precedence.
|
|
782
|
+
*/
|
|
254
783
|
nonemptyTags?: boolean;
|
|
784
|
+
/**
|
|
785
|
+
* If you want different regular expressions to apply to tags, you may use
|
|
786
|
+
* the `tags` option object:
|
|
787
|
+
*
|
|
788
|
+
* ```js
|
|
789
|
+
* {
|
|
790
|
+
* 'jsdoc/match-description': ['error', {tags: {
|
|
791
|
+
* param: '\\- [A-Z].*\\.',
|
|
792
|
+
* returns: '[A-Z].*\\.'
|
|
793
|
+
* }}]
|
|
794
|
+
* }
|
|
795
|
+
* ```
|
|
796
|
+
*
|
|
797
|
+
* In place of a string, you can also add `true` to indicate that a particular
|
|
798
|
+
* tag should be linted with the `matchDescription` value (or the default).
|
|
799
|
+
*
|
|
800
|
+
* ```js
|
|
801
|
+
* {
|
|
802
|
+
* 'jsdoc/match-description': ['error', {tags: {
|
|
803
|
+
* param: true,
|
|
804
|
+
* returns: true
|
|
805
|
+
* }}]
|
|
806
|
+
* }
|
|
807
|
+
* ```
|
|
808
|
+
*
|
|
809
|
+
* Alternatively, you may supply an object with a `message` property to indicate
|
|
810
|
+
* the error message for that tag.
|
|
811
|
+
*
|
|
812
|
+
* ```js
|
|
813
|
+
* {
|
|
814
|
+
* 'jsdoc/match-description': ['error', {tags: {
|
|
815
|
+
* param: {message: 'Begin with a hyphen', match: '\\- [A-Z].*\\.'},
|
|
816
|
+
* returns: {message: 'Capitalize for returns (the default)', match: true}
|
|
817
|
+
* }}]
|
|
818
|
+
* }
|
|
819
|
+
* ```
|
|
820
|
+
*
|
|
821
|
+
* The tags `@param`/`@arg`/`@argument` and `@property`/`@prop` will be properly
|
|
822
|
+
* parsed to ensure that the matched "description" text includes only the text
|
|
823
|
+
* after the name.
|
|
824
|
+
*
|
|
825
|
+
* All other tags will treat the text following the tag name, a space, and
|
|
826
|
+
* an optional curly-bracketed type expression (and another space) as part of
|
|
827
|
+
* its "description" (e.g., for `@returns {someType} some description`, the
|
|
828
|
+
* description is `some description` while for `@some-tag xyz`, the description
|
|
829
|
+
* is `xyz`).
|
|
830
|
+
*/
|
|
255
831
|
tags?: {
|
|
256
832
|
/**
|
|
257
833
|
* This interface was referenced by `undefined`'s JSON-Schema definition
|
|
@@ -273,46 +849,195 @@ export interface Rules {
|
|
|
273
849
|
| []
|
|
274
850
|
| [
|
|
275
851
|
{
|
|
852
|
+
/**
|
|
853
|
+
* `match` is a required option containing an array of objects which determine
|
|
854
|
+
* the conditions whereby a name is reported as being problematic.
|
|
855
|
+
*
|
|
856
|
+
* These objects can have any combination of the following groups of optional
|
|
857
|
+
* properties, all of which act to confine one another.
|
|
858
|
+
*
|
|
859
|
+
* Note that `comment`, even if targeting a specific tag, is used to match the
|
|
860
|
+
* whole block. So if a `comment` finds its specific tag, it may still apply
|
|
861
|
+
* fixes found by the likes of `disallowName` even when a different tag has the
|
|
862
|
+
* disallowed name. An alternative is to ensure that `comment` finds the specific
|
|
863
|
+
* tag of the desired tag and/or name and no `disallowName` (or `allowName`) is
|
|
864
|
+
* supplied. In such a case, only one error will be reported, but no fixer will
|
|
865
|
+
* be applied, however.
|
|
866
|
+
*
|
|
867
|
+
*/
|
|
276
868
|
match: {
|
|
869
|
+
/**
|
|
870
|
+
* Indicates which names are allowed for the given tag (or `*`).
|
|
871
|
+
* Accepts a string regular expression (optionally wrapped between two
|
|
872
|
+
* `/` delimiters followed by optional flags) used to match the name.
|
|
873
|
+
*/
|
|
277
874
|
allowName?: string;
|
|
875
|
+
/**
|
|
876
|
+
* As with `context` but AST for the JSDoc block comment and types.
|
|
877
|
+
*/
|
|
278
878
|
comment?: string;
|
|
879
|
+
/**
|
|
880
|
+
* AST to confine the allowing or disallowing to JSDoc blocks
|
|
881
|
+
* associated with a particular context. See the
|
|
882
|
+
* ["AST and Selectors"](../#advanced-ast-and-selectors)
|
|
883
|
+
* section of our Advanced docs for more on the expected format.
|
|
884
|
+
*/
|
|
279
885
|
context?: string;
|
|
886
|
+
/**
|
|
887
|
+
* As with `allowName` but indicates names that are not allowed.
|
|
888
|
+
*/
|
|
280
889
|
disallowName?: string;
|
|
890
|
+
/**
|
|
891
|
+
* An optional custom message to use when there is a match.
|
|
892
|
+
*/
|
|
281
893
|
message?: string;
|
|
894
|
+
/**
|
|
895
|
+
* If `disallowName` is supplied and this value is present, it
|
|
896
|
+
* will replace the matched `disallowName` text.
|
|
897
|
+
*/
|
|
282
898
|
replacement?: string;
|
|
899
|
+
/**
|
|
900
|
+
* This array should include tag names or `*` to indicate the
|
|
901
|
+
* match will apply for all tags (except as confined by any context
|
|
902
|
+
* properties). If `*` is not used, then these rules will only apply to
|
|
903
|
+
* the specified tags. If `tags` is omitted, then `*` is assumed.
|
|
904
|
+
*/
|
|
283
905
|
tags?: string[];
|
|
284
906
|
}[];
|
|
285
907
|
}
|
|
286
908
|
];
|
|
287
909
|
|
|
288
|
-
/** Controls how and whether
|
|
910
|
+
/** Controls how and whether JSDoc blocks can be expressed as single or multiple line blocks. */
|
|
289
911
|
"jsdoc/multiline-blocks":
|
|
290
912
|
| []
|
|
291
913
|
| [
|
|
292
914
|
{
|
|
915
|
+
/**
|
|
916
|
+
* If `noMultilineBlocks` is set to `true` with this option and multiple tags are
|
|
917
|
+
* found in a block, an error will not be reported.
|
|
918
|
+
*
|
|
919
|
+
* Since multiple-tagged lines cannot be collapsed into a single line, this option
|
|
920
|
+
* prevents them from being reported. Set to `false` if you really want to report
|
|
921
|
+
* any blocks.
|
|
922
|
+
*
|
|
923
|
+
* This option will also be applied when there is a block description and a single
|
|
924
|
+
* tag (since a description cannot precede a tag on a single line, and also
|
|
925
|
+
* cannot be reliably added after the tag either).
|
|
926
|
+
*
|
|
927
|
+
* Defaults to `true`.
|
|
928
|
+
*/
|
|
293
929
|
allowMultipleTags?: boolean;
|
|
930
|
+
/**
|
|
931
|
+
* If `noMultilineBlocks` is set with this numeric option, multiline blocks will
|
|
932
|
+
* be permitted if containing at least the given amount of text.
|
|
933
|
+
*
|
|
934
|
+
* If not set, multiline blocks will not be permitted regardless of length unless
|
|
935
|
+
* a relevant tag is present and `multilineTags` is set.
|
|
936
|
+
*
|
|
937
|
+
* Defaults to not being in effect.
|
|
938
|
+
*/
|
|
294
939
|
minimumLengthForMultiline?: number;
|
|
940
|
+
/**
|
|
941
|
+
* If `noMultilineBlocks` is set with this option, multiline blocks may be allowed
|
|
942
|
+
* regardless of length as long as a tag or a tag of a certain type is present.
|
|
943
|
+
*
|
|
944
|
+
* If `*` is included in the array, the presence of a tags will allow for
|
|
945
|
+
* multiline blocks (but not when without any tags unless the amount of text is
|
|
946
|
+
* over an amount specified by `minimumLengthForMultiline`).
|
|
947
|
+
*
|
|
948
|
+
* If the array does not include `*` but lists certain tags, the presence of
|
|
949
|
+
* such a tag will cause multiline blocks to be allowed.
|
|
950
|
+
*
|
|
951
|
+
* You may set this to an empty array to prevent any tag from permitting multiple
|
|
952
|
+
* lines.
|
|
953
|
+
*
|
|
954
|
+
* Defaults to `['*']`.
|
|
955
|
+
*
|
|
956
|
+
*/
|
|
295
957
|
multilineTags?: "*" | string[];
|
|
958
|
+
/**
|
|
959
|
+
* For multiline blocks, any non-whitespace text preceding the `* /` on the final
|
|
960
|
+
* line will be reported. (Text preceding a newline is not reported.)
|
|
961
|
+
*
|
|
962
|
+
* `noMultilineBlocks` will have priority over this rule if it applies.
|
|
963
|
+
*
|
|
964
|
+
* Defaults to `true`.
|
|
965
|
+
*/
|
|
296
966
|
noFinalLineText?: boolean;
|
|
967
|
+
/**
|
|
968
|
+
* Requires that JSDoc blocks are restricted to single lines only unless impacted
|
|
969
|
+
* by the options `minimumLengthForMultiline`, `multilineTags`, or
|
|
970
|
+
* `allowMultipleTags`.
|
|
971
|
+
*
|
|
972
|
+
* Defaults to `false`.
|
|
973
|
+
*/
|
|
297
974
|
noMultilineBlocks?: boolean;
|
|
975
|
+
/**
|
|
976
|
+
* If this is `true`, any single line blocks will be reported, except those which
|
|
977
|
+
* are whitelisted in `singleLineTags`.
|
|
978
|
+
*
|
|
979
|
+
* Defaults to `false`.
|
|
980
|
+
*
|
|
981
|
+
*/
|
|
298
982
|
noSingleLineBlocks?: boolean;
|
|
983
|
+
/**
|
|
984
|
+
* For multiline blocks, any non-whitespace text immediately after the `/**` and
|
|
985
|
+
* space will be reported. (Text after a newline is not reported.)
|
|
986
|
+
*
|
|
987
|
+
* `noMultilineBlocks` will have priority over this rule if it applies.
|
|
988
|
+
*
|
|
989
|
+
* Defaults to `true`.
|
|
990
|
+
*/
|
|
299
991
|
noZeroLineText?: boolean;
|
|
992
|
+
/**
|
|
993
|
+
* If this number is set, it indicates a minimum line width for a single line of
|
|
994
|
+
* JSDoc content spread over a multi-line comment block. If a single line is under
|
|
995
|
+
* the minimum length, it will be reported so as to enforce single line JSDoc blocks
|
|
996
|
+
* for such cases. Blocks are not reported which have multi-line descriptions,
|
|
997
|
+
* multiple tags, a block description and tag, or tags with multi-line types or
|
|
998
|
+
* descriptions.
|
|
999
|
+
*
|
|
1000
|
+
* Defaults to `null`.
|
|
1001
|
+
*
|
|
1002
|
+
*/
|
|
300
1003
|
requireSingleLineUnderCount?: number;
|
|
1004
|
+
/**
|
|
1005
|
+
* An array of tags which can nevertheless be allowed as single line blocks when
|
|
1006
|
+
* `noSingleLineBlocks` is set. You may set this to a empty array to
|
|
1007
|
+
* cause all single line blocks to be reported. If `'*'` is present, then
|
|
1008
|
+
* the presence of a tag will allow single line blocks (but not if a tag is
|
|
1009
|
+
* missing).
|
|
1010
|
+
*
|
|
1011
|
+
* Defaults to `['lends', 'type']`.
|
|
1012
|
+
*/
|
|
301
1013
|
singleLineTags?: string[];
|
|
302
1014
|
}
|
|
303
1015
|
];
|
|
304
1016
|
|
|
305
|
-
/** This rule checks for multi-line-style comments which fail to meet the criteria of a
|
|
1017
|
+
/** This rule checks for multi-line-style comments which fail to meet the criteria of a JSDoc block. */
|
|
306
1018
|
"jsdoc/no-bad-blocks":
|
|
307
1019
|
| []
|
|
308
1020
|
| [
|
|
309
1021
|
{
|
|
1022
|
+
/**
|
|
1023
|
+
* An array of directives that will not be reported if present at the beginning of
|
|
1024
|
+
* a multi-comment block and at-sign `/* @`.
|
|
1025
|
+
*
|
|
1026
|
+
* Defaults to `['ts-check', 'ts-expect-error', 'ts-ignore', 'ts-nocheck']`
|
|
1027
|
+
* (some directives [used by TypeScript](https://www.typescriptlang.org/docs/handbook/intro-to-js-ts.html#ts-check)).
|
|
1028
|
+
*
|
|
1029
|
+
*/
|
|
310
1030
|
ignore?: string[];
|
|
1031
|
+
/**
|
|
1032
|
+
* A boolean (defaulting to `false`) which if `true` will prevent all
|
|
1033
|
+
* JSDoc-like blocks with more than two initial asterisks even those without
|
|
1034
|
+
* apparent tag content.
|
|
1035
|
+
*/
|
|
311
1036
|
preventAllMultiAsteriskBlocks?: boolean;
|
|
312
1037
|
}
|
|
313
1038
|
];
|
|
314
1039
|
|
|
315
|
-
/**
|
|
1040
|
+
/** If tags are present, this rule will prevent empty lines in the block description. If no tags are present, this rule will prevent extra empty lines in the block description. */
|
|
316
1041
|
"jsdoc/no-blank-block-descriptions": [];
|
|
317
1042
|
|
|
318
1043
|
/** Removes empty blocks with nothing but possibly line breaks */
|
|
@@ -320,6 +1045,9 @@ export interface Rules {
|
|
|
320
1045
|
| []
|
|
321
1046
|
| [
|
|
322
1047
|
{
|
|
1048
|
+
/**
|
|
1049
|
+
* Whether or not to auto-remove the blank block. Defaults to `false`.
|
|
1050
|
+
*/
|
|
323
1051
|
enableFixer?: boolean;
|
|
324
1052
|
}
|
|
325
1053
|
];
|
|
@@ -329,6 +1057,22 @@ export interface Rules {
|
|
|
329
1057
|
| []
|
|
330
1058
|
| [
|
|
331
1059
|
{
|
|
1060
|
+
/**
|
|
1061
|
+
* Set this to an array of strings representing the AST context (or an object with
|
|
1062
|
+
* optional `context` and `comment` properties) where you wish the rule to be applied.
|
|
1063
|
+
*
|
|
1064
|
+
* `context` defaults to `any` and `comment` defaults to no specific comment context.
|
|
1065
|
+
*
|
|
1066
|
+
* Overrides the default contexts (`ArrowFunctionExpression`, `FunctionDeclaration`,
|
|
1067
|
+
* `FunctionExpression`). Set to `"any"` if you want
|
|
1068
|
+
* the rule to apply to any JSDoc block throughout your files (as is necessary
|
|
1069
|
+
* for finding function blocks not attached to a function declaration or
|
|
1070
|
+
* expression, i.e., `@callback` or `@function` (or its aliases `@func` or
|
|
1071
|
+
* `@method`) (including those associated with an `@interface`).
|
|
1072
|
+
*
|
|
1073
|
+
* See the ["AST and Selectors"](../#advanced-ast-and-selectors)
|
|
1074
|
+
* section of our Advanced docs for more on the expected format.
|
|
1075
|
+
*/
|
|
332
1076
|
contexts?: (
|
|
333
1077
|
| string
|
|
334
1078
|
| {
|
|
@@ -336,6 +1080,13 @@ export interface Rules {
|
|
|
336
1080
|
context?: string;
|
|
337
1081
|
}
|
|
338
1082
|
)[];
|
|
1083
|
+
/**
|
|
1084
|
+
* Set this to `true` to report the presence of optional parameters. May be
|
|
1085
|
+
* used if the project is insisting on optionality being indicated by
|
|
1086
|
+
* the presence of ES6 default parameters (bearing in mind that such
|
|
1087
|
+
* "defaults" are only applied when the supplied value is missing or
|
|
1088
|
+
* `undefined` but not for `null` or other "falsey" values).
|
|
1089
|
+
*/
|
|
339
1090
|
noOptionalParamNames?: boolean;
|
|
340
1091
|
}
|
|
341
1092
|
];
|
|
@@ -345,6 +1096,29 @@ export interface Rules {
|
|
|
345
1096
|
| []
|
|
346
1097
|
| [
|
|
347
1098
|
{
|
|
1099
|
+
/**
|
|
1100
|
+
* Set this to an array of strings representing the AST context (or an object with
|
|
1101
|
+
* optional `context` and `comment` properties) where you wish the rule to be applied.
|
|
1102
|
+
*
|
|
1103
|
+
* `context` defaults to `any` and `comment` defaults to no specific comment context.
|
|
1104
|
+
*
|
|
1105
|
+
* Use the `minimum` property (defaults to 1) to indicate how many are required
|
|
1106
|
+
* for the rule to be reported.
|
|
1107
|
+
*
|
|
1108
|
+
* Use the `message` property to indicate the specific error to be shown when an
|
|
1109
|
+
* error is reported for that context being found missing. You may use
|
|
1110
|
+
* `{{context}}` and `{{comment}}` with such messages. Defaults to
|
|
1111
|
+
* `"Syntax is required: {{context}}"`, or with a comment, to
|
|
1112
|
+
* `"Syntax is required: {{context}} with {{comment}}"`.
|
|
1113
|
+
*
|
|
1114
|
+
* Set to `"any"` if you want the rule to apply to any JSDoc block throughout
|
|
1115
|
+
* your files (as is necessary for finding function blocks not attached to a
|
|
1116
|
+
* function declaration or expression, i.e., `@callback` or `@function` (or its
|
|
1117
|
+
* aliases `@func` or `@method`) (including those associated with an `@interface`).
|
|
1118
|
+
*
|
|
1119
|
+
* See the ["AST and Selectors"](../#advanced-ast-and-selectors)
|
|
1120
|
+
* section of our Advanced docs for more on the expected format.
|
|
1121
|
+
*/
|
|
348
1122
|
contexts?: (
|
|
349
1123
|
| string
|
|
350
1124
|
| {
|
|
@@ -362,8 +1136,43 @@ export interface Rules {
|
|
|
362
1136
|
| []
|
|
363
1137
|
| [
|
|
364
1138
|
{
|
|
1139
|
+
/**
|
|
1140
|
+
* Set to `true` if you wish to allow asterisks after a space (as with Markdown):
|
|
1141
|
+
*
|
|
1142
|
+
* ```js
|
|
1143
|
+
* /**
|
|
1144
|
+
* * *bold* text
|
|
1145
|
+
* * /
|
|
1146
|
+
* ```
|
|
1147
|
+
*
|
|
1148
|
+
* Defaults to `false`.
|
|
1149
|
+
*/
|
|
365
1150
|
allowWhitespace?: boolean;
|
|
1151
|
+
/**
|
|
1152
|
+
* Prevent the likes of this:
|
|
1153
|
+
*
|
|
1154
|
+
* ```js
|
|
1155
|
+
* /**
|
|
1156
|
+
* *
|
|
1157
|
+
* *
|
|
1158
|
+
* ** /
|
|
1159
|
+
* ```
|
|
1160
|
+
*
|
|
1161
|
+
* Defaults to `true`.
|
|
1162
|
+
*/
|
|
366
1163
|
preventAtEnd?: boolean;
|
|
1164
|
+
/**
|
|
1165
|
+
* Prevent the likes of this:
|
|
1166
|
+
*
|
|
1167
|
+
* ```js
|
|
1168
|
+
* /**
|
|
1169
|
+
* *
|
|
1170
|
+
* **
|
|
1171
|
+
* * /
|
|
1172
|
+
* ```
|
|
1173
|
+
*
|
|
1174
|
+
* Defaults to `true`.
|
|
1175
|
+
*/
|
|
367
1176
|
preventAtMiddleLines?: boolean;
|
|
368
1177
|
}
|
|
369
1178
|
];
|
|
@@ -373,6 +1182,25 @@ export interface Rules {
|
|
|
373
1182
|
| []
|
|
374
1183
|
| [
|
|
375
1184
|
{
|
|
1185
|
+
/**
|
|
1186
|
+
* Set this to an array of strings representing the AST context (or an object with
|
|
1187
|
+
* `context` and `comment` properties) where you wish the rule to be applied.
|
|
1188
|
+
*
|
|
1189
|
+
* `context` defaults to `any` and `comment` defaults to no specific comment context.
|
|
1190
|
+
*
|
|
1191
|
+
* Use the `message` property to indicate the specific error to be shown when an
|
|
1192
|
+
* error is reported for that context being found. Defaults to
|
|
1193
|
+
* `"Syntax is restricted: {{context}}"`, or with a comment, to
|
|
1194
|
+
* `"Syntax is restricted: {{context}} with {{comment}}"`.
|
|
1195
|
+
*
|
|
1196
|
+
* Set to `"any"` if you want the rule to apply to any JSDoc block throughout
|
|
1197
|
+
* your files (as is necessary for finding function blocks not attached to a
|
|
1198
|
+
* function declaration or expression, i.e., `@callback` or `@function` (or its
|
|
1199
|
+
* aliases `@func` or `@method`) (including those associated with an `@interface`).
|
|
1200
|
+
*
|
|
1201
|
+
* See the ["AST and Selectors"](../#advanced-ast-and-selectors)
|
|
1202
|
+
* section of our Advanced docs for more on the expected format.
|
|
1203
|
+
*/
|
|
376
1204
|
contexts: (
|
|
377
1205
|
| string
|
|
378
1206
|
| {
|
|
@@ -384,11 +1212,29 @@ export interface Rules {
|
|
|
384
1212
|
}
|
|
385
1213
|
];
|
|
386
1214
|
|
|
387
|
-
/** This rule reports types being used on `@param` or `@returns
|
|
1215
|
+
/** This rule reports types being used on `@param` or `@returns` (redundant with TypeScript). */
|
|
388
1216
|
"jsdoc/no-types":
|
|
389
1217
|
| []
|
|
390
1218
|
| [
|
|
391
1219
|
{
|
|
1220
|
+
/**
|
|
1221
|
+
* Set this to an array of strings representing the AST context (or an object with
|
|
1222
|
+
* optional `context` and `comment` properties) where you wish the rule to be applied.
|
|
1223
|
+
*
|
|
1224
|
+
* `context` defaults to `any` and `comment` defaults to no specific comment context.
|
|
1225
|
+
*
|
|
1226
|
+
* Overrides the default contexts (`ArrowFunctionExpression`, `FunctionDeclaration`,
|
|
1227
|
+
* `FunctionExpression`, `TSDeclareFunction`, `TSMethodSignature`,
|
|
1228
|
+
* `ClassDeclaration`). Set to `"any"` if you want
|
|
1229
|
+
* the rule to apply to any JSDoc block throughout your files (as is necessary
|
|
1230
|
+
* for finding function blocks not attached to a function declaration or
|
|
1231
|
+
* expression, i.e., `@callback` or `@function` (or its aliases `@func` or
|
|
1232
|
+
* `@method`) (including those associated with an `@interface`).
|
|
1233
|
+
*
|
|
1234
|
+
* See the ["AST and Selectors"](../#advanced-ast-and-selectors)
|
|
1235
|
+
* section of our Advanced docs for more on the expected format.
|
|
1236
|
+
*
|
|
1237
|
+
*/
|
|
392
1238
|
contexts?: (
|
|
393
1239
|
| string
|
|
394
1240
|
| {
|
|
@@ -399,13 +1245,29 @@ export interface Rules {
|
|
|
399
1245
|
}
|
|
400
1246
|
];
|
|
401
1247
|
|
|
402
|
-
/**
|
|
1248
|
+
/** Besides some expected built-in types, prohibits any types not specified as globals or within `@typedef`. */
|
|
403
1249
|
"jsdoc/no-undefined-types":
|
|
404
1250
|
| []
|
|
405
1251
|
| [
|
|
406
1252
|
{
|
|
1253
|
+
/**
|
|
1254
|
+
* This array can be populated to indicate other types which
|
|
1255
|
+
* are automatically considered as defined (in addition to globals, etc.).
|
|
1256
|
+
* Defaults to an empty array.
|
|
1257
|
+
*/
|
|
407
1258
|
definedTypes?: string[];
|
|
1259
|
+
/**
|
|
1260
|
+
* Whether to disable reporting of errors. Defaults to
|
|
1261
|
+
* `false`. This may be set to `true` in order to take advantage of only
|
|
1262
|
+
* marking defined variables as used.
|
|
1263
|
+
*/
|
|
408
1264
|
disableReporting?: boolean;
|
|
1265
|
+
/**
|
|
1266
|
+
* Whether to mark variables as used for the purposes
|
|
1267
|
+
* of the `no-unused-vars` rule when they are not found to be undefined.
|
|
1268
|
+
* Defaults to `true`. May be set to `false` to enforce a practice of not
|
|
1269
|
+
* importing types unless used in code.
|
|
1270
|
+
*/
|
|
409
1271
|
markVariablesAsUsed?: boolean;
|
|
410
1272
|
}
|
|
411
1273
|
];
|
|
@@ -423,22 +1285,81 @@ export interface Rules {
|
|
|
423
1285
|
| [
|
|
424
1286
|
"always" | "never" | "any",
|
|
425
1287
|
{
|
|
1288
|
+
/**
|
|
1289
|
+
* If you want different values to apply to specific tags, you may use
|
|
1290
|
+
* the `tags` option object. The keys are `always`, `never`, or `any` and
|
|
1291
|
+
* the values are arrays of tag names or the special value `*description`
|
|
1292
|
+
* which applies to the main JSDoc block description.
|
|
1293
|
+
*
|
|
1294
|
+
* ```js
|
|
1295
|
+
* {
|
|
1296
|
+
* 'jsdoc/require-asterisk-prefix': ['error', 'always', {
|
|
1297
|
+
* tags: {
|
|
1298
|
+
* always: ['*description'],
|
|
1299
|
+
* any: ['example', 'license'],
|
|
1300
|
+
* never: ['copyright']
|
|
1301
|
+
* }
|
|
1302
|
+
* }]
|
|
1303
|
+
* }
|
|
1304
|
+
* ```
|
|
1305
|
+
*
|
|
1306
|
+
*/
|
|
426
1307
|
tags?: {
|
|
1308
|
+
/**
|
|
1309
|
+
* If it is `"always"` then a problem is raised when there is no asterisk
|
|
1310
|
+
* prefix on a given JSDoc line.
|
|
1311
|
+
*/
|
|
427
1312
|
always?: string[];
|
|
1313
|
+
/**
|
|
1314
|
+
* No problem is raised regardless of asterisk presence or non-presence.
|
|
1315
|
+
*/
|
|
428
1316
|
any?: string[];
|
|
1317
|
+
/**
|
|
1318
|
+
* If it is `"never"` then a problem is raised
|
|
1319
|
+
* when there is an asterisk present.
|
|
1320
|
+
*/
|
|
429
1321
|
never?: string[];
|
|
430
1322
|
};
|
|
431
1323
|
}
|
|
432
1324
|
];
|
|
433
1325
|
|
|
434
|
-
/** Requires that all functions have a description. */
|
|
1326
|
+
/** Requires that all functions (and potentially other contexts) have a description. */
|
|
435
1327
|
"jsdoc/require-description":
|
|
436
1328
|
| []
|
|
437
1329
|
| [
|
|
438
1330
|
{
|
|
1331
|
+
/**
|
|
1332
|
+
* A value indicating whether `constructor`s should be
|
|
1333
|
+
* checked. Defaults to `true`.
|
|
1334
|
+
*/
|
|
439
1335
|
checkConstructors?: boolean;
|
|
1336
|
+
/**
|
|
1337
|
+
* A value indicating whether getters should be checked.
|
|
1338
|
+
* Defaults to `true`.
|
|
1339
|
+
*/
|
|
440
1340
|
checkGetters?: boolean;
|
|
1341
|
+
/**
|
|
1342
|
+
* A value indicating whether setters should be checked.
|
|
1343
|
+
* Defaults to `true`.
|
|
1344
|
+
*/
|
|
441
1345
|
checkSetters?: boolean;
|
|
1346
|
+
/**
|
|
1347
|
+
* Set to an array of strings representing the AST context
|
|
1348
|
+
* where you wish the rule to be applied (e.g., `ClassDeclaration` for ES6
|
|
1349
|
+
* classes).
|
|
1350
|
+
*
|
|
1351
|
+
* `context` defaults to `any` and `comment` defaults to no specific comment context.
|
|
1352
|
+
*
|
|
1353
|
+
* Overrides the default contexts (`ArrowFunctionExpression`,
|
|
1354
|
+
* `FunctionDeclaration`, `FunctionExpression`). Set to `"any"` if you want
|
|
1355
|
+
* the rule to apply to any JSDoc block throughout your files (as is necessary
|
|
1356
|
+
* for finding function blocks not attached to a function declaration or
|
|
1357
|
+
* expression, i.e., `@callback` or `@function` (or its aliases `@func` or
|
|
1358
|
+
* `@method`) (including those associated with an `@interface`).
|
|
1359
|
+
*
|
|
1360
|
+
* See the ["AST and Selectors"](../#advanced-ast-and-selectors)
|
|
1361
|
+
* section of our Advanced docs for more on the expected format.
|
|
1362
|
+
*/
|
|
442
1363
|
contexts?: (
|
|
443
1364
|
| string
|
|
444
1365
|
| {
|
|
@@ -446,7 +1367,19 @@ export interface Rules {
|
|
|
446
1367
|
context?: string;
|
|
447
1368
|
}
|
|
448
1369
|
)[];
|
|
1370
|
+
/**
|
|
1371
|
+
* Whether to accept implicit descriptions (`"body"`) or
|
|
1372
|
+
* `@description` tags (`"tag"`) as satisfying the rule. Set to `"any"` to
|
|
1373
|
+
* accept either style. Defaults to `"body"`.
|
|
1374
|
+
*/
|
|
449
1375
|
descriptionStyle?: "body" | "tag" | "any";
|
|
1376
|
+
/**
|
|
1377
|
+
* Array of tags (e.g., `['type']`) whose presence on the
|
|
1378
|
+
* document block avoids the need for a `@description`. Defaults to an
|
|
1379
|
+
* array with `inheritdoc`. If you set this array, it will overwrite the
|
|
1380
|
+
* default, so be sure to add back `inheritdoc` if you wish its presence
|
|
1381
|
+
* to cause exemption of the rule.
|
|
1382
|
+
*/
|
|
450
1383
|
exemptedBy?: string[];
|
|
451
1384
|
}
|
|
452
1385
|
];
|
|
@@ -456,20 +1389,77 @@ export interface Rules {
|
|
|
456
1389
|
| []
|
|
457
1390
|
| [
|
|
458
1391
|
{
|
|
1392
|
+
/**
|
|
1393
|
+
* You can provide an `abbreviations` options array to avoid such strings of text
|
|
1394
|
+
* being treated as sentence endings when followed by dots. The `.` is not
|
|
1395
|
+
* necessary at the end of the array items.
|
|
1396
|
+
*/
|
|
459
1397
|
abbreviations?: string[];
|
|
1398
|
+
/**
|
|
1399
|
+
* When `false` (the new default), we will not assume capital letters after
|
|
1400
|
+
* newlines are an incorrect way to end the sentence (they may be proper
|
|
1401
|
+
* nouns, for example).
|
|
1402
|
+
*/
|
|
460
1403
|
newlineBeforeCapsAssumesBadSentenceEnd?: boolean;
|
|
1404
|
+
/**
|
|
1405
|
+
* If you want additional tags to be checked for their descriptions, you may
|
|
1406
|
+
* add them within this option.
|
|
1407
|
+
*
|
|
1408
|
+
* ```js
|
|
1409
|
+
* {
|
|
1410
|
+
* 'jsdoc/require-description-complete-sentence': ['error', {
|
|
1411
|
+
* tags: ['see', 'copyright']
|
|
1412
|
+
* }]
|
|
1413
|
+
* }
|
|
1414
|
+
* ```
|
|
1415
|
+
*
|
|
1416
|
+
* The tags `@param`/`@arg`/`@argument` and `@property`/`@prop` will be properly
|
|
1417
|
+
* parsed to ensure that the checked "description" text includes only the text
|
|
1418
|
+
* after the name.
|
|
1419
|
+
*
|
|
1420
|
+
* All other tags will treat the text following the tag name, a space, and
|
|
1421
|
+
* an optional curly-bracketed type expression (and another space) as part of
|
|
1422
|
+
* its "description" (e.g., for `@returns {someType} some description`, the
|
|
1423
|
+
* description is `some description` while for `@some-tag xyz`, the description
|
|
1424
|
+
* is `xyz`).
|
|
1425
|
+
*
|
|
1426
|
+
*/
|
|
461
1427
|
tags?: string[];
|
|
462
1428
|
}
|
|
463
1429
|
];
|
|
464
1430
|
|
|
465
|
-
/** Requires that all functions have examples. */
|
|
1431
|
+
/** Requires that all functions (and potentially other contexts) have examples. */
|
|
466
1432
|
"jsdoc/require-example":
|
|
467
1433
|
| []
|
|
468
1434
|
| [
|
|
469
1435
|
{
|
|
1436
|
+
/**
|
|
1437
|
+
* A value indicating whether `constructor`s should be checked.
|
|
1438
|
+
* Defaults to `true`.
|
|
1439
|
+
*/
|
|
470
1440
|
checkConstructors?: boolean;
|
|
1441
|
+
/**
|
|
1442
|
+
* A value indicating whether getters should be checked. Defaults to `false`.
|
|
1443
|
+
*/
|
|
471
1444
|
checkGetters?: boolean;
|
|
1445
|
+
/**
|
|
1446
|
+
* A value indicating whether setters should be checked. Defaults to `false`.
|
|
1447
|
+
*/
|
|
472
1448
|
checkSetters?: boolean;
|
|
1449
|
+
/**
|
|
1450
|
+
* Set this to an array of strings representing the AST context (or an object with
|
|
1451
|
+
* optional `context` and `comment` properties) where you wish the rule to be applied.
|
|
1452
|
+
* (e.g., `ClassDeclaration` for ES6 classes).
|
|
1453
|
+
*
|
|
1454
|
+
* `context` defaults to `any` and `comment` defaults to no specific comment context.
|
|
1455
|
+
*
|
|
1456
|
+
* Overrides the default contexts (`ArrowFunctionExpression`, `FunctionDeclaration`,
|
|
1457
|
+
* `FunctionExpression`). Set to `"any"` if you want the rule to apply to any
|
|
1458
|
+
* JSDoc block throughout your files.
|
|
1459
|
+
*
|
|
1460
|
+
* See the ["AST and Selectors"](../#advanced-ast-and-selectors)
|
|
1461
|
+
* section of our Advanced docs for more on the expected format.
|
|
1462
|
+
*/
|
|
473
1463
|
contexts?: (
|
|
474
1464
|
| string
|
|
475
1465
|
| {
|
|
@@ -477,8 +1467,23 @@ export interface Rules {
|
|
|
477
1467
|
context?: string;
|
|
478
1468
|
}
|
|
479
1469
|
)[];
|
|
1470
|
+
/**
|
|
1471
|
+
* A boolean on whether to enable the fixer (which adds an empty `@example` block).
|
|
1472
|
+
* Defaults to `true`.
|
|
1473
|
+
*/
|
|
480
1474
|
enableFixer?: boolean;
|
|
1475
|
+
/**
|
|
1476
|
+
* Array of tags (e.g., `['type']`) whose presence on the document
|
|
1477
|
+
* block avoids the need for an `@example`. Defaults to an array with
|
|
1478
|
+
* `inheritdoc`. If you set this array, it will overwrite the default,
|
|
1479
|
+
* so be sure to add back `inheritdoc` if you wish its presence to cause
|
|
1480
|
+
* exemption of the rule.
|
|
1481
|
+
*/
|
|
481
1482
|
exemptedBy?: string[];
|
|
1483
|
+
/**
|
|
1484
|
+
* Boolean to indicate that no-argument functions should not be reported for
|
|
1485
|
+
* missing `@example` declarations.
|
|
1486
|
+
*/
|
|
482
1487
|
exemptNoArguments?: boolean;
|
|
483
1488
|
}
|
|
484
1489
|
];
|
|
@@ -488,6 +1493,69 @@ export interface Rules {
|
|
|
488
1493
|
| []
|
|
489
1494
|
| [
|
|
490
1495
|
{
|
|
1496
|
+
/**
|
|
1497
|
+
* The keys of this object are tag names, and the values are configuration
|
|
1498
|
+
* objects indicating what will be checked for these whole-file tags.
|
|
1499
|
+
*
|
|
1500
|
+
* Each configuration object has 3 potential boolean keys (which default
|
|
1501
|
+
* to `false` when this option is supplied).
|
|
1502
|
+
*
|
|
1503
|
+
* 1. `mustExist` - enforces that all files have a `@file`, `@fileoverview`, or `@overview` tag.
|
|
1504
|
+
* 2. `preventDuplicates` - enforces that duplicate file overview tags within a given file will be reported
|
|
1505
|
+
* 3. `initialCommentsOnly` - reports file overview tags which are not, as per
|
|
1506
|
+
* [the docs](https://jsdoc.app/tags-file.html), "at the beginning of
|
|
1507
|
+
* the file"–where beginning of the file is interpreted in this rule
|
|
1508
|
+
* as being when the overview tag is not preceded by anything other than
|
|
1509
|
+
* a comment.
|
|
1510
|
+
*
|
|
1511
|
+
* When no `tags` is present, the default is:
|
|
1512
|
+
*
|
|
1513
|
+
* ```json
|
|
1514
|
+
* {
|
|
1515
|
+
* "file": {
|
|
1516
|
+
* "initialCommentsOnly": true,
|
|
1517
|
+
* "mustExist": true,
|
|
1518
|
+
* "preventDuplicates": true,
|
|
1519
|
+
* }
|
|
1520
|
+
* }
|
|
1521
|
+
* ```
|
|
1522
|
+
*
|
|
1523
|
+
* You can add additional tag names and/or override `file` if you supply this
|
|
1524
|
+
* option, e.g., in place of or in addition to `file`, giving other potential
|
|
1525
|
+
* file global tags like `@license`, `@copyright`, `@author`, `@module` or
|
|
1526
|
+
* `@exports`, optionally restricting them to a single use or preventing them
|
|
1527
|
+
* from being preceded by anything besides comments.
|
|
1528
|
+
*
|
|
1529
|
+
* For example:
|
|
1530
|
+
*
|
|
1531
|
+
* ```js
|
|
1532
|
+
* {
|
|
1533
|
+
* "license": {
|
|
1534
|
+
* "mustExist": true,
|
|
1535
|
+
* "preventDuplicates": true,
|
|
1536
|
+
* }
|
|
1537
|
+
* }
|
|
1538
|
+
* ```
|
|
1539
|
+
*
|
|
1540
|
+
* This would require one and only one `@license` in the file, though because
|
|
1541
|
+
* `initialCommentsOnly` is absent and defaults to `false`, the `@license`
|
|
1542
|
+
* can be anywhere.
|
|
1543
|
+
*
|
|
1544
|
+
* In the case of `@license`, you can use this rule along with the
|
|
1545
|
+
* `check-values` rule (with its `allowedLicenses` or `licensePattern` options),
|
|
1546
|
+
* to enforce a license whitelist be present on every JS file.
|
|
1547
|
+
*
|
|
1548
|
+
* Note that if you choose to use `preventDuplicates` with `license`, you still
|
|
1549
|
+
* have a way to allow multiple licenses for the whole page by using the SPDX
|
|
1550
|
+
* "AND" expression, e.g., `@license (MIT AND GPL-3.0)`.
|
|
1551
|
+
*
|
|
1552
|
+
* Note that the tag names are the main JSDoc tag name, so you should use `file`
|
|
1553
|
+
* in this configuration object regardless of whether you have configured
|
|
1554
|
+
* `fileoverview` instead of `file` on `tagNamePreference` (i.e., `fileoverview`
|
|
1555
|
+
* will be checked, but you must use `file` on the configuration object).
|
|
1556
|
+
*
|
|
1557
|
+
*
|
|
1558
|
+
*/
|
|
491
1559
|
tags?: {
|
|
492
1560
|
/**
|
|
493
1561
|
* This interface was referenced by `undefined`'s JSON-Schema definition
|
|
@@ -502,13 +1570,23 @@ export interface Rules {
|
|
|
502
1570
|
}
|
|
503
1571
|
];
|
|
504
1572
|
|
|
505
|
-
/** Requires a hyphen before the `@param` description. */
|
|
1573
|
+
/** Requires a hyphen before the `@param` description (and optionally before `@property` descriptions). */
|
|
506
1574
|
"jsdoc/require-hyphen-before-param-description":
|
|
507
1575
|
| []
|
|
508
1576
|
| ["always" | "never"]
|
|
509
1577
|
| [
|
|
510
1578
|
"always" | "never",
|
|
511
1579
|
{
|
|
1580
|
+
/**
|
|
1581
|
+
* Object whose keys indicate different tags to check for the
|
|
1582
|
+
* presence or absence of hyphens; the key value should be "always" or "never",
|
|
1583
|
+
* indicating how hyphens are to be applied, e.g., `{property: 'never'}`
|
|
1584
|
+
* to ensure `@property` never uses hyphens. A key can also be set as `*`, e.g.,
|
|
1585
|
+
* `'*': 'always'` to apply hyphen checking to any tag (besides the preferred
|
|
1586
|
+
* `@param` tag which follows the main string option setting and besides any
|
|
1587
|
+
* other `tags` entries).
|
|
1588
|
+
*
|
|
1589
|
+
*/
|
|
512
1590
|
tags?:
|
|
513
1591
|
| {
|
|
514
1592
|
/**
|
|
@@ -521,14 +1599,51 @@ export interface Rules {
|
|
|
521
1599
|
}
|
|
522
1600
|
];
|
|
523
1601
|
|
|
524
|
-
/**
|
|
1602
|
+
/** Checks for presence of JSDoc comments, on functions and potentially other contexts (optionally limited to exports). */
|
|
525
1603
|
"jsdoc/require-jsdoc":
|
|
526
1604
|
| []
|
|
527
1605
|
| [
|
|
528
1606
|
{
|
|
1607
|
+
/**
|
|
1608
|
+
* A value indicating whether `constructor`s should be checked. Defaults to
|
|
1609
|
+
* `true`. When `true`, `exemptEmptyConstructors` may still avoid reporting when
|
|
1610
|
+
* no parameters or return values are found.
|
|
1611
|
+
*/
|
|
529
1612
|
checkConstructors?: boolean;
|
|
1613
|
+
/**
|
|
1614
|
+
* A value indicating whether getters should be checked. Besides setting as a
|
|
1615
|
+
* boolean, this option can be set to the string `"no-setter"` to indicate that
|
|
1616
|
+
* getters should be checked but only when there is no setter. This may be useful
|
|
1617
|
+
* if one only wishes documentation on one of the two accessors. Defaults to
|
|
1618
|
+
* `false`.
|
|
1619
|
+
*
|
|
1620
|
+
*/
|
|
530
1621
|
checkGetters?: boolean | "no-setter";
|
|
1622
|
+
/**
|
|
1623
|
+
* A value indicating whether setters should be checked. Besides setting as a
|
|
1624
|
+
* boolean, this option can be set to the string `"no-getter"` to indicate that
|
|
1625
|
+
* setters should be checked but only when there is no getter. This may be useful
|
|
1626
|
+
* if one only wishes documentation on one of the two accessors. Defaults to
|
|
1627
|
+
* `false`.
|
|
1628
|
+
*/
|
|
531
1629
|
checkSetters?: boolean | "no-getter";
|
|
1630
|
+
/**
|
|
1631
|
+
* Set this to an array of strings or objects representing the additional AST
|
|
1632
|
+
* contexts where you wish the rule to be applied (e.g., `Property` for
|
|
1633
|
+
* properties). If specified as an object, it should have a `context` property
|
|
1634
|
+
* and can have an `inlineCommentBlock` property which, if set to `true`, will
|
|
1635
|
+
* add an inline `/** * /` instead of the regular, multi-line, indented jsdoc
|
|
1636
|
+
* block which will otherwise be added. Defaults to an empty array. Contexts
|
|
1637
|
+
* may also have their own `minLineCount` property which is an integer
|
|
1638
|
+
* indicating a minimum number of lines expected for a node in order
|
|
1639
|
+
* for it to require documentation.
|
|
1640
|
+
*
|
|
1641
|
+
* Note that you may need to disable `require` items (e.g., `MethodDefinition`)
|
|
1642
|
+
* if you are specifying a more precise form in `contexts` (e.g., `MethodDefinition:not([accessibility="private"] > FunctionExpression`).
|
|
1643
|
+
*
|
|
1644
|
+
* See the ["AST and Selectors"](../#advanced-ast-and-selectors)
|
|
1645
|
+
* section of our Advanced docs for more on the expected format.
|
|
1646
|
+
*/
|
|
532
1647
|
contexts?: (
|
|
533
1648
|
| string
|
|
534
1649
|
| {
|
|
@@ -537,12 +1652,60 @@ export interface Rules {
|
|
|
537
1652
|
minLineCount?: number;
|
|
538
1653
|
}
|
|
539
1654
|
)[];
|
|
1655
|
+
/**
|
|
1656
|
+
* A boolean on whether to enable the fixer (which adds an empty JSDoc block).
|
|
1657
|
+
* Defaults to `true`.
|
|
1658
|
+
*/
|
|
540
1659
|
enableFixer?: boolean;
|
|
1660
|
+
/**
|
|
1661
|
+
* When `true`, the rule will not report missing JSDoc blocks above constructors
|
|
1662
|
+
* with no parameters or return values (this is enabled by default as the class
|
|
1663
|
+
* name or description should be seen as sufficient to convey intent).
|
|
1664
|
+
*
|
|
1665
|
+
* Defaults to `true`.
|
|
1666
|
+
*/
|
|
541
1667
|
exemptEmptyConstructors?: boolean;
|
|
1668
|
+
/**
|
|
1669
|
+
* When `true`, the rule will not report missing JSDoc blocks above
|
|
1670
|
+
* functions/methods with no parameters or return values (intended where
|
|
1671
|
+
* function/method names are sufficient for themselves as documentation).
|
|
1672
|
+
*
|
|
1673
|
+
* Defaults to `false`.
|
|
1674
|
+
*
|
|
1675
|
+
*/
|
|
542
1676
|
exemptEmptyFunctions?: boolean;
|
|
1677
|
+
/**
|
|
1678
|
+
* If set to `true` will avoid checking an overloaded function's implementation.
|
|
1679
|
+
*
|
|
1680
|
+
* Defaults to `false`.
|
|
1681
|
+
*/
|
|
543
1682
|
exemptOverloadedImplementations?: boolean;
|
|
1683
|
+
/**
|
|
1684
|
+
* An optional message to add to the inserted JSDoc block. Defaults to the
|
|
1685
|
+
* empty string.
|
|
1686
|
+
*/
|
|
544
1687
|
fixerMessage?: string;
|
|
1688
|
+
/**
|
|
1689
|
+
* An integer to indicate a minimum number of lines expected for a node in order
|
|
1690
|
+
* for it to require documentation. Defaults to `undefined`. This option will
|
|
1691
|
+
* apply to any context; see `contexts` for line counts specific to a context.
|
|
1692
|
+
*/
|
|
545
1693
|
minLineCount?: number;
|
|
1694
|
+
/**
|
|
1695
|
+
* This option will insist that missing JSDoc blocks are only reported for
|
|
1696
|
+
* function bodies / class declarations that are exported from the module.
|
|
1697
|
+
* May be a boolean or object. If set to `true`, the defaults below will be
|
|
1698
|
+
* used. If unset, JSDoc block reporting will not be limited to exports.
|
|
1699
|
+
*
|
|
1700
|
+
* This object supports the following optional boolean keys (`false` unless
|
|
1701
|
+
* otherwise noted):
|
|
1702
|
+
*
|
|
1703
|
+
* - `ancestorsOnly` - Optimization to only check node ancestors to check if node is exported
|
|
1704
|
+
* - `esm` - ESM exports are checked for JSDoc comments (Defaults to `true`)
|
|
1705
|
+
* - `cjs` - CommonJS exports are checked for JSDoc comments (Defaults to `true`)
|
|
1706
|
+
* - `window` - Window global exports are checked for JSDoc comments
|
|
1707
|
+
*
|
|
1708
|
+
*/
|
|
546
1709
|
publicOnly?:
|
|
547
1710
|
| boolean
|
|
548
1711
|
| {
|
|
@@ -551,34 +1714,200 @@ export interface Rules {
|
|
|
551
1714
|
esm?: boolean;
|
|
552
1715
|
window?: boolean;
|
|
553
1716
|
};
|
|
1717
|
+
/**
|
|
1718
|
+
* An object with the following optional boolean keys which all default to
|
|
1719
|
+
* `false` except for `FunctionDeclaration` which defaults to `true`.
|
|
1720
|
+
*/
|
|
554
1721
|
require?: {
|
|
1722
|
+
/**
|
|
1723
|
+
* Whether to check arrow functions like `() => {}`
|
|
1724
|
+
*/
|
|
555
1725
|
ArrowFunctionExpression?: boolean;
|
|
1726
|
+
/**
|
|
1727
|
+
* Whether to check declarations like `class A {}`
|
|
1728
|
+
*/
|
|
556
1729
|
ClassDeclaration?: boolean;
|
|
1730
|
+
/**
|
|
1731
|
+
* Whether to check class expressions like `const myClass = class {}`
|
|
1732
|
+
*/
|
|
557
1733
|
ClassExpression?: boolean;
|
|
1734
|
+
/**
|
|
1735
|
+
* Whether to check function declarations like `function a {}`
|
|
1736
|
+
*/
|
|
558
1737
|
FunctionDeclaration?: boolean;
|
|
1738
|
+
/**
|
|
1739
|
+
* Whether to check function expressions like `const a = function {}`
|
|
1740
|
+
*/
|
|
559
1741
|
FunctionExpression?: boolean;
|
|
1742
|
+
/**
|
|
1743
|
+
* Whether to check method definitions like `class A { someMethodDefinition () {} }`
|
|
1744
|
+
*/
|
|
560
1745
|
MethodDefinition?: boolean;
|
|
561
1746
|
};
|
|
1747
|
+
/**
|
|
1748
|
+
* If `true`, will skip above uncommented overloaded functions to check
|
|
1749
|
+
* for a comment block (e.g., at the top of a set of overloaded functions).
|
|
1750
|
+
*
|
|
1751
|
+
* If `false`, will force each overloaded function to be checked for a
|
|
1752
|
+
* comment block.
|
|
1753
|
+
*
|
|
1754
|
+
* Defaults to `true`.
|
|
1755
|
+
*/
|
|
562
1756
|
skipInterveningOverloadedDeclarations?: boolean;
|
|
563
1757
|
}
|
|
564
1758
|
];
|
|
565
1759
|
|
|
1760
|
+
/** Requires a description for `@next` tags */
|
|
1761
|
+
"jsdoc/require-next-description": [];
|
|
1762
|
+
|
|
566
1763
|
/** Requires a type for `@next` tags */
|
|
567
1764
|
"jsdoc/require-next-type": [];
|
|
568
1765
|
|
|
569
|
-
/** Requires that all function parameters are documented. */
|
|
1766
|
+
/** Requires that all function parameters are documented with a `@param` tag. */
|
|
570
1767
|
"jsdoc/require-param":
|
|
571
1768
|
| []
|
|
572
1769
|
| [
|
|
573
1770
|
{
|
|
1771
|
+
/**
|
|
1772
|
+
* Numeric to indicate the number at which to begin auto-incrementing roots.
|
|
1773
|
+
* Defaults to `0`.
|
|
1774
|
+
*
|
|
1775
|
+
*/
|
|
574
1776
|
autoIncrementBase?: number;
|
|
1777
|
+
/**
|
|
1778
|
+
* A value indicating whether `constructor`s should be checked. Defaults to
|
|
1779
|
+
* `true`.
|
|
1780
|
+
*
|
|
1781
|
+
*/
|
|
575
1782
|
checkConstructors?: boolean;
|
|
1783
|
+
/**
|
|
1784
|
+
* Whether to require destructured properties. Defaults to `true`.
|
|
1785
|
+
*/
|
|
576
1786
|
checkDestructured?: boolean;
|
|
1787
|
+
/**
|
|
1788
|
+
* Whether to check the existence of a corresponding `@param` for root objects
|
|
1789
|
+
* of destructured properties (e.g., that for `function ({a, b}) {}`, that there
|
|
1790
|
+
* is something like `@param myRootObj` defined that can correspond to
|
|
1791
|
+
* the `{a, b}` object parameter).
|
|
1792
|
+
*
|
|
1793
|
+
* If `checkDestructuredRoots` is `false`, `checkDestructured` will also be
|
|
1794
|
+
* implied to be `false` (i.e., the inside of the roots will not be checked
|
|
1795
|
+
* either, e.g., it will also not complain if `a` or `b` do not have their own
|
|
1796
|
+
* documentation). Defaults to `true`.
|
|
1797
|
+
*
|
|
1798
|
+
*/
|
|
577
1799
|
checkDestructuredRoots?: boolean;
|
|
1800
|
+
/**
|
|
1801
|
+
* A value indicating whether getters should be checked. Defaults to `false`.
|
|
1802
|
+
*/
|
|
578
1803
|
checkGetters?: boolean;
|
|
1804
|
+
/**
|
|
1805
|
+
* If set to `true`, will report (and add fixer insertions) for missing rest
|
|
1806
|
+
* properties. Defaults to `false`.
|
|
1807
|
+
*
|
|
1808
|
+
* If set to `true`, note that you can still document the subproperties of the
|
|
1809
|
+
* rest property using other jsdoc features, e.g., `@typedef`:
|
|
1810
|
+
*
|
|
1811
|
+
* ```js
|
|
1812
|
+
* /**
|
|
1813
|
+
* * @typedef ExtraOptions
|
|
1814
|
+
* * @property innerProp1
|
|
1815
|
+
* * @property innerProp2
|
|
1816
|
+
* * /
|
|
1817
|
+
*
|
|
1818
|
+
* /**
|
|
1819
|
+
* * @param cfg
|
|
1820
|
+
* * @param cfg.num
|
|
1821
|
+
* * @param {ExtraOptions} extra
|
|
1822
|
+
* * /
|
|
1823
|
+
* function quux ({num, ...extra}) {
|
|
1824
|
+
* }
|
|
1825
|
+
* ```
|
|
1826
|
+
*
|
|
1827
|
+
* Setting this option to `false` (the default) may be useful in cases where
|
|
1828
|
+
* you already have separate `@param` definitions for each of the properties
|
|
1829
|
+
* within the rest property.
|
|
1830
|
+
*
|
|
1831
|
+
* For example, with the option disabled, this will not give an error despite
|
|
1832
|
+
* `extra` not having any definition:
|
|
1833
|
+
*
|
|
1834
|
+
* ```js
|
|
1835
|
+
* /**
|
|
1836
|
+
* * @param cfg
|
|
1837
|
+
* * @param cfg.num
|
|
1838
|
+
* * /
|
|
1839
|
+
* function quux ({num, ...extra}) {
|
|
1840
|
+
* }
|
|
1841
|
+
* ```
|
|
1842
|
+
*
|
|
1843
|
+
* Nor will this:
|
|
1844
|
+
*
|
|
1845
|
+
* ```js
|
|
1846
|
+
* /**
|
|
1847
|
+
* * @param cfg
|
|
1848
|
+
* * @param cfg.num
|
|
1849
|
+
* * @param cfg.innerProp1
|
|
1850
|
+
* * @param cfg.innerProp2
|
|
1851
|
+
* * /
|
|
1852
|
+
* function quux ({num, ...extra}) {
|
|
1853
|
+
* }
|
|
1854
|
+
* ```
|
|
1855
|
+
*
|
|
1856
|
+
*/
|
|
579
1857
|
checkRestProperty?: boolean;
|
|
1858
|
+
/**
|
|
1859
|
+
* A value indicating whether setters should be checked. Defaults to `false`.
|
|
1860
|
+
*/
|
|
580
1861
|
checkSetters?: boolean;
|
|
1862
|
+
/**
|
|
1863
|
+
* When one specifies a type, unless it is of a generic type, like `object`
|
|
1864
|
+
* or `array`, it may be considered unnecessary to have that object's
|
|
1865
|
+
* destructured components required, especially where generated docs will
|
|
1866
|
+
* link back to the specified type. For example:
|
|
1867
|
+
*
|
|
1868
|
+
* ```js
|
|
1869
|
+
* /**
|
|
1870
|
+
* * @param {SVGRect} bbox - a SVGRect
|
|
1871
|
+
* * /
|
|
1872
|
+
* export const bboxToObj = function ({x, y, width, height}) {
|
|
1873
|
+
* return {x, y, width, height};
|
|
1874
|
+
* };
|
|
1875
|
+
* ```
|
|
1876
|
+
*
|
|
1877
|
+
* By default `checkTypesPattern` is set to
|
|
1878
|
+
* `/^(?:[oO]bject|[aA]rray|PlainObject|Generic(?:Object|Array))$/v`,
|
|
1879
|
+
* meaning that destructuring will be required only if the type of the `@param`
|
|
1880
|
+
* (the text between curly brackets) is a match for "Object" or "Array" (with or
|
|
1881
|
+
* without initial caps), "PlainObject", or "GenericObject", "GenericArray" (or
|
|
1882
|
+
* if no type is present). So in the above example, the lack of a match will
|
|
1883
|
+
* mean that no complaint will be given about the undocumented destructured
|
|
1884
|
+
* parameters.
|
|
1885
|
+
*
|
|
1886
|
+
* Note that the `/` delimiters are optional, but necessary to add flags.
|
|
1887
|
+
*
|
|
1888
|
+
* Defaults to using (only) the `v` flag, so to add your own flags, encapsulate
|
|
1889
|
+
* your expression as a string, but like a literal, e.g., `/^object$/vi`.
|
|
1890
|
+
*
|
|
1891
|
+
* You could set this regular expression to a more expansive list, or you
|
|
1892
|
+
* could restrict it such that even types matching those strings would not
|
|
1893
|
+
* need destructuring.
|
|
1894
|
+
*/
|
|
581
1895
|
checkTypesPattern?: string;
|
|
1896
|
+
/**
|
|
1897
|
+
* Set this to an array of strings representing the AST context (or an object with
|
|
1898
|
+
* optional `context` and `comment` properties) where you wish the rule to be applied.
|
|
1899
|
+
*
|
|
1900
|
+
* `context` defaults to `any` and `comment` defaults to no specific comment context.
|
|
1901
|
+
*
|
|
1902
|
+
* Overrides the default contexts (`ArrowFunctionExpression`, `FunctionDeclaration`,
|
|
1903
|
+
* `FunctionExpression`). May be useful for adding such as
|
|
1904
|
+
* `TSMethodSignature` in TypeScript or restricting the contexts
|
|
1905
|
+
* which are checked.
|
|
1906
|
+
*
|
|
1907
|
+
* See the ["AST and Selectors"](../#advanced-ast-and-selectors)
|
|
1908
|
+
* section of our Advanced docs for more on the expected format.
|
|
1909
|
+
*
|
|
1910
|
+
*/
|
|
582
1911
|
contexts?: (
|
|
583
1912
|
| string
|
|
584
1913
|
| {
|
|
@@ -586,13 +1915,127 @@ export interface Rules {
|
|
|
586
1915
|
context?: string;
|
|
587
1916
|
}
|
|
588
1917
|
)[];
|
|
1918
|
+
/**
|
|
1919
|
+
* Whether to enable the fixer. Defaults to `true`.
|
|
1920
|
+
*/
|
|
589
1921
|
enableFixer?: boolean;
|
|
1922
|
+
/**
|
|
1923
|
+
* Whether to enable the rest element fixer.
|
|
1924
|
+
*
|
|
1925
|
+
* The fixer will automatically report/insert
|
|
1926
|
+
* [JSDoc repeatable parameters](https://jsdoc.app/tags-param.html#multiple-types-and-repeatable-parameters)
|
|
1927
|
+
* if missing.
|
|
1928
|
+
*
|
|
1929
|
+
* ```js
|
|
1930
|
+
* /**
|
|
1931
|
+
* * @param {GenericArray} cfg
|
|
1932
|
+
* * @param {number} cfg."0"
|
|
1933
|
+
* * /
|
|
1934
|
+
* function baar ([a, ...extra]) {
|
|
1935
|
+
* //
|
|
1936
|
+
* }
|
|
1937
|
+
* ```
|
|
1938
|
+
*
|
|
1939
|
+
* ...becomes:
|
|
1940
|
+
*
|
|
1941
|
+
* ```js
|
|
1942
|
+
* /**
|
|
1943
|
+
* * @param {GenericArray} cfg
|
|
1944
|
+
* * @param {number} cfg."0"
|
|
1945
|
+
* * @param {...any} cfg."1"
|
|
1946
|
+
* * /
|
|
1947
|
+
* function baar ([a, ...extra]) {
|
|
1948
|
+
* //
|
|
1949
|
+
* }
|
|
1950
|
+
* ```
|
|
1951
|
+
*
|
|
1952
|
+
* Note that the type `any` is included since we don't know of any specific
|
|
1953
|
+
* type to use.
|
|
1954
|
+
*
|
|
1955
|
+
* Defaults to `true`.
|
|
1956
|
+
*
|
|
1957
|
+
*/
|
|
590
1958
|
enableRestElementFixer?: boolean;
|
|
1959
|
+
/**
|
|
1960
|
+
* Whether to enable the auto-adding of incrementing roots.
|
|
1961
|
+
*
|
|
1962
|
+
* The default behavior of `true` is for "root" to be auto-inserted for missing
|
|
1963
|
+
* roots, followed by a 0-based auto-incrementing number.
|
|
1964
|
+
*
|
|
1965
|
+
* So for:
|
|
1966
|
+
*
|
|
1967
|
+
* ```js
|
|
1968
|
+
* function quux ({foo}, {bar}, {baz}) {
|
|
1969
|
+
* }
|
|
1970
|
+
* ```
|
|
1971
|
+
*
|
|
1972
|
+
* ...the default JSDoc that would be added if the fixer is enabled would be:
|
|
1973
|
+
*
|
|
1974
|
+
* ```js
|
|
1975
|
+
* /**
|
|
1976
|
+
* * @param root0
|
|
1977
|
+
* * @param root0.foo
|
|
1978
|
+
* * @param root1
|
|
1979
|
+
* * @param root1.bar
|
|
1980
|
+
* * @param root2
|
|
1981
|
+
* * @param root2.baz
|
|
1982
|
+
* * /
|
|
1983
|
+
* ```
|
|
1984
|
+
*
|
|
1985
|
+
* Has no effect if `enableFixer` is set to `false`.
|
|
1986
|
+
*/
|
|
591
1987
|
enableRootFixer?: boolean;
|
|
1988
|
+
/**
|
|
1989
|
+
* Array of tags (e.g., `['type']`) whose presence on the document block
|
|
1990
|
+
* avoids the need for a `@param`. Defaults to an array with
|
|
1991
|
+
* `inheritdoc`. If you set this array, it will overwrite the default,
|
|
1992
|
+
* so be sure to add back `inheritdoc` if you wish its presence to cause
|
|
1993
|
+
* exemption of the rule.
|
|
1994
|
+
*/
|
|
592
1995
|
exemptedBy?: string[];
|
|
1996
|
+
/**
|
|
1997
|
+
* Set to `true` to ignore reporting when all params are missing. Defaults to
|
|
1998
|
+
* `false`.
|
|
1999
|
+
*/
|
|
593
2000
|
ignoreWhenAllParamsMissing?: boolean;
|
|
2001
|
+
/**
|
|
2002
|
+
* Set if you wish TypeScript interfaces to exempt checks for the existence of
|
|
2003
|
+
* `@param`'s.
|
|
2004
|
+
*
|
|
2005
|
+
* Will check for a type defining the function itself (on a variable
|
|
2006
|
+
* declaration) or if there is a single destructured object with a type.
|
|
2007
|
+
* Defaults to `false`.
|
|
2008
|
+
*/
|
|
594
2009
|
interfaceExemptsParamsCheck?: boolean;
|
|
2010
|
+
/**
|
|
2011
|
+
* An array of root names to use in the fixer when roots are missing. Defaults
|
|
2012
|
+
* to `['root']`. Note that only when all items in the array besides the last
|
|
2013
|
+
* are exhausted will auto-incrementing occur. So, with
|
|
2014
|
+
* `unnamedRootBase: ['arg', 'config']`, the following:
|
|
2015
|
+
*
|
|
2016
|
+
* ```js
|
|
2017
|
+
* function quux ({foo}, [bar], {baz}) {
|
|
2018
|
+
* }
|
|
2019
|
+
* ```
|
|
2020
|
+
*
|
|
2021
|
+
* ...will get the following JSDoc block added:
|
|
2022
|
+
*
|
|
2023
|
+
* ```js
|
|
2024
|
+
* /**
|
|
2025
|
+
* * @param arg
|
|
2026
|
+
* * @param arg.foo
|
|
2027
|
+
* * @param config0
|
|
2028
|
+
* * @param config0."0" (`bar`)
|
|
2029
|
+
* * @param config1
|
|
2030
|
+
* * @param config1.baz
|
|
2031
|
+
* * /
|
|
2032
|
+
* ```
|
|
2033
|
+
*/
|
|
595
2034
|
unnamedRootBase?: string[];
|
|
2035
|
+
/**
|
|
2036
|
+
* Set to `true` if you wish to expect documentation of properties on objects
|
|
2037
|
+
* supplied as default values. Defaults to `false`.
|
|
2038
|
+
*/
|
|
596
2039
|
useDefaultObjectProperties?: boolean;
|
|
597
2040
|
}
|
|
598
2041
|
];
|
|
@@ -602,6 +2045,22 @@ export interface Rules {
|
|
|
602
2045
|
| []
|
|
603
2046
|
| [
|
|
604
2047
|
{
|
|
2048
|
+
/**
|
|
2049
|
+
* Set this to an array of strings representing the AST context (or an object with
|
|
2050
|
+
* optional `context` and `comment` properties) where you wish the rule to be applied.
|
|
2051
|
+
*
|
|
2052
|
+
* `context` defaults to `any` and `comment` defaults to no specific comment context.
|
|
2053
|
+
*
|
|
2054
|
+
* Overrides the default contexts (`ArrowFunctionExpression`, `FunctionDeclaration`,
|
|
2055
|
+
* `FunctionExpression`). Set to `"any"` if you want
|
|
2056
|
+
* the rule to apply to any JSDoc block throughout your files (as is necessary
|
|
2057
|
+
* for finding function blocks not attached to a function declaration or
|
|
2058
|
+
* expression, i.e., `@callback` or `@function` (or its aliases `@func` or
|
|
2059
|
+
* `@method`) (including those associated with an `@interface`).
|
|
2060
|
+
*
|
|
2061
|
+
* See the ["AST and Selectors"](../#advanced-ast-and-selectors)
|
|
2062
|
+
* section of our Advanced docs for more on the expected format.
|
|
2063
|
+
*/
|
|
605
2064
|
contexts?: (
|
|
606
2065
|
| string
|
|
607
2066
|
| {
|
|
@@ -609,16 +2068,44 @@ export interface Rules {
|
|
|
609
2068
|
context?: string;
|
|
610
2069
|
}
|
|
611
2070
|
)[];
|
|
2071
|
+
/**
|
|
2072
|
+
* The description string to set by default for destructured roots. Defaults to
|
|
2073
|
+
* "The root object".
|
|
2074
|
+
*/
|
|
612
2075
|
defaultDestructuredRootDescription?: string;
|
|
2076
|
+
/**
|
|
2077
|
+
* Whether to set a default destructured root description. For example, you may
|
|
2078
|
+
* wish to avoid manually having to set the description for a `@param`
|
|
2079
|
+
* corresponding to a destructured root object as it should always be the same
|
|
2080
|
+
* type of object. Uses `defaultDestructuredRootDescription` for the description
|
|
2081
|
+
* string. Defaults to `false`.
|
|
2082
|
+
*/
|
|
613
2083
|
setDefaultDestructuredRootDescription?: boolean;
|
|
614
2084
|
}
|
|
615
2085
|
];
|
|
616
2086
|
|
|
617
|
-
/** Requires that all
|
|
2087
|
+
/** Requires that all `@param` tags have names. */
|
|
618
2088
|
"jsdoc/require-param-name":
|
|
619
2089
|
| []
|
|
620
2090
|
| [
|
|
621
2091
|
{
|
|
2092
|
+
/**
|
|
2093
|
+
* Set this to an array of strings representing the AST context (or an object with
|
|
2094
|
+
* optional `context` and `comment` properties) where you wish the rule to be applied.
|
|
2095
|
+
*
|
|
2096
|
+
* `context` defaults to `any` and `comment` defaults to no specific comment context.
|
|
2097
|
+
*
|
|
2098
|
+
* Overrides the default contexts (`ArrowFunctionExpression`, `FunctionDeclaration`,
|
|
2099
|
+
* `FunctionExpression`). Set to `"any"` if you want
|
|
2100
|
+
* the rule to apply to any JSDoc block throughout your files (as is necessary
|
|
2101
|
+
* for finding function blocks not attached to a function declaration or
|
|
2102
|
+
* expression, i.e., `@callback` or `@function` (or its aliases `@func` or
|
|
2103
|
+
* `@method`) (including those associated with an `@interface`).
|
|
2104
|
+
*
|
|
2105
|
+
* See the ["AST and Selectors"](../#advanced-ast-and-selectors)
|
|
2106
|
+
* section of our Advanced docs for more on the expected format.
|
|
2107
|
+
*
|
|
2108
|
+
*/
|
|
622
2109
|
contexts?: (
|
|
623
2110
|
| string
|
|
624
2111
|
| {
|
|
@@ -629,11 +2116,27 @@ export interface Rules {
|
|
|
629
2116
|
}
|
|
630
2117
|
];
|
|
631
2118
|
|
|
632
|
-
/** Requires that each `@param` tag has a
|
|
2119
|
+
/** Requires that each `@param` tag has a type value (in curly brackets). */
|
|
633
2120
|
"jsdoc/require-param-type":
|
|
634
2121
|
| []
|
|
635
2122
|
| [
|
|
636
2123
|
{
|
|
2124
|
+
/**
|
|
2125
|
+
* Set this to an array of strings representing the AST context (or an object with
|
|
2126
|
+
* optional `context` and `comment` properties) where you wish the rule to be applied.
|
|
2127
|
+
*
|
|
2128
|
+
* `context` defaults to `any` and `comment` defaults to no specific comment context.
|
|
2129
|
+
*
|
|
2130
|
+
* Overrides the default contexts (`ArrowFunctionExpression`, `FunctionDeclaration`,
|
|
2131
|
+
* `FunctionExpression`). Set to `"any"` if you want
|
|
2132
|
+
* the rule to apply to any JSDoc block throughout your files (as is necessary
|
|
2133
|
+
* for finding function blocks not attached to a function declaration or
|
|
2134
|
+
* expression, i.e., `@callback` or `@function` (or its aliases `@func` or
|
|
2135
|
+
* `@method`) (including those associated with an `@interface`).
|
|
2136
|
+
*
|
|
2137
|
+
* See the ["AST and Selectors"](../#advanced-ast-and-selectors)
|
|
2138
|
+
* section of our Advanced docs for more on the expected format.
|
|
2139
|
+
*/
|
|
637
2140
|
contexts?: (
|
|
638
2141
|
| string
|
|
639
2142
|
| {
|
|
@@ -641,7 +2144,17 @@ export interface Rules {
|
|
|
641
2144
|
context?: string;
|
|
642
2145
|
}
|
|
643
2146
|
)[];
|
|
2147
|
+
/**
|
|
2148
|
+
* The type string to set by default for destructured roots. Defaults to "object".
|
|
2149
|
+
*/
|
|
644
2150
|
defaultDestructuredRootType?: string;
|
|
2151
|
+
/**
|
|
2152
|
+
* Whether to set a default destructured root type. For example, you may wish
|
|
2153
|
+
* to avoid manually having to set the type for a `@param`
|
|
2154
|
+
* corresponding to a destructured root object as it is always going to be an
|
|
2155
|
+
* object. Uses `defaultDestructuredRootType` for the type string. Defaults to
|
|
2156
|
+
* `false`.
|
|
2157
|
+
*/
|
|
645
2158
|
setDefaultDestructuredRootType?: boolean;
|
|
646
2159
|
}
|
|
647
2160
|
];
|
|
@@ -652,19 +2165,46 @@ export interface Rules {
|
|
|
652
2165
|
/** Requires that each `@property` tag has a `description` value. */
|
|
653
2166
|
"jsdoc/require-property-description": [];
|
|
654
2167
|
|
|
655
|
-
/** Requires that all
|
|
2168
|
+
/** Requires that all `@property` tags have names. */
|
|
656
2169
|
"jsdoc/require-property-name": [];
|
|
657
2170
|
|
|
658
|
-
/** Requires that each `@property` tag has a
|
|
2171
|
+
/** Requires that each `@property` tag has a type value (in curly brackets). */
|
|
659
2172
|
"jsdoc/require-property-type": [];
|
|
660
2173
|
|
|
661
|
-
/** Requires that returns are documented
|
|
2174
|
+
/** Requires that returns are documented with `@returns`. */
|
|
662
2175
|
"jsdoc/require-returns":
|
|
663
2176
|
| []
|
|
664
2177
|
| [
|
|
665
2178
|
{
|
|
2179
|
+
/**
|
|
2180
|
+
* A value indicating whether `constructor`s should
|
|
2181
|
+
* be checked for `@returns` tags. Defaults to `false`.
|
|
2182
|
+
*/
|
|
666
2183
|
checkConstructors?: boolean;
|
|
2184
|
+
/**
|
|
2185
|
+
* Boolean to determine whether getter methods should
|
|
2186
|
+
* be checked for `@returns` tags. Defaults to `true`.
|
|
2187
|
+
*/
|
|
667
2188
|
checkGetters?: boolean;
|
|
2189
|
+
/**
|
|
2190
|
+
* Set this to an array of strings representing the AST context
|
|
2191
|
+
* (or objects with optional `context` and `comment` properties) where you wish
|
|
2192
|
+
* the rule to be applied.
|
|
2193
|
+
*
|
|
2194
|
+
* `context` defaults to `any` and `comment` defaults to no specific comment context.
|
|
2195
|
+
*
|
|
2196
|
+
* Overrides the default contexts (`ArrowFunctionExpression`, `FunctionDeclaration`,
|
|
2197
|
+
* `FunctionExpression`). Set to `"any"` if you want
|
|
2198
|
+
* the rule to apply to any JSDoc block throughout your files (as is necessary
|
|
2199
|
+
* for finding function blocks not attached to a function declaration or
|
|
2200
|
+
* expression, i.e., `@callback` or `@function` (or its aliases `@func` or
|
|
2201
|
+
* `@method`) (including those associated with an `@interface`). This
|
|
2202
|
+
* rule will only apply on non-default contexts when there is such a tag
|
|
2203
|
+
* present and the `forceRequireReturn` option is set or if the
|
|
2204
|
+
* `forceReturnsWithAsync` option is set with a present `@async` tag
|
|
2205
|
+
* (since we are not checking against the actual `return` values in these
|
|
2206
|
+
* cases).
|
|
2207
|
+
*/
|
|
668
2208
|
contexts?: (
|
|
669
2209
|
| string
|
|
670
2210
|
| {
|
|
@@ -673,10 +2213,52 @@ export interface Rules {
|
|
|
673
2213
|
forceRequireReturn?: boolean;
|
|
674
2214
|
}
|
|
675
2215
|
)[];
|
|
2216
|
+
/**
|
|
2217
|
+
* Whether to enable the fixer to add a blank `@returns`.
|
|
2218
|
+
* Defaults to `false`.
|
|
2219
|
+
*/
|
|
676
2220
|
enableFixer?: boolean;
|
|
2221
|
+
/**
|
|
2222
|
+
* Array of tags (e.g., `['type']`) whose presence on the
|
|
2223
|
+
* document block avoids the need for a `@returns`. Defaults to an array
|
|
2224
|
+
* with `inheritdoc`. If you set this array, it will overwrite the default,
|
|
2225
|
+
* so be sure to add back `inheritdoc` if you wish its presence to cause
|
|
2226
|
+
* exemption of the rule.
|
|
2227
|
+
*/
|
|
677
2228
|
exemptedBy?: string[];
|
|
2229
|
+
/**
|
|
2230
|
+
* Set to `true` to always insist on
|
|
2231
|
+
* `@returns` documentation regardless of implicit or explicit `return`'s
|
|
2232
|
+
* in the function. May be desired to flag that a project is aware of an
|
|
2233
|
+
* `undefined`/`void` return. Defaults to `false`.
|
|
2234
|
+
*/
|
|
678
2235
|
forceRequireReturn?: boolean;
|
|
2236
|
+
/**
|
|
2237
|
+
* By default `async` functions that do not explicitly
|
|
2238
|
+
* return a value pass this rule as an `async` function will always return a
|
|
2239
|
+
* `Promise`, even if the `Promise` resolves to void. You can force all
|
|
2240
|
+
* `async` functions (including ones with an explicit `Promise` but no
|
|
2241
|
+
* detected non-`undefined` `resolve` value) to require `@return`
|
|
2242
|
+
* documentation by setting `forceReturnsWithAsync` to `true` on the options
|
|
2243
|
+
* object. This may be useful for flagging that there has been consideration
|
|
2244
|
+
* of return type. Defaults to `false`.
|
|
2245
|
+
*/
|
|
679
2246
|
forceReturnsWithAsync?: boolean;
|
|
2247
|
+
/**
|
|
2248
|
+
* This option will insist that missing `@returns` are only reported for
|
|
2249
|
+
* function bodies / class declarations that are exported from the module.
|
|
2250
|
+
* May be a boolean or object. If set to `true`, the defaults below will be
|
|
2251
|
+
* used. If unset, `@returns` reporting will not be limited to exports.
|
|
2252
|
+
*
|
|
2253
|
+
* This object supports the following optional boolean keys (`false` unless
|
|
2254
|
+
* otherwise noted):
|
|
2255
|
+
*
|
|
2256
|
+
* - `ancestorsOnly` - Optimization to only check node ancestors to check if node is exported
|
|
2257
|
+
* - `esm` - ESM exports are checked for `@returns` JSDoc comments (Defaults to `true`)
|
|
2258
|
+
* - `cjs` - CommonJS exports are checked for `@returns` JSDoc comments (Defaults to `true`)
|
|
2259
|
+
* - `window` - Window global exports are checked for `@returns` JSDoc comments
|
|
2260
|
+
*
|
|
2261
|
+
*/
|
|
680
2262
|
publicOnly?:
|
|
681
2263
|
| boolean
|
|
682
2264
|
| {
|
|
@@ -688,22 +2270,65 @@ export interface Rules {
|
|
|
688
2270
|
}
|
|
689
2271
|
];
|
|
690
2272
|
|
|
691
|
-
/** Requires a return statement in function body if a `@returns` tag is specified in
|
|
2273
|
+
/** Requires a return statement in function body if a `@returns` tag is specified in JSDoc comment(and reports if multiple `@returns` tags are present). */
|
|
692
2274
|
"jsdoc/require-returns-check":
|
|
693
2275
|
| []
|
|
694
2276
|
| [
|
|
695
2277
|
{
|
|
2278
|
+
/**
|
|
2279
|
+
* By default, functions which return a `Promise` that are not
|
|
2280
|
+
* detected as resolving with a non-`undefined` value and `async` functions
|
|
2281
|
+
* (even ones that do not explicitly return a value, as these are returning a
|
|
2282
|
+
* `Promise` implicitly) will be exempted from reporting by this rule.
|
|
2283
|
+
* If you wish to insist that only `Promise`'s which resolve to
|
|
2284
|
+
* non-`undefined` values or `async` functions with explicit `return`'s will
|
|
2285
|
+
* be exempted from reporting (i.e., that `async` functions can be reported
|
|
2286
|
+
* if they lack an explicit (non-`undefined`) `return` when a `@returns` is
|
|
2287
|
+
* present), you can set `exemptAsync` to `false` on the options object.
|
|
2288
|
+
*/
|
|
696
2289
|
exemptAsync?: boolean;
|
|
2290
|
+
/**
|
|
2291
|
+
* Because a generator might be labeled as having a
|
|
2292
|
+
* `IterableIterator` `@returns` value (along with an iterator type
|
|
2293
|
+
* corresponding to the type of any `yield` statements), projects might wish to
|
|
2294
|
+
* leverage `@returns` in generators even without a `return` statement. This
|
|
2295
|
+
* option is therefore `true` by default in `typescript` mode (in "jsdoc" mode,
|
|
2296
|
+
* one might be more likely to take advantage of `@yields`). Set it to `false`
|
|
2297
|
+
* if you wish for a missing `return` to be flagged regardless.
|
|
2298
|
+
*/
|
|
697
2299
|
exemptGenerators?: boolean;
|
|
2300
|
+
/**
|
|
2301
|
+
* If `true` and no return or
|
|
2302
|
+
* resolve value is found, this setting will even insist that reporting occur
|
|
2303
|
+
* with `void` or `undefined` (including as an indicated `Promise` type).
|
|
2304
|
+
* Unlike `require-returns`, with this option in the rule, one can
|
|
2305
|
+
* *discourage* the labeling of `undefined` types. Defaults to `false`.
|
|
2306
|
+
*/
|
|
698
2307
|
reportMissingReturnForUndefinedTypes?: boolean;
|
|
699
2308
|
}
|
|
700
2309
|
];
|
|
701
2310
|
|
|
702
|
-
/** Requires that the `@returns` tag has a `description` value. */
|
|
2311
|
+
/** Requires that the `@returns` tag has a `description` value (not including `void`/`undefined` type returns). */
|
|
703
2312
|
"jsdoc/require-returns-description":
|
|
704
2313
|
| []
|
|
705
2314
|
| [
|
|
706
2315
|
{
|
|
2316
|
+
/**
|
|
2317
|
+
* Set this to an array of strings representing the AST context (or an object with
|
|
2318
|
+
* optional `context` and `comment` properties) where you wish the rule to be applied.
|
|
2319
|
+
*
|
|
2320
|
+
* `context` defaults to `any` and `comment` defaults to no specific comment context.
|
|
2321
|
+
*
|
|
2322
|
+
* Overrides the default contexts (`ArrowFunctionExpression`, `FunctionDeclaration`,
|
|
2323
|
+
* `FunctionExpression`). Set to `"any"` if you want
|
|
2324
|
+
* the rule to apply to any JSDoc block throughout your files (as is necessary
|
|
2325
|
+
* for finding function blocks not attached to a function declaration or
|
|
2326
|
+
* expression, i.e., `@callback` or `@function` (or its aliases `@func` or
|
|
2327
|
+
* `@method`) (including those associated with an `@interface`).
|
|
2328
|
+
*
|
|
2329
|
+
* See the ["AST and Selectors"](../#advanced-ast-and-selectors)
|
|
2330
|
+
* section of our Advanced docs for more on the expected format.
|
|
2331
|
+
*/
|
|
707
2332
|
contexts?: (
|
|
708
2333
|
| string
|
|
709
2334
|
| {
|
|
@@ -714,11 +2339,27 @@ export interface Rules {
|
|
|
714
2339
|
}
|
|
715
2340
|
];
|
|
716
2341
|
|
|
717
|
-
/** Requires that `@returns` tag has
|
|
2342
|
+
/** Requires that `@returns` tag has type value (in curly brackets). */
|
|
718
2343
|
"jsdoc/require-returns-type":
|
|
719
2344
|
| []
|
|
720
2345
|
| [
|
|
721
2346
|
{
|
|
2347
|
+
/**
|
|
2348
|
+
* Set this to an array of strings representing the AST context (or an object with
|
|
2349
|
+
* optional `context` and `comment` properties) where you wish the rule to be applied.
|
|
2350
|
+
*
|
|
2351
|
+
* `context` defaults to `any` and `comment` defaults to no specific comment context.
|
|
2352
|
+
*
|
|
2353
|
+
* Overrides the default contexts (`ArrowFunctionExpression`, `FunctionDeclaration`,
|
|
2354
|
+
* `FunctionExpression`). Set to `"any"` if you want
|
|
2355
|
+
* the rule to apply to any JSDoc block throughout your files (as is necessary
|
|
2356
|
+
* for finding function blocks not attached to a function declaration or
|
|
2357
|
+
* expression, i.e., `@callback` or `@function` (or its aliases `@func` or
|
|
2358
|
+
* `@method`) (including those associated with an `@interface`).
|
|
2359
|
+
*
|
|
2360
|
+
* See the ["AST and Selectors"](../#advanced-ast-and-selectors)
|
|
2361
|
+
* section of our Advanced docs for more on the expected format.
|
|
2362
|
+
*/
|
|
722
2363
|
contexts?: (
|
|
723
2364
|
| string
|
|
724
2365
|
| {
|
|
@@ -729,21 +2370,55 @@ export interface Rules {
|
|
|
729
2370
|
}
|
|
730
2371
|
];
|
|
731
2372
|
|
|
732
|
-
/** Requires template tags
|
|
2373
|
+
/** Requires `@template` tags be present when type parameters are used. */
|
|
733
2374
|
"jsdoc/require-template":
|
|
734
2375
|
| []
|
|
735
2376
|
| [
|
|
736
2377
|
{
|
|
2378
|
+
/**
|
|
2379
|
+
* Array of tags (e.g., `['type']`) whose presence on the document
|
|
2380
|
+
* block avoids the need for a `@template`. Defaults to an array with
|
|
2381
|
+
* `inheritdoc`. If you set this array, it will overwrite the default,
|
|
2382
|
+
* so be sure to add back `inheritdoc` if you wish its presence to cause
|
|
2383
|
+
* exemption of the rule.
|
|
2384
|
+
*/
|
|
737
2385
|
exemptedBy?: string[];
|
|
2386
|
+
/**
|
|
2387
|
+
* Requires that each template have its own separate line, i.e., preventing
|
|
2388
|
+
* templates of this format:
|
|
2389
|
+
*
|
|
2390
|
+
* ```js
|
|
2391
|
+
* /**
|
|
2392
|
+
* * @template T, U, V
|
|
2393
|
+
* * /
|
|
2394
|
+
* ```
|
|
2395
|
+
*
|
|
2396
|
+
* Defaults to `false`.
|
|
2397
|
+
*
|
|
2398
|
+
*/
|
|
738
2399
|
requireSeparateTemplates?: boolean;
|
|
739
2400
|
}
|
|
740
2401
|
];
|
|
741
2402
|
|
|
742
|
-
/** Requires that throw statements are documented. */
|
|
2403
|
+
/** Requires that throw statements are documented with `@throws` tags. */
|
|
743
2404
|
"jsdoc/require-throws":
|
|
744
2405
|
| []
|
|
745
2406
|
| [
|
|
746
2407
|
{
|
|
2408
|
+
/**
|
|
2409
|
+
* Set this to an array of strings representing the AST context
|
|
2410
|
+
* (or objects with optional `context` and `comment` properties) where you wish
|
|
2411
|
+
* the rule to be applied.
|
|
2412
|
+
*
|
|
2413
|
+
* `context` defaults to `any` and `comment` defaults to no specific comment context.
|
|
2414
|
+
*
|
|
2415
|
+
* Overrides the default contexts (`ArrowFunctionExpression`, `FunctionDeclaration`,
|
|
2416
|
+
* `FunctionExpression`). Set to `"any"` if you want
|
|
2417
|
+
* the rule to apply to any JSDoc block throughout your files (as is necessary
|
|
2418
|
+
* for finding function blocks not attached to a function declaration or
|
|
2419
|
+
* expression, i.e., `@callback` or `@function` (or its aliases `@func` or
|
|
2420
|
+
* `@method`) (including those associated with an `@interface`).
|
|
2421
|
+
*/
|
|
747
2422
|
contexts?: (
|
|
748
2423
|
| string
|
|
749
2424
|
| {
|
|
@@ -751,18 +2426,47 @@ export interface Rules {
|
|
|
751
2426
|
context?: string;
|
|
752
2427
|
}
|
|
753
2428
|
)[];
|
|
2429
|
+
/**
|
|
2430
|
+
* Array of tags (e.g., `['type']`) whose presence on the
|
|
2431
|
+
* document block avoids the need for a `@throws`. Defaults to an array
|
|
2432
|
+
* with `inheritdoc`. If you set this array, it will overwrite the default,
|
|
2433
|
+
* so be sure to add back `inheritdoc` if you wish its presence to cause
|
|
2434
|
+
* exemption of the rule.
|
|
2435
|
+
*/
|
|
754
2436
|
exemptedBy?: string[];
|
|
755
2437
|
}
|
|
756
2438
|
];
|
|
757
2439
|
|
|
2440
|
+
/** Requires a description for `@throws` tags */
|
|
2441
|
+
"jsdoc/require-throws-description": [];
|
|
2442
|
+
|
|
758
2443
|
/** Requires a type for `@throws` tags */
|
|
759
2444
|
"jsdoc/require-throws-type": [];
|
|
760
2445
|
|
|
761
|
-
/** Requires yields are documented. */
|
|
2446
|
+
/** Requires yields are documented with `@yields` tags. */
|
|
762
2447
|
"jsdoc/require-yields":
|
|
763
2448
|
| []
|
|
764
2449
|
| [
|
|
765
2450
|
{
|
|
2451
|
+
/**
|
|
2452
|
+
* Set this to an array of strings representing the AST context
|
|
2453
|
+
* (or objects with optional `context` and `comment` properties) where you wish
|
|
2454
|
+
* the rule to be applied.
|
|
2455
|
+
*
|
|
2456
|
+
* `context` defaults to `any` and `comment` defaults to no specific comment context.
|
|
2457
|
+
*
|
|
2458
|
+
* Overrides the default contexts (`ArrowFunctionExpression`, `FunctionDeclaration`,
|
|
2459
|
+
* `FunctionExpression`). Set to `"any"` if you want
|
|
2460
|
+
* the rule to apply to any JSDoc block throughout your files (as is necessary
|
|
2461
|
+
* for finding function blocks not attached to a function declaration or
|
|
2462
|
+
* expression, i.e., `@callback` or `@function` (or its aliases `@func` or
|
|
2463
|
+
* `@method`) (including those associated with an `@interface`). This
|
|
2464
|
+
* rule will only apply on non-default contexts when there is such a tag
|
|
2465
|
+
* present and the `forceRequireYields` option is set or if the
|
|
2466
|
+
* `withGeneratorTag` option is set with a present `@generator` tag
|
|
2467
|
+
* (since we are not checking against the actual `yield` values in these
|
|
2468
|
+
* cases).
|
|
2469
|
+
*/
|
|
766
2470
|
contexts?: (
|
|
767
2471
|
| string
|
|
768
2472
|
| {
|
|
@@ -770,21 +2474,82 @@ export interface Rules {
|
|
|
770
2474
|
context?: string;
|
|
771
2475
|
}
|
|
772
2476
|
)[];
|
|
2477
|
+
/**
|
|
2478
|
+
* Array of tags (e.g., `['type']`) whose presence on the
|
|
2479
|
+
* document block avoids the need for a `@yields`. Defaults to an array
|
|
2480
|
+
* with `inheritdoc`. If you set this array, it will overwrite the default,
|
|
2481
|
+
* so be sure to add back `inheritdoc` if you wish its presence to cause
|
|
2482
|
+
* exemption of the rule.
|
|
2483
|
+
*/
|
|
773
2484
|
exemptedBy?: string[];
|
|
2485
|
+
/**
|
|
2486
|
+
* Set to `true` to always insist on
|
|
2487
|
+
* `@next` documentation even if there are no `yield` statements in the
|
|
2488
|
+
* function or none return values. May be desired to flag that a project is
|
|
2489
|
+
* aware of the expected yield return being `undefined`. Defaults to `false`.
|
|
2490
|
+
*/
|
|
774
2491
|
forceRequireNext?: boolean;
|
|
2492
|
+
/**
|
|
2493
|
+
* Set to `true` to always insist on
|
|
2494
|
+
* `@yields` documentation for generators even if there are only
|
|
2495
|
+
* expressionless `yield` statements in the function. May be desired to flag
|
|
2496
|
+
* that a project is aware of an `undefined`/`void` yield. Defaults to
|
|
2497
|
+
* `false`.
|
|
2498
|
+
*/
|
|
775
2499
|
forceRequireYields?: boolean;
|
|
2500
|
+
/**
|
|
2501
|
+
* If `true`, this option will insist that any use of a `yield` return
|
|
2502
|
+
* value (e.g., `const rv = yield;` or `const rv = yield value;`) has a
|
|
2503
|
+
* (non-standard) `@next` tag (in addition to any `@yields` tag) so as to be
|
|
2504
|
+
* able to document the type expected to be supplied into the iterator
|
|
2505
|
+
* (the `Generator` iterator that is returned by the call to the generator
|
|
2506
|
+
* function) to the iterator (e.g., `it.next(value)`). The tag will not be
|
|
2507
|
+
* expected if the generator function body merely has plain `yield;` or
|
|
2508
|
+
* `yield value;` statements without returning the values. Defaults to
|
|
2509
|
+
* `false`.
|
|
2510
|
+
*/
|
|
776
2511
|
next?: boolean;
|
|
2512
|
+
/**
|
|
2513
|
+
* If a `@generator` tag is present on a block, require
|
|
2514
|
+
* (non-standard ) `@next` (see `next` option). This will require using `void`
|
|
2515
|
+
* or `undefined` in cases where generators do not use the `next()`-supplied
|
|
2516
|
+
* incoming `yield`-returned value. Defaults to `false`. See `contexts` to
|
|
2517
|
+
* `any` if you want to catch `@generator` with `@callback` or such not
|
|
2518
|
+
* attached to a function.
|
|
2519
|
+
*/
|
|
777
2520
|
nextWithGeneratorTag?: boolean;
|
|
2521
|
+
/**
|
|
2522
|
+
* If a `@generator` tag is present on a block, require
|
|
2523
|
+
* `@yields`/`@yield`. Defaults to `true`. See `contexts` to `any` if you want
|
|
2524
|
+
* to catch `@generator` with `@callback` or such not attached to a function.
|
|
2525
|
+
*/
|
|
778
2526
|
withGeneratorTag?: boolean;
|
|
779
2527
|
}
|
|
780
2528
|
];
|
|
781
2529
|
|
|
782
|
-
/**
|
|
2530
|
+
/** Ensures that if a `@yields` is present that a `yield` (or `yield` with a value) is present in the function body (or that if a `@next` is present that there is a yield with a return value present). */
|
|
783
2531
|
"jsdoc/require-yields-check":
|
|
784
2532
|
| []
|
|
785
2533
|
| [
|
|
786
2534
|
{
|
|
2535
|
+
/**
|
|
2536
|
+
* Avoids checking the function body and merely insists
|
|
2537
|
+
* that all generators have `@yields`. This can be an optimization with the
|
|
2538
|
+
* ESLint `require-yield` rule, as that rule already ensures a `yield` is
|
|
2539
|
+
* present in generators, albeit assuming the generator is not empty).
|
|
2540
|
+
* Defaults to `false`.
|
|
2541
|
+
*/
|
|
787
2542
|
checkGeneratorsOnly?: boolean;
|
|
2543
|
+
/**
|
|
2544
|
+
* Set this to an array of strings representing the AST context
|
|
2545
|
+
* (or objects with optional `context` and `comment` properties) where you wish
|
|
2546
|
+
* the rule to be applied.
|
|
2547
|
+
*
|
|
2548
|
+
* `context` defaults to `any` and `comment` defaults to no specific comment context.
|
|
2549
|
+
*
|
|
2550
|
+
* Overrides the default contexts (`ArrowFunctionExpression`, `FunctionDeclaration`,
|
|
2551
|
+
* `FunctionExpression`).
|
|
2552
|
+
*/
|
|
788
2553
|
contexts?: (
|
|
789
2554
|
| string
|
|
790
2555
|
| {
|
|
@@ -792,24 +2557,250 @@ export interface Rules {
|
|
|
792
2557
|
context?: string;
|
|
793
2558
|
}
|
|
794
2559
|
)[];
|
|
795
|
-
|
|
2560
|
+
/**
|
|
2561
|
+
* If `true`, this option will insist that any use of a (non-standard)
|
|
2562
|
+
* `@next` tag (in addition to any `@yields` tag) will be matched by a `yield`
|
|
2563
|
+
* which uses a return value in the body of the generator (e.g.,
|
|
2564
|
+
* `const rv = yield;` or `const rv = yield value;`). This (non-standard)
|
|
2565
|
+
* tag is intended to be used to indicate a type and/or description of
|
|
2566
|
+
* the value expected to be supplied by the user when supplied to the iterator
|
|
2567
|
+
* by its `next` method, as with `it.next(value)` (with the iterator being
|
|
2568
|
+
* the `Generator` iterator that is returned by the call to the generator
|
|
2569
|
+
* function). This option will report an error if the generator function body
|
|
2570
|
+
* merely has plain `yield;` or `yield value;` statements without returning
|
|
2571
|
+
* the values. Defaults to `false`.
|
|
2572
|
+
*/
|
|
796
2573
|
next?: boolean;
|
|
797
2574
|
}
|
|
798
2575
|
];
|
|
799
2576
|
|
|
2577
|
+
/** Requires a description for `@yields` tags */
|
|
2578
|
+
"jsdoc/require-yields-description": [];
|
|
2579
|
+
|
|
800
2580
|
/** Requires a type for `@yields` tags */
|
|
801
2581
|
"jsdoc/require-yields-type": [];
|
|
802
2582
|
|
|
803
|
-
/** Sorts tags by a specified sequence according to tag name. */
|
|
2583
|
+
/** Sorts tags by a specified sequence according to tag name, optionally adding line breaks between tag groups. */
|
|
804
2584
|
"jsdoc/sort-tags":
|
|
805
2585
|
| []
|
|
806
2586
|
| [
|
|
807
2587
|
{
|
|
2588
|
+
/**
|
|
2589
|
+
* Defaults to `false`. Alphabetizes any items not within `tagSequence` after any
|
|
2590
|
+
* items within `tagSequence` (or in place of the special `-other` pseudo-tag)
|
|
2591
|
+
* are sorted.
|
|
2592
|
+
*
|
|
2593
|
+
* If you want all your tags alphabetized, you can supply an empty array for
|
|
2594
|
+
* `tagSequence` along with setting this option to `true`.
|
|
2595
|
+
*/
|
|
808
2596
|
alphabetizeExtras?: boolean;
|
|
2597
|
+
/**
|
|
2598
|
+
* Indicates the number of lines to be added between tag groups. Defaults to 1.
|
|
2599
|
+
* Do not set to 0 or 2+ if you are using `tag-lines` and `"always"` and do not
|
|
2600
|
+
* set to 1+ if you are using `tag-lines` and `"never"`.
|
|
2601
|
+
*/
|
|
809
2602
|
linesBetween?: number;
|
|
2603
|
+
/**
|
|
2604
|
+
* Whether to enable reporting and fixing of line breaks within tags of a given
|
|
2605
|
+
* tag group. Defaults to `true` which will remove any line breaks at the end of
|
|
2606
|
+
* such tags. Do not use with `true` if you are using `tag-lines` and `always`.
|
|
2607
|
+
*/
|
|
810
2608
|
reportIntraTagGroupSpacing?: boolean;
|
|
2609
|
+
/**
|
|
2610
|
+
* Whether to enable reporting and fixing of line breaks between tag groups
|
|
2611
|
+
* as set by `linesBetween`. Defaults to `true`. Note that the very last tag
|
|
2612
|
+
* will not have spacing applied regardless. For adding line breaks there, you
|
|
2613
|
+
* may wish to use the `endLines` option of the `tag-lines` rule.
|
|
2614
|
+
*/
|
|
811
2615
|
reportTagGroupSpacing?: boolean;
|
|
2616
|
+
/**
|
|
2617
|
+
* An array of tag group objects indicating the preferred sequence for sorting tags.
|
|
2618
|
+
*
|
|
2619
|
+
* Each item in the array should be an object with a `tags` property set to an array
|
|
2620
|
+
* of tag names.
|
|
2621
|
+
*
|
|
2622
|
+
* Tag names earlier in the list will be arranged first. The relative position of
|
|
2623
|
+
* tags of the same name will not be changed.
|
|
2624
|
+
*
|
|
2625
|
+
* Earlier groups will also be arranged before later groups, but with the added
|
|
2626
|
+
* feature that additional line breaks may be added between (or before or after)
|
|
2627
|
+
* such groups (depending on the setting of `linesBetween`).
|
|
2628
|
+
*
|
|
2629
|
+
* Tag names not in the list will be grouped together at the end. The pseudo-tag
|
|
2630
|
+
* `-other` can be used to place them anywhere else if desired. The tags will be
|
|
2631
|
+
* placed in their order of appearance, or alphabetized if `alphabetizeExtras`
|
|
2632
|
+
* is enabled, see more below about that option.
|
|
2633
|
+
*
|
|
2634
|
+
* Defaults to the array below (noting that it is just a single tag group with
|
|
2635
|
+
* no lines between groups by default).
|
|
2636
|
+
*
|
|
2637
|
+
* Please note that this order is still experimental, so if you want to retain
|
|
2638
|
+
* a fixed order that doesn't change into the future, supply your own
|
|
2639
|
+
* `tagSequence`.
|
|
2640
|
+
*
|
|
2641
|
+
* ```js
|
|
2642
|
+
* [{tags: [
|
|
2643
|
+
* // Brief descriptions
|
|
2644
|
+
* 'summary',
|
|
2645
|
+
* 'typeSummary',
|
|
2646
|
+
*
|
|
2647
|
+
* // Module/file-level
|
|
2648
|
+
* 'module',
|
|
2649
|
+
* 'exports',
|
|
2650
|
+
* 'file',
|
|
2651
|
+
* 'fileoverview',
|
|
2652
|
+
* 'overview',
|
|
2653
|
+
* 'import',
|
|
2654
|
+
*
|
|
2655
|
+
* // Identifying (name, type)
|
|
2656
|
+
* 'typedef',
|
|
2657
|
+
* 'interface',
|
|
2658
|
+
* 'record',
|
|
2659
|
+
* 'template',
|
|
2660
|
+
* 'name',
|
|
2661
|
+
* 'kind',
|
|
2662
|
+
* 'type',
|
|
2663
|
+
* 'alias',
|
|
2664
|
+
* 'external',
|
|
2665
|
+
* 'host',
|
|
2666
|
+
* 'callback',
|
|
2667
|
+
* 'func',
|
|
2668
|
+
* 'function',
|
|
2669
|
+
* 'method',
|
|
2670
|
+
* 'class',
|
|
2671
|
+
* 'constructor',
|
|
2672
|
+
*
|
|
2673
|
+
* // Relationships
|
|
2674
|
+
* 'modifies',
|
|
2675
|
+
* 'mixes',
|
|
2676
|
+
* 'mixin',
|
|
2677
|
+
* 'mixinClass',
|
|
2678
|
+
* 'mixinFunction',
|
|
2679
|
+
* 'namespace',
|
|
2680
|
+
* 'borrows',
|
|
2681
|
+
* 'constructs',
|
|
2682
|
+
* 'lends',
|
|
2683
|
+
* 'implements',
|
|
2684
|
+
* 'requires',
|
|
2685
|
+
*
|
|
2686
|
+
* // Long descriptions
|
|
2687
|
+
* 'desc',
|
|
2688
|
+
* 'description',
|
|
2689
|
+
* 'classdesc',
|
|
2690
|
+
* 'tutorial',
|
|
2691
|
+
* 'copyright',
|
|
2692
|
+
* 'license',
|
|
2693
|
+
*
|
|
2694
|
+
* // Simple annotations
|
|
2695
|
+
* 'const',
|
|
2696
|
+
* 'constant',
|
|
2697
|
+
* 'final',
|
|
2698
|
+
* 'global',
|
|
2699
|
+
* 'readonly',
|
|
2700
|
+
* 'abstract',
|
|
2701
|
+
* 'virtual',
|
|
2702
|
+
* 'var',
|
|
2703
|
+
* 'member',
|
|
2704
|
+
* 'memberof',
|
|
2705
|
+
* 'memberof!',
|
|
2706
|
+
* 'inner',
|
|
2707
|
+
* 'instance',
|
|
2708
|
+
* 'inheritdoc',
|
|
2709
|
+
* 'inheritDoc',
|
|
2710
|
+
* 'override',
|
|
2711
|
+
* 'hideconstructor',
|
|
2712
|
+
*
|
|
2713
|
+
* // Core function/object info
|
|
2714
|
+
* 'param',
|
|
2715
|
+
* 'arg',
|
|
2716
|
+
* 'argument',
|
|
2717
|
+
* 'prop',
|
|
2718
|
+
* 'property',
|
|
2719
|
+
* 'return',
|
|
2720
|
+
* 'returns',
|
|
2721
|
+
*
|
|
2722
|
+
* // Important behavior details
|
|
2723
|
+
* 'async',
|
|
2724
|
+
* 'generator',
|
|
2725
|
+
* 'default',
|
|
2726
|
+
* 'defaultvalue',
|
|
2727
|
+
* 'enum',
|
|
2728
|
+
* 'augments',
|
|
2729
|
+
* 'extends',
|
|
2730
|
+
* 'throws',
|
|
2731
|
+
* 'exception',
|
|
2732
|
+
* 'yield',
|
|
2733
|
+
* 'yields',
|
|
2734
|
+
* 'event',
|
|
2735
|
+
* 'fires',
|
|
2736
|
+
* 'emits',
|
|
2737
|
+
* 'listens',
|
|
2738
|
+
* 'this',
|
|
2739
|
+
*
|
|
2740
|
+
* // Access
|
|
2741
|
+
* 'static',
|
|
2742
|
+
* 'private',
|
|
2743
|
+
* 'protected',
|
|
2744
|
+
* 'public',
|
|
2745
|
+
* 'access',
|
|
2746
|
+
* 'package',
|
|
2747
|
+
*
|
|
2748
|
+
* '-other',
|
|
2749
|
+
*
|
|
2750
|
+
* // Supplementary descriptions
|
|
2751
|
+
* 'see',
|
|
2752
|
+
* 'example',
|
|
2753
|
+
*
|
|
2754
|
+
* // METADATA
|
|
2755
|
+
*
|
|
2756
|
+
* // Other Closure (undocumented) metadata
|
|
2757
|
+
* 'closurePrimitive',
|
|
2758
|
+
* 'customElement',
|
|
2759
|
+
* 'expose',
|
|
2760
|
+
* 'hidden',
|
|
2761
|
+
* 'idGenerator',
|
|
2762
|
+
* 'meaning',
|
|
2763
|
+
* 'ngInject',
|
|
2764
|
+
* 'owner',
|
|
2765
|
+
* 'wizaction',
|
|
2766
|
+
*
|
|
2767
|
+
* // Other Closure (documented) metadata
|
|
2768
|
+
* 'define',
|
|
2769
|
+
* 'dict',
|
|
2770
|
+
* 'export',
|
|
2771
|
+
* 'externs',
|
|
2772
|
+
* 'implicitCast',
|
|
2773
|
+
* 'noalias',
|
|
2774
|
+
* 'nocollapse',
|
|
2775
|
+
* 'nocompile',
|
|
2776
|
+
* 'noinline',
|
|
2777
|
+
* 'nosideeffects',
|
|
2778
|
+
* 'polymer',
|
|
2779
|
+
* 'polymerBehavior',
|
|
2780
|
+
* 'preserve',
|
|
2781
|
+
* 'struct',
|
|
2782
|
+
* 'suppress',
|
|
2783
|
+
* 'unrestricted',
|
|
2784
|
+
*
|
|
2785
|
+
* // @homer0/prettier-plugin-jsdoc metadata
|
|
2786
|
+
* 'category',
|
|
2787
|
+
*
|
|
2788
|
+
* // Non-Closure metadata
|
|
2789
|
+
* 'ignore',
|
|
2790
|
+
* 'author',
|
|
2791
|
+
* 'version',
|
|
2792
|
+
* 'variation',
|
|
2793
|
+
* 'since',
|
|
2794
|
+
* 'deprecated',
|
|
2795
|
+
* 'todo',
|
|
2796
|
+
* ]}];
|
|
2797
|
+
* ```
|
|
2798
|
+
*
|
|
2799
|
+
*/
|
|
812
2800
|
tagSequence?: {
|
|
2801
|
+
/**
|
|
2802
|
+
* See description on `tagSequence`.
|
|
2803
|
+
*/
|
|
813
2804
|
tags?: string[];
|
|
814
2805
|
}[];
|
|
815
2806
|
}
|
|
@@ -822,10 +2813,45 @@ export interface Rules {
|
|
|
822
2813
|
| [
|
|
823
2814
|
"always" | "any" | "never",
|
|
824
2815
|
{
|
|
2816
|
+
/**
|
|
2817
|
+
* Set to `false` and use with "always" to indicate the normal lines to be
|
|
2818
|
+
* added after tags should not be added after the final tag.
|
|
2819
|
+
*
|
|
2820
|
+
* Defaults to `true`.
|
|
2821
|
+
*/
|
|
825
2822
|
applyToEndTag?: boolean;
|
|
2823
|
+
/**
|
|
2824
|
+
* Use with "always" to indicate the number of lines to require be present.
|
|
2825
|
+
*
|
|
2826
|
+
* Defaults to 1.
|
|
2827
|
+
*/
|
|
826
2828
|
count?: number;
|
|
2829
|
+
/**
|
|
2830
|
+
* If not set to `null`, will enforce end lines to the given count on the
|
|
2831
|
+
* final tag only.
|
|
2832
|
+
*
|
|
2833
|
+
* Defaults to `0`.
|
|
2834
|
+
*/
|
|
827
2835
|
endLines?: number | null;
|
|
2836
|
+
/**
|
|
2837
|
+
* If not set to `null`, will enforce end lines to the given count before the
|
|
2838
|
+
* first tag only, unless there is only whitespace content, in which case,
|
|
2839
|
+
* a line count will not be enforced.
|
|
2840
|
+
*
|
|
2841
|
+
* Defaults to `0`.
|
|
2842
|
+
*/
|
|
828
2843
|
startLines?: number | null;
|
|
2844
|
+
/**
|
|
2845
|
+
* Overrides the default behavior depending on specific tags.
|
|
2846
|
+
*
|
|
2847
|
+
* An object whose keys are tag names and whose values are objects with the
|
|
2848
|
+
* following keys:
|
|
2849
|
+
*
|
|
2850
|
+
* 1. `lines` - Set to `always`, `never`, or `any` to override.
|
|
2851
|
+
* 2. `count` - Overrides main `count` (for "always")
|
|
2852
|
+
*
|
|
2853
|
+
* Defaults to empty object.
|
|
2854
|
+
*/
|
|
829
2855
|
tags?: {
|
|
830
2856
|
/**
|
|
831
2857
|
* This interface was referenced by `undefined`'s JSON-Schema definition
|
|
@@ -844,7 +2870,16 @@ export interface Rules {
|
|
|
844
2870
|
| []
|
|
845
2871
|
| [
|
|
846
2872
|
{
|
|
2873
|
+
/**
|
|
2874
|
+
* This option escapes all `<` and `&` characters (except those followed by
|
|
2875
|
+
* whitespace which are treated as literals by Visual Studio Code). Defaults to
|
|
2876
|
+
* `false`.
|
|
2877
|
+
*/
|
|
847
2878
|
escapeHTML?: boolean;
|
|
2879
|
+
/**
|
|
2880
|
+
* This option escapes the first backtick (`` ` ``) in a paired sequence.
|
|
2881
|
+
* Defaults to `false`.
|
|
2882
|
+
*/
|
|
848
2883
|
escapeMarkdown?: boolean;
|
|
849
2884
|
}
|
|
850
2885
|
];
|
|
@@ -854,27 +2889,90 @@ export interface Rules {
|
|
|
854
2889
|
| []
|
|
855
2890
|
| [
|
|
856
2891
|
{
|
|
2892
|
+
/**
|
|
2893
|
+
* Determines how array generics are represented. Set to `angle` for the style `Array<type>` or `square` for the style `type[]`. Defaults to "square".
|
|
2894
|
+
*/
|
|
857
2895
|
arrayBrackets?: "angle" | "square";
|
|
2896
|
+
/**
|
|
2897
|
+
* Whether to enable the fixer. Defaults to `true`.
|
|
2898
|
+
*/
|
|
858
2899
|
enableFixer?: boolean;
|
|
2900
|
+
/**
|
|
2901
|
+
* Boolean value of whether to use a dot before the angled brackets of a generic (e.g., `SomeType.<AnotherType>`). Defaults to `false`.
|
|
2902
|
+
*/
|
|
859
2903
|
genericDot?: boolean;
|
|
2904
|
+
/**
|
|
2905
|
+
* A string indicating the whitespace to be added on each line preceding an
|
|
2906
|
+
* object property-value field. Defaults to the empty string.
|
|
2907
|
+
*/
|
|
860
2908
|
objectFieldIndent?: string;
|
|
2909
|
+
/**
|
|
2910
|
+
* Whether and how object field properties should be quoted (e.g., `{"a": string}`).
|
|
2911
|
+
* Set to `single`, `double`, or `null`. Defaults to `null` (no quotes unless
|
|
2912
|
+
* required due to special characters within the field). Digits will be kept as is,
|
|
2913
|
+
* regardless of setting (they can either represent a digit or a string digit).
|
|
2914
|
+
*/
|
|
861
2915
|
objectFieldQuote?: "double" | "single" | null;
|
|
2916
|
+
/**
|
|
2917
|
+
* For object properties, specify whether a "semicolon", "comma", "linebreak",
|
|
2918
|
+
* "semicolon-and-linebreak", or "comma-and-linebreak" should be used after
|
|
2919
|
+
* each object property-value pair.
|
|
2920
|
+
*
|
|
2921
|
+
* Defaults to `"comma"`.
|
|
2922
|
+
*/
|
|
862
2923
|
objectFieldSeparator?: "comma" | "comma-and-linebreak" | "linebreak" | "semicolon" | "semicolon-and-linebreak";
|
|
2924
|
+
/**
|
|
2925
|
+
* Whether `objectFieldSeparator` set to `"semicolon-and-linebreak"` or
|
|
2926
|
+
* `"comma-and-linebreak"` should be allowed to optionally drop the linebreak.
|
|
2927
|
+
*
|
|
2928
|
+
* Defaults to `true`.
|
|
2929
|
+
*/
|
|
863
2930
|
objectFieldSeparatorOptionalLinebreak?: boolean;
|
|
2931
|
+
/**
|
|
2932
|
+
* If `separatorForSingleObjectField` is not in effect (i.e., if it is `false`
|
|
2933
|
+
* or there are multiple property-value object fields present), this property
|
|
2934
|
+
* will determine whether to add punctuation corresponding to the
|
|
2935
|
+
* `objectFieldSeparator` (e.g., a semicolon) to the final object field.
|
|
2936
|
+
* Defaults to `false`.
|
|
2937
|
+
*/
|
|
864
2938
|
objectFieldSeparatorTrailingPunctuation?: boolean;
|
|
865
|
-
|
|
2939
|
+
/**
|
|
2940
|
+
* Whether to apply the `objectFieldSeparator` (e.g., a semicolon) when there
|
|
2941
|
+
* is only one property-value object field present. Defaults to `false`.
|
|
2942
|
+
*/
|
|
866
2943
|
separatorForSingleObjectField?: boolean;
|
|
2944
|
+
/**
|
|
2945
|
+
* How string literals should be quoted (e.g., `"abc"`). Set to `single`
|
|
2946
|
+
* or `double`. Defaults to 'single'.
|
|
2947
|
+
*/
|
|
867
2948
|
stringQuotes?: "double" | "single";
|
|
2949
|
+
/**
|
|
2950
|
+
* A string of spaces that will be added immediately after the type's initial
|
|
2951
|
+
* curly bracket and immediately before its ending curly bracket. Defaults
|
|
2952
|
+
* to the empty string.
|
|
2953
|
+
*/
|
|
868
2954
|
typeBracketSpacing?: string;
|
|
2955
|
+
/**
|
|
2956
|
+
* Determines the spacing to add to unions (`|`). Defaults to a single space (`" "`).
|
|
2957
|
+
*/
|
|
869
2958
|
unionSpacing?: string;
|
|
870
2959
|
}
|
|
871
2960
|
];
|
|
872
2961
|
|
|
873
|
-
/** Requires all types to be valid JSDoc
|
|
2962
|
+
/** Requires all types/namepaths to be valid JSDoc, Closure compiler, or TypeScript types (configurable in settings). */
|
|
874
2963
|
"jsdoc/valid-types":
|
|
875
2964
|
| []
|
|
876
2965
|
| [
|
|
877
2966
|
{
|
|
2967
|
+
/**
|
|
2968
|
+
* Set to `false` to bulk disallow
|
|
2969
|
+
* empty name paths with namepath groups 2 and 4 (these might often be
|
|
2970
|
+
* expected to have an accompanying name path, though they have some
|
|
2971
|
+
* indicative value without one; these may also allow names to be defined
|
|
2972
|
+
* in another manner elsewhere in the block); you can use
|
|
2973
|
+
* `settings.jsdoc.structuredTags` with the `required` key set to "name" if you
|
|
2974
|
+
* wish to require name paths on a tag-by-tag basis. Defaults to `true`.
|
|
2975
|
+
*/
|
|
878
2976
|
allowEmptyNamepaths?: boolean;
|
|
879
2977
|
}
|
|
880
2978
|
];
|