eslint-plugin-jsdoc 46.4.5 → 46.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -0
- package/dist/alignTransform.js +5 -5
- package/dist/alignTransform.js.map +1 -1
- package/dist/index.js +21 -10
- package/dist/index.js.map +1 -1
- package/dist/iterateJsdoc.js +1 -1
- package/dist/iterateJsdoc.js.map +1 -1
- package/dist/rules/checkExamples.js +12 -6
- package/dist/rules/checkExamples.js.map +1 -1
- package/package.json +19 -15
- package/docs/advanced.md +0 -102
- package/docs/rules/check-access.md +0 -193
- package/docs/rules/check-alignment.md +0 -169
- package/docs/rules/check-examples.md +0 -784
- package/docs/rules/check-indentation.md +0 -296
- package/docs/rules/check-line-alignment.md +0 -1002
- package/docs/rules/check-param-names.md +0 -1035
- package/docs/rules/check-property-names.md +0 -244
- package/docs/rules/check-syntax.md +0 -80
- package/docs/rules/check-tag-names.md +0 -1132
- package/docs/rules/check-types.md +0 -1198
- package/docs/rules/check-values.md +0 -409
- package/docs/rules/empty-tags.md +0 -220
- package/docs/rules/implements-on-classes.md +0 -219
- package/docs/rules/imports-as-dependencies.md +0 -99
- package/docs/rules/informative-docs.md +0 -400
- package/docs/rules/match-description.md +0 -1008
- package/docs/rules/match-name.md +0 -249
- package/docs/rules/multiline-blocks.md +0 -398
- package/docs/rules/no-bad-blocks.md +0 -174
- package/docs/rules/no-blank-block-descriptions.md +0 -91
- package/docs/rules/no-blank-blocks.md +0 -98
- package/docs/rules/no-defaults.md +0 -207
- package/docs/rules/no-missing-syntax.md +0 -275
- package/docs/rules/no-multi-asterisks.md +0 -278
- package/docs/rules/no-restricted-syntax.md +0 -383
- package/docs/rules/no-types.md +0 -168
- package/docs/rules/no-undefined-types.md +0 -789
- package/docs/rules/require-asterisk-prefix.md +0 -297
- package/docs/rules/require-description-complete-sentence.md +0 -820
- package/docs/rules/require-description.md +0 -585
- package/docs/rules/require-example.md +0 -390
- package/docs/rules/require-file-overview.md +0 -324
- package/docs/rules/require-hyphen-before-param-description.md +0 -281
- package/docs/rules/require-jsdoc.md +0 -1857
- package/docs/rules/require-param-description.md +0 -238
- package/docs/rules/require-param-name.md +0 -163
- package/docs/rules/require-param-type.md +0 -227
- package/docs/rules/require-param.md +0 -1820
- package/docs/rules/require-property-description.md +0 -88
- package/docs/rules/require-property-name.md +0 -79
- package/docs/rules/require-property-type.md +0 -79
- package/docs/rules/require-property.md +0 -128
- package/docs/rules/require-returns-check.md +0 -1053
- package/docs/rules/require-returns-description.md +0 -181
- package/docs/rules/require-returns-type.md +0 -144
- package/docs/rules/require-returns.md +0 -1191
- package/docs/rules/require-throws.md +0 -326
- package/docs/rules/require-yields-check.md +0 -544
- package/docs/rules/require-yields.md +0 -823
- package/docs/rules/sort-tags.md +0 -635
- package/docs/rules/tag-lines.md +0 -551
- package/docs/rules/text-escaping.md +0 -177
- package/docs/rules/valid-types.md +0 -881
- package/docs/settings.md +0 -362
- package/tsconfig.json +0 -22
|
@@ -1,390 +0,0 @@
|
|
|
1
|
-
<a name="user-content-require-example"></a>
|
|
2
|
-
<a name="require-example"></a>
|
|
3
|
-
# <code>require-example</code>
|
|
4
|
-
|
|
5
|
-
* [Fixer](#user-content-require-example-fixer)
|
|
6
|
-
* [Options](#user-content-require-example-options)
|
|
7
|
-
* [`exemptedBy`](#user-content-require-example-options-exemptedby)
|
|
8
|
-
* [`exemptNoArguments`](#user-content-require-example-options-exemptnoarguments)
|
|
9
|
-
* [`contexts`](#user-content-require-example-options-contexts)
|
|
10
|
-
* [`checkConstructors`](#user-content-require-example-options-checkconstructors)
|
|
11
|
-
* [`checkGetters`](#user-content-require-example-options-checkgetters)
|
|
12
|
-
* [`checkSetters`](#user-content-require-example-options-checksetters)
|
|
13
|
-
* [`enableFixer`](#user-content-require-example-options-enablefixer)
|
|
14
|
-
* [Context and settings](#user-content-require-example-context-and-settings)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
Requires that all functions have examples.
|
|
18
|
-
|
|
19
|
-
* All functions must have one or more `@example` tags.
|
|
20
|
-
* Every example tag must have a non-empty description that explains the
|
|
21
|
-
method's usage.
|
|
22
|
-
|
|
23
|
-
<a name="user-content-require-example-fixer"></a>
|
|
24
|
-
<a name="require-example-fixer"></a>
|
|
25
|
-
## Fixer
|
|
26
|
-
|
|
27
|
-
The fixer for `require-example` will add an empty `@example`, but it will still
|
|
28
|
-
report a missing example description after this is added.
|
|
29
|
-
|
|
30
|
-
<a name="user-content-require-example-options"></a>
|
|
31
|
-
<a name="require-example-options"></a>
|
|
32
|
-
## Options
|
|
33
|
-
|
|
34
|
-
This rule has an object option.
|
|
35
|
-
|
|
36
|
-
<a name="user-content-require-example-options-exemptedby"></a>
|
|
37
|
-
<a name="require-example-options-exemptedby"></a>
|
|
38
|
-
### <code>exemptedBy</code>
|
|
39
|
-
|
|
40
|
-
Array of tags (e.g., `['type']`) whose presence on the document
|
|
41
|
-
block avoids the need for an `@example`. Defaults to an array with
|
|
42
|
-
`inheritdoc`. If you set this array, it will overwrite the default,
|
|
43
|
-
so be sure to add back `inheritdoc` if you wish its presence to cause
|
|
44
|
-
exemption of the rule.
|
|
45
|
-
|
|
46
|
-
<a name="user-content-require-example-options-exemptnoarguments"></a>
|
|
47
|
-
<a name="require-example-options-exemptnoarguments"></a>
|
|
48
|
-
### <code>exemptNoArguments</code>
|
|
49
|
-
|
|
50
|
-
Boolean to indicate that no-argument functions should not be reported for
|
|
51
|
-
missing `@example` declarations.
|
|
52
|
-
|
|
53
|
-
<a name="user-content-require-example-options-contexts"></a>
|
|
54
|
-
<a name="require-example-options-contexts"></a>
|
|
55
|
-
### <code>contexts</code>
|
|
56
|
-
|
|
57
|
-
Set this to an array of strings representing the AST context (or an object with
|
|
58
|
-
`context` and `comment` properties) where you wish the rule to be applied.
|
|
59
|
-
(e.g., `ClassDeclaration` for ES6
|
|
60
|
-
classes). Overrides the default contexts (see below). Set to `"any"` if you
|
|
61
|
-
want the rule to apply to any jsdoc block throughout your files.
|
|
62
|
-
|
|
63
|
-
See the ["AST and Selectors"](#user-content-eslint-plugin-jsdoc-advanced-ast-and-selectors)
|
|
64
|
-
section of our README for more on the expected format.
|
|
65
|
-
|
|
66
|
-
<a name="user-content-require-example-options-checkconstructors"></a>
|
|
67
|
-
<a name="require-example-options-checkconstructors"></a>
|
|
68
|
-
### <code>checkConstructors</code>
|
|
69
|
-
|
|
70
|
-
A value indicating whether `constructor`s should be checked.
|
|
71
|
-
Defaults to `true`.
|
|
72
|
-
|
|
73
|
-
<a name="user-content-require-example-options-checkgetters"></a>
|
|
74
|
-
<a name="require-example-options-checkgetters"></a>
|
|
75
|
-
### <code>checkGetters</code>
|
|
76
|
-
|
|
77
|
-
A value indicating whether getters should be checked. Defaults to `false`.
|
|
78
|
-
|
|
79
|
-
<a name="user-content-require-example-options-checksetters"></a>
|
|
80
|
-
<a name="require-example-options-checksetters"></a>
|
|
81
|
-
### <code>checkSetters</code>
|
|
82
|
-
|
|
83
|
-
A value indicating whether setters should be checked. Defaults to `false`.
|
|
84
|
-
|
|
85
|
-
<a name="user-content-require-example-options-enablefixer"></a>
|
|
86
|
-
<a name="require-example-options-enablefixer"></a>
|
|
87
|
-
### <code>enableFixer</code>
|
|
88
|
-
|
|
89
|
-
A boolean on whether to enable the fixer (which adds an empty `@example` block).
|
|
90
|
-
Defaults to `true`.
|
|
91
|
-
|
|
92
|
-
<a name="user-content-require-example-context-and-settings"></a>
|
|
93
|
-
<a name="require-example-context-and-settings"></a>
|
|
94
|
-
## Context and settings
|
|
95
|
-
|
|
96
|
-
|||
|
|
97
|
-
|---|---|
|
|
98
|
-
|Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled|
|
|
99
|
-
|Tags|`example`|
|
|
100
|
-
|Recommended|false|
|
|
101
|
-
|Options|`checkConstructors`, `checkGetters`, `checkSetters`, `contexts`, `enableFixer`, `exemptedBy`, `exemptNoArguments`|
|
|
102
|
-
|Settings|`ignoreReplacesDocs`, `overrideReplacesDocs`, `augmentsExtendsReplacesDocs`, `implementsReplacesDocs`|
|
|
103
|
-
|
|
104
|
-
<a name="user-content-failing-examples"></a>
|
|
105
|
-
<a name="failing-examples"></a>
|
|
106
|
-
# Failing examples
|
|
107
|
-
|
|
108
|
-
The following patterns are considered problems:
|
|
109
|
-
|
|
110
|
-
````js
|
|
111
|
-
/**
|
|
112
|
-
*
|
|
113
|
-
*/
|
|
114
|
-
function quux () {
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
// Message: Missing JSDoc @example declaration.
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
*
|
|
121
|
-
*/
|
|
122
|
-
function quux (someParam) {
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
// "jsdoc/require-example": ["error"|"warn", {"exemptNoArguments":true}]
|
|
126
|
-
// Message: Missing JSDoc @example declaration.
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
*
|
|
130
|
-
*/
|
|
131
|
-
function quux () {
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
// Message: Missing JSDoc @example declaration.
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* @example
|
|
138
|
-
*/
|
|
139
|
-
function quux () {
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
// Message: Missing JSDoc @example description.
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* @constructor
|
|
146
|
-
*/
|
|
147
|
-
function quux () {
|
|
148
|
-
|
|
149
|
-
}
|
|
150
|
-
// Message: Missing JSDoc @example declaration.
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* @constructor
|
|
154
|
-
* @example
|
|
155
|
-
*/
|
|
156
|
-
function quux () {
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
// Message: Missing JSDoc @example description.
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
*
|
|
163
|
-
*/
|
|
164
|
-
class quux {
|
|
165
|
-
|
|
166
|
-
}
|
|
167
|
-
// "jsdoc/require-example": ["error"|"warn", {"contexts":["ClassDeclaration"]}]
|
|
168
|
-
// Message: Missing JSDoc @example declaration.
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
*
|
|
172
|
-
*/
|
|
173
|
-
// "jsdoc/require-example": ["error"|"warn", {"contexts":["any"]}]
|
|
174
|
-
// Message: Missing JSDoc @example declaration.
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
*
|
|
178
|
-
*/
|
|
179
|
-
function quux () {
|
|
180
|
-
}
|
|
181
|
-
// "jsdoc/require-example": ["error"|"warn", {"exemptedBy":["notPresent"]}]
|
|
182
|
-
// Message: Missing JSDoc @example declaration.
|
|
183
|
-
|
|
184
|
-
class TestClass {
|
|
185
|
-
/**
|
|
186
|
-
*
|
|
187
|
-
*/
|
|
188
|
-
get Test() { }
|
|
189
|
-
}
|
|
190
|
-
// "jsdoc/require-example": ["error"|"warn", {"checkGetters":true}]
|
|
191
|
-
// Message: Missing JSDoc @example declaration.
|
|
192
|
-
|
|
193
|
-
class TestClass {
|
|
194
|
-
/**
|
|
195
|
-
* @example
|
|
196
|
-
*/
|
|
197
|
-
get Test() { }
|
|
198
|
-
}
|
|
199
|
-
// "jsdoc/require-example": ["error"|"warn", {"checkGetters":true}]
|
|
200
|
-
// Message: Missing JSDoc @example description.
|
|
201
|
-
|
|
202
|
-
class TestClass {
|
|
203
|
-
/**
|
|
204
|
-
*
|
|
205
|
-
*/
|
|
206
|
-
set Test(value) { }
|
|
207
|
-
}
|
|
208
|
-
// "jsdoc/require-example": ["error"|"warn", {"checkSetters":true}]
|
|
209
|
-
// Message: Missing JSDoc @example declaration.
|
|
210
|
-
|
|
211
|
-
class TestClass {
|
|
212
|
-
/**
|
|
213
|
-
* @example
|
|
214
|
-
*/
|
|
215
|
-
set Test(value) { }
|
|
216
|
-
}
|
|
217
|
-
// "jsdoc/require-example": ["error"|"warn", {"checkSetters":true}]
|
|
218
|
-
// Message: Missing JSDoc @example description.
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
*
|
|
222
|
-
*/
|
|
223
|
-
function quux (someParam) {
|
|
224
|
-
|
|
225
|
-
}
|
|
226
|
-
// "jsdoc/require-example": ["error"|"warn", {"enableFixer":true}]
|
|
227
|
-
// Message: Missing JSDoc @example declaration.
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
*
|
|
231
|
-
*/
|
|
232
|
-
function quux (someParam) {
|
|
233
|
-
|
|
234
|
-
}
|
|
235
|
-
// "jsdoc/require-example": ["error"|"warn", {"enableFixer":false}]
|
|
236
|
-
// Message: Missing JSDoc @example declaration.
|
|
237
|
-
````
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
<a name="user-content-failing-examples-passing-examples"></a>
|
|
242
|
-
<a name="failing-examples-passing-examples"></a>
|
|
243
|
-
## Passing examples
|
|
244
|
-
|
|
245
|
-
The following patterns are not considered problems:
|
|
246
|
-
|
|
247
|
-
````js
|
|
248
|
-
/**
|
|
249
|
-
*
|
|
250
|
-
*/
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* @example
|
|
254
|
-
* // arbitrary example content
|
|
255
|
-
*/
|
|
256
|
-
function quux () {
|
|
257
|
-
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
* @example
|
|
262
|
-
* quux(); // does something useful
|
|
263
|
-
*/
|
|
264
|
-
function quux () {
|
|
265
|
-
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* @example <caption>Valid usage</caption>
|
|
270
|
-
* quux(); // does something useful
|
|
271
|
-
*
|
|
272
|
-
* @example <caption>Invalid usage</caption>
|
|
273
|
-
* quux('random unwanted arg'); // results in an error
|
|
274
|
-
*/
|
|
275
|
-
function quux () {
|
|
276
|
-
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* @constructor
|
|
281
|
-
*/
|
|
282
|
-
function quux () {
|
|
283
|
-
|
|
284
|
-
}
|
|
285
|
-
// "jsdoc/require-example": ["error"|"warn", {"checkConstructors":false}]
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* @constructor
|
|
289
|
-
* @example
|
|
290
|
-
*/
|
|
291
|
-
function quux () {
|
|
292
|
-
|
|
293
|
-
}
|
|
294
|
-
// "jsdoc/require-example": ["error"|"warn", {"checkConstructors":false}]
|
|
295
|
-
|
|
296
|
-
class Foo {
|
|
297
|
-
/**
|
|
298
|
-
*
|
|
299
|
-
*/
|
|
300
|
-
constructor () {
|
|
301
|
-
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
// "jsdoc/require-example": ["error"|"warn", {"checkConstructors":false}]
|
|
305
|
-
|
|
306
|
-
/**
|
|
307
|
-
* @inheritdoc
|
|
308
|
-
*/
|
|
309
|
-
function quux () {
|
|
310
|
-
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
/**
|
|
314
|
-
* @type {MyCallback}
|
|
315
|
-
*/
|
|
316
|
-
function quux () {
|
|
317
|
-
|
|
318
|
-
}
|
|
319
|
-
// "jsdoc/require-example": ["error"|"warn", {"exemptedBy":["type"]}]
|
|
320
|
-
|
|
321
|
-
/**
|
|
322
|
-
* @example Some example code
|
|
323
|
-
*/
|
|
324
|
-
class quux {
|
|
325
|
-
|
|
326
|
-
}
|
|
327
|
-
// "jsdoc/require-example": ["error"|"warn", {"contexts":["ClassDeclaration"]}]
|
|
328
|
-
|
|
329
|
-
/**
|
|
330
|
-
*
|
|
331
|
-
*/
|
|
332
|
-
function quux () {
|
|
333
|
-
|
|
334
|
-
}
|
|
335
|
-
// "jsdoc/require-example": ["error"|"warn", {"contexts":["ClassDeclaration"]}]
|
|
336
|
-
|
|
337
|
-
class TestClass {
|
|
338
|
-
/**
|
|
339
|
-
*
|
|
340
|
-
*/
|
|
341
|
-
get Test() { }
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
class TestClass {
|
|
345
|
-
/**
|
|
346
|
-
* @example
|
|
347
|
-
*/
|
|
348
|
-
get Test() { }
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
class TestClass {
|
|
352
|
-
/**
|
|
353
|
-
* @example Test
|
|
354
|
-
*/
|
|
355
|
-
get Test() { }
|
|
356
|
-
}
|
|
357
|
-
// "jsdoc/require-example": ["error"|"warn", {"checkGetters":true}]
|
|
358
|
-
|
|
359
|
-
class TestClass {
|
|
360
|
-
/**
|
|
361
|
-
*
|
|
362
|
-
*/
|
|
363
|
-
set Test(value) { }
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
class TestClass {
|
|
367
|
-
/**
|
|
368
|
-
* @example
|
|
369
|
-
*/
|
|
370
|
-
set Test(value) { }
|
|
371
|
-
}
|
|
372
|
-
// "jsdoc/require-example": ["error"|"warn", {"checkSetters":false}]
|
|
373
|
-
|
|
374
|
-
class TestClass {
|
|
375
|
-
/**
|
|
376
|
-
* @example Test
|
|
377
|
-
*/
|
|
378
|
-
set Test(value) { }
|
|
379
|
-
}
|
|
380
|
-
// "jsdoc/require-example": ["error"|"warn", {"checkSetters":true}]
|
|
381
|
-
|
|
382
|
-
/**
|
|
383
|
-
*
|
|
384
|
-
*/
|
|
385
|
-
function quux () {
|
|
386
|
-
|
|
387
|
-
}
|
|
388
|
-
// "jsdoc/require-example": ["error"|"warn", {"exemptNoArguments":true}]
|
|
389
|
-
````
|
|
390
|
-
|
|
@@ -1,324 +0,0 @@
|
|
|
1
|
-
<a name="user-content-require-file-overview"></a>
|
|
2
|
-
<a name="require-file-overview"></a>
|
|
3
|
-
# <code>require-file-overview</code>
|
|
4
|
-
|
|
5
|
-
* [Options](#user-content-require-file-overview-options)
|
|
6
|
-
* [`tags`](#user-content-require-file-overview-options-tags)
|
|
7
|
-
* [Context and settings](#user-content-require-file-overview-context-and-settings)
|
|
8
|
-
* [Failing examples](#user-content-require-file-overview-failing-examples)
|
|
9
|
-
* [Passing examples](#user-content-require-file-overview-passing-examples)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
Checks that:
|
|
13
|
-
|
|
14
|
-
1. All files have a `@file`, `@fileoverview`, or `@overview` tag.
|
|
15
|
-
2. Duplicate file overview tags within a given file will be reported
|
|
16
|
-
3. File overview tags will be reported which are not, as per
|
|
17
|
-
[the docs](https://jsdoc.app/tags-file.html), "at the beginning of
|
|
18
|
-
the file"–where beginning of the file is interpreted in this rule
|
|
19
|
-
as being when the overview tag is not preceded by anything other than
|
|
20
|
-
a comment.
|
|
21
|
-
|
|
22
|
-
<a name="user-content-require-file-overview-options"></a>
|
|
23
|
-
<a name="require-file-overview-options"></a>
|
|
24
|
-
## Options
|
|
25
|
-
|
|
26
|
-
<a name="user-content-require-file-overview-options-tags"></a>
|
|
27
|
-
<a name="require-file-overview-options-tags"></a>
|
|
28
|
-
### <code>tags</code>
|
|
29
|
-
|
|
30
|
-
The keys of this object are tag names, and the values are configuration
|
|
31
|
-
objects indicating what will be checked for these whole-file tags.
|
|
32
|
-
|
|
33
|
-
Each configuration object has the following boolean keys (which default
|
|
34
|
-
to `false` when this option is supplied): `mustExist`, `preventDuplicates`,
|
|
35
|
-
`initialCommentsOnly`. These correspond to the three items above.
|
|
36
|
-
|
|
37
|
-
When no `tags` is present, the default is:
|
|
38
|
-
|
|
39
|
-
```json
|
|
40
|
-
{
|
|
41
|
-
"file": {
|
|
42
|
-
"initialCommentsOnly": true,
|
|
43
|
-
"mustExist": true,
|
|
44
|
-
"preventDuplicates": true,
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
You can add additional tag names and/or override `file` if you supply this
|
|
50
|
-
option, e.g., in place of or in addition to `file`, giving other potential
|
|
51
|
-
file global tags like `@license`, `@copyright`, `@author`, `@module` or
|
|
52
|
-
`@exports`, optionally restricting them to a single use or preventing them
|
|
53
|
-
from being preceded by anything besides comments.
|
|
54
|
-
|
|
55
|
-
For example:
|
|
56
|
-
|
|
57
|
-
```js
|
|
58
|
-
{
|
|
59
|
-
"license": {
|
|
60
|
-
"mustExist": true,
|
|
61
|
-
"preventDuplicates": true,
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
This would require one and only one `@license` in the file, though because
|
|
67
|
-
`initialCommentsOnly` is absent and defaults to `false`, the `@license`
|
|
68
|
-
can be anywhere.
|
|
69
|
-
|
|
70
|
-
In the case of `@license`, you can use this rule along with the
|
|
71
|
-
`check-values` rule (with its `allowedLicenses` or `licensePattern` options),
|
|
72
|
-
to enforce a license whitelist be present on every JS file.
|
|
73
|
-
|
|
74
|
-
Note that if you choose to use `preventDuplicates` with `license`, you still
|
|
75
|
-
have a way to allow multiple licenses for the whole page by using the SPDX
|
|
76
|
-
"AND" expression, e.g., `@license (MIT AND GPL-3.0)`.
|
|
77
|
-
|
|
78
|
-
Note that the tag names are the main jsdoc tag name, so you should use `file`
|
|
79
|
-
in this configuration object regardless of whether you have configured
|
|
80
|
-
`fileoverview` instead of `file` on `tagNamePreference` (i.e., `fileoverview`
|
|
81
|
-
will be checked, but you must use `file` on the configuration object).
|
|
82
|
-
|
|
83
|
-
<a name="user-content-require-file-overview-context-and-settings"></a>
|
|
84
|
-
<a name="require-file-overview-context-and-settings"></a>
|
|
85
|
-
## Context and settings
|
|
86
|
-
|
|
87
|
-
|||
|
|
88
|
-
|---|---|
|
|
89
|
-
|Context|Everywhere|
|
|
90
|
-
|Tags|`file`; others when `tags` set|
|
|
91
|
-
|Aliases|`fileoverview`, `overview`|
|
|
92
|
-
|Recommended|false|
|
|
93
|
-
|Options|`tags`|
|
|
94
|
-
|
|
95
|
-
<a name="user-content-require-file-overview-failing-examples"></a>
|
|
96
|
-
<a name="require-file-overview-failing-examples"></a>
|
|
97
|
-
## Failing examples
|
|
98
|
-
|
|
99
|
-
The following patterns are considered problems:
|
|
100
|
-
|
|
101
|
-
````js
|
|
102
|
-
|
|
103
|
-
// Message: Missing @file
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
// "jsdoc/require-file-overview": ["error"|"warn", {"tags":{"file":{"initialCommentsOnly":true,"mustExist":true,"preventDuplicates":true}}}]
|
|
107
|
-
// Message: Missing @file
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
// "jsdoc/require-file-overview": ["error"|"warn", {"tags":{"file":{"mustExist":true}}}]
|
|
111
|
-
// Message: Missing @file
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
// "jsdoc/require-file-overview": ["error"|"warn", {"tags":{"author":{"initialCommentsOnly":false,"mustExist":true,"preventDuplicates":false}}}]
|
|
115
|
-
// Message: Missing @author
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
*
|
|
119
|
-
*/
|
|
120
|
-
// Message: Missing @file
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
*
|
|
124
|
-
*/
|
|
125
|
-
function quux () {}
|
|
126
|
-
// Message: Missing @file
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
*
|
|
130
|
-
*/
|
|
131
|
-
function quux () {}
|
|
132
|
-
// Settings: {"jsdoc":{"tagNamePreference":{"file":"fileoverview"}}}
|
|
133
|
-
// Message: Missing @fileoverview
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
*
|
|
137
|
-
*/
|
|
138
|
-
function quux () {}
|
|
139
|
-
// Settings: {"jsdoc":{"tagNamePreference":{"file":"overview"}}}
|
|
140
|
-
// Message: Missing @overview
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
*
|
|
144
|
-
*/
|
|
145
|
-
function quux () {}
|
|
146
|
-
// Settings: {"jsdoc":{"tagNamePreference":{"file":false}}}
|
|
147
|
-
// Message: `settings.jsdoc.tagNamePreference` cannot block @file for the `require-file-overview` rule
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
*
|
|
151
|
-
*/
|
|
152
|
-
function quux () {}
|
|
153
|
-
// Settings: {"jsdoc":{"tagNamePreference":{"file":false}}}
|
|
154
|
-
// "jsdoc/require-file-overview": ["error"|"warn", {"tags":{"file":{"initialCommentsOnly":false,"mustExist":true,"preventDuplicates":false}}}]
|
|
155
|
-
// Message: `settings.jsdoc.tagNamePreference` cannot block @file for the `require-file-overview` rule
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
*
|
|
159
|
-
*/
|
|
160
|
-
function quux () {}
|
|
161
|
-
// Settings: {"jsdoc":{"tagNamePreference":{"file":{"message":"Don't use file"}}}}
|
|
162
|
-
// Message: `settings.jsdoc.tagNamePreference` cannot block @file for the `require-file-overview` rule
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* @param a
|
|
166
|
-
*/
|
|
167
|
-
function quux (a) {}
|
|
168
|
-
// Message: Missing @file
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* @param a
|
|
172
|
-
*/
|
|
173
|
-
function quux (a) {}
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* @param b
|
|
177
|
-
*/
|
|
178
|
-
function bar (b) {}
|
|
179
|
-
// Message: Missing @file
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* @file
|
|
183
|
-
*/
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* @file
|
|
187
|
-
*/
|
|
188
|
-
// Message: Duplicate @file
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* @copyright
|
|
192
|
-
*/
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* @copyright
|
|
196
|
-
*/
|
|
197
|
-
// "jsdoc/require-file-overview": ["error"|"warn", {"tags":{"copyright":{"initialCommentsOnly":false,"mustExist":false,"preventDuplicates":true}}}]
|
|
198
|
-
// Message: Duplicate @copyright
|
|
199
|
-
|
|
200
|
-
function quux () {
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* @file
|
|
204
|
-
*/
|
|
205
|
-
// Message: @file should be at the beginning of the file
|
|
206
|
-
|
|
207
|
-
function quux () {
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* @license
|
|
211
|
-
*/
|
|
212
|
-
// "jsdoc/require-file-overview": ["error"|"warn", {"tags":{"license":{"initialCommentsOnly":true,"mustExist":false,"preventDuplicates":false}}}]
|
|
213
|
-
// Message: @license should be at the beginning of the file
|
|
214
|
-
|
|
215
|
-
function quux () {
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* @license
|
|
219
|
-
*/
|
|
220
|
-
// "jsdoc/require-file-overview": ["error"|"warn", {"tags":{"license":{"initialCommentsOnly":true}}}]
|
|
221
|
-
// Message: @license should be at the beginning of the file
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* @file
|
|
225
|
-
*/
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* @file
|
|
229
|
-
*/
|
|
230
|
-
// "jsdoc/require-file-overview": ["error"|"warn", {"tags":{"file":{"initialCommentsOnly":true,"preventDuplicates":true}}}]
|
|
231
|
-
// Message: Duplicate @file
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
*
|
|
235
|
-
*/
|
|
236
|
-
function quux () {}
|
|
237
|
-
// Settings: {"jsdoc":{"tagNamePreference":{"file":{"replacement":"fileoverview"}}}}
|
|
238
|
-
// Message: Missing @fileoverview
|
|
239
|
-
````
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
<a name="user-content-require-file-overview-passing-examples"></a>
|
|
244
|
-
<a name="require-file-overview-passing-examples"></a>
|
|
245
|
-
## Passing examples
|
|
246
|
-
|
|
247
|
-
The following patterns are not considered problems:
|
|
248
|
-
|
|
249
|
-
````js
|
|
250
|
-
/**
|
|
251
|
-
* @file
|
|
252
|
-
*/
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* @file
|
|
256
|
-
*/
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* @file
|
|
260
|
-
*/
|
|
261
|
-
// "jsdoc/require-file-overview": ["error"|"warn", {"tags":{"license":{"initialCommentsOnly":true,"preventDuplicates":true}}}]
|
|
262
|
-
|
|
263
|
-
// Ok preceded by comment
|
|
264
|
-
/**
|
|
265
|
-
* @file
|
|
266
|
-
*/
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* @fileoverview
|
|
270
|
-
*/
|
|
271
|
-
// Settings: {"jsdoc":{"tagNamePreference":{"file":"fileoverview"}}}
|
|
272
|
-
|
|
273
|
-
/**
|
|
274
|
-
* @overview
|
|
275
|
-
*/
|
|
276
|
-
// Settings: {"jsdoc":{"tagNamePreference":{"file":"overview"}}}
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* @file Description of file
|
|
280
|
-
*/
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* @file Description of file
|
|
284
|
-
*/
|
|
285
|
-
function quux () {
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
/**
|
|
289
|
-
*
|
|
290
|
-
*/
|
|
291
|
-
|
|
292
|
-
function quux () {
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
*
|
|
296
|
-
*/
|
|
297
|
-
// "jsdoc/require-file-overview": ["error"|"warn", {"tags":{"license":{"initialCommentsOnly":true,"mustExist":false,"preventDuplicates":false}}}]
|
|
298
|
-
|
|
299
|
-
function quux () {
|
|
300
|
-
}
|
|
301
|
-
/**
|
|
302
|
-
*
|
|
303
|
-
*/
|
|
304
|
-
// "jsdoc/require-file-overview": ["error"|"warn", {"tags":{"license":{"initialCommentsOnly":false,"mustExist":false,"preventDuplicates":false}}}]
|
|
305
|
-
|
|
306
|
-
function quux () {
|
|
307
|
-
}
|
|
308
|
-
/**
|
|
309
|
-
*
|
|
310
|
-
*/
|
|
311
|
-
// "jsdoc/require-file-overview": ["error"|"warn", {"tags":{"license":{"initialCommentsOnly":false,"mustExist":false,"preventDuplicates":true}}}]
|
|
312
|
-
|
|
313
|
-
/**
|
|
314
|
-
* @license MIT
|
|
315
|
-
*/
|
|
316
|
-
|
|
317
|
-
var a
|
|
318
|
-
|
|
319
|
-
/**
|
|
320
|
-
* @type {Array}
|
|
321
|
-
*/
|
|
322
|
-
// "jsdoc/require-file-overview": ["error"|"warn", {"tags":{"license":{"initialCommentsOnly":true,"mustExist":false,"preventDuplicates":false}}}]
|
|
323
|
-
````
|
|
324
|
-
|