eslint-plugin-jsdoc 3.14.1 → 4.0.1
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 +624 -255
- package/dist/bin/readme-assertions.js +1 -1
- package/dist/bin/readme-assertions.js.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/iterateJsdoc.js +4 -0
- package/dist/iterateJsdoc.js.map +1 -1
- package/dist/rules/requireReturns.js +33 -0
- package/dist/rules/requireReturns.js.map +1 -0
- package/dist/rules/requireReturnsCheck.js +36 -0
- package/dist/rules/requireReturnsCheck.js.map +1 -0
- package/dist/tagNames.js +1 -0
- package/dist/tagNames.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,16 +23,17 @@ JSDoc linting rules for ESLint.
|
|
|
23
23
|
* [`check-types`](#eslint-plugin-jsdoc-rules-check-types)
|
|
24
24
|
* [`newline-after-description`](#eslint-plugin-jsdoc-rules-newline-after-description)
|
|
25
25
|
* [`no-undefined-types`](#eslint-plugin-jsdoc-rules-no-undefined-types)
|
|
26
|
-
* [`require-description`](#eslint-plugin-jsdoc-rules-require-description)
|
|
27
26
|
* [`require-description-complete-sentence`](#eslint-plugin-jsdoc-rules-require-description-complete-sentence)
|
|
27
|
+
* [`require-description`](#eslint-plugin-jsdoc-rules-require-description)
|
|
28
28
|
* [`require-example`](#eslint-plugin-jsdoc-rules-require-example)
|
|
29
29
|
* [`require-hyphen-before-param-description`](#eslint-plugin-jsdoc-rules-require-hyphen-before-param-description)
|
|
30
|
-
* [`require-param`](#eslint-plugin-jsdoc-rules-require-param)
|
|
31
30
|
* [`require-param-description`](#eslint-plugin-jsdoc-rules-require-param-description)
|
|
32
31
|
* [`require-param-name`](#eslint-plugin-jsdoc-rules-require-param-name)
|
|
33
32
|
* [`require-param-type`](#eslint-plugin-jsdoc-rules-require-param-type)
|
|
33
|
+
* [`require-param`](#eslint-plugin-jsdoc-rules-require-param)
|
|
34
34
|
* [`require-returns-description`](#eslint-plugin-jsdoc-rules-require-returns-description)
|
|
35
35
|
* [`require-returns-type`](#eslint-plugin-jsdoc-rules-require-returns-type)
|
|
36
|
+
* [`require-returns`](#eslint-plugin-jsdoc-rules-require-returns)
|
|
36
37
|
* [`valid-types`](#eslint-plugin-jsdoc-rules-valid-types)
|
|
37
38
|
|
|
38
39
|
|
|
@@ -56,6 +57,7 @@ This table maps the rules between `eslint-plugin-jsdoc` and `jscs-jsdoc`.
|
|
|
56
57
|
| [`require-param-description`](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-param-description) | [`requireParamDescription`](https://github.com/jscs-dev/jscs-jsdoc#requireparamdescription) |
|
|
57
58
|
| [`require-param-name`](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-param-name) | N/A |
|
|
58
59
|
| [`require-param-type`](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-param-type) | [`requireParamTypes`](https://github.com/jscs-dev/jscs-jsdoc#requireparamtypes) |
|
|
60
|
+
| [`require-returns`](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-returns) | [`requireReturn`](https://github.com/jscs-dev/jscs-jsdoc#requirereturn) |
|
|
59
61
|
| [`require-returns-description`](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-returns-description) | [`requireReturnDescription`](https://github.com/jscs-dev/jscs-jsdoc#requirereturndescription) |
|
|
60
62
|
| [`require-returns-type`](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-returns-type) | [`requireReturnTypes`](https://github.com/jscs-dev/jscs-jsdoc#requirereturntypes) |
|
|
61
63
|
| [`valid-types`](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-valid-types) | N/A |
|
|
@@ -114,6 +116,7 @@ Finally, enable all of the rules that you would like to use.
|
|
|
114
116
|
"jsdoc/require-param-description": 1,
|
|
115
117
|
"jsdoc/require-param-name": 1,
|
|
116
118
|
"jsdoc/require-param-type": 1,
|
|
119
|
+
"jsdoc/require-returns": 1,
|
|
117
120
|
"jsdoc/require-returns-description": 1,
|
|
118
121
|
"jsdoc/require-returns-type": 1,
|
|
119
122
|
"jsdoc/valid-types": 1
|
|
@@ -194,7 +197,7 @@ The format of the configuration is as follows:
|
|
|
194
197
|
### Settings to Configure <code>check-examples</code>
|
|
195
198
|
|
|
196
199
|
The settings below all impact the `check-examples` rule and default to
|
|
197
|
-
no-op/false except
|
|
200
|
+
no-op/false except as noted.
|
|
198
201
|
|
|
199
202
|
JSDoc specs use of an optional `<caption>` element at the beginning of
|
|
200
203
|
`@example`. The following setting requires its use.
|
|
@@ -228,6 +231,9 @@ applied to the JavaScript found within the `@example` tags (as determined
|
|
|
228
231
|
to be applicable by the above regex settings). They are ordered by
|
|
229
232
|
decreasing precedence:
|
|
230
233
|
|
|
234
|
+
* `settings.jsdoc.allowInlineConfig` - If not set to `false`, will allow
|
|
235
|
+
inline config within the `@example` to override other config. Defaults
|
|
236
|
+
to `true`.
|
|
231
237
|
* `settings.jsdoc.noDefaultExampleRules` - Setting to `true` will disable the
|
|
232
238
|
default rules which are expected to be troublesome for most documentation
|
|
233
239
|
use. See the section below for the specific default rules.
|
|
@@ -240,13 +246,20 @@ decreasing precedence:
|
|
|
240
246
|
[other plugins](https://github.com/eslint/eslint-plugin-markdown), e.g.,
|
|
241
247
|
if one sets `matchingFileName` to `dummy.md` so that `@example` rules will
|
|
242
248
|
follow one's Markdown rules).
|
|
243
|
-
* `settings.jsdoc.configFile` - A config file. Corresponds to `-c`.
|
|
249
|
+
* `settings.jsdoc.configFile` - A config file. Corresponds to ESLint's `-c`.
|
|
244
250
|
* `settings.jsdoc.eslintrcForExamples` - Defaults to `true` in adding rules
|
|
245
251
|
based on an `.eslintrc.*` file. Setting to `false` corresponds to
|
|
246
|
-
`--no-eslintrc`.
|
|
252
|
+
ESLint's `--no-eslintrc`.
|
|
247
253
|
* `settings.jsdoc.baseConfig` - An object of rules with the same schema
|
|
248
254
|
as `.eslintrc.*` for defaults
|
|
249
255
|
|
|
256
|
+
Finally, the following rule pertains to inline disable directives:
|
|
257
|
+
|
|
258
|
+
- `settings.jsdoc.reportUnusedDisableDirectives` - If not set to `false`,
|
|
259
|
+
this will report disabled directives which are not used (and thus not
|
|
260
|
+
needed). Defaults to `true`. Corresponds to ESLint's
|
|
261
|
+
`--report-unused-disable-directives`.
|
|
262
|
+
|
|
250
263
|
<a name="eslint-plugin-jsdoc-settings-settings-to-configure-check-examples-rules-disabled-by-default-unless-nodefaultexamplerules-is-set-to-true"></a>
|
|
251
264
|
#### Rules Disabled by Default Unless <code>noDefaultExampleRules</code> is Set to <code>true</code>
|
|
252
265
|
|
|
@@ -279,11 +292,13 @@ Works in conjunction with the following settings:
|
|
|
279
292
|
* `captionRequired`
|
|
280
293
|
* `exampleCodeRegex`
|
|
281
294
|
* `rejectExampleCodeRegex`
|
|
295
|
+
* `allowInlineConfig` - Defaults to `true`
|
|
282
296
|
* `noDefaultExampleRules`
|
|
283
297
|
* `matchingFileName`
|
|
284
298
|
* `configFile`
|
|
285
299
|
* `eslintrcForExamples` - Defaults to `true`
|
|
286
300
|
* `baseConfig`
|
|
301
|
+
* `reportUnusedDisableDirectives` - Defaults to `true`
|
|
287
302
|
|
|
288
303
|
Inline ESLint config within `@example` JavaScript is allowed, though the
|
|
289
304
|
disabling of ESLint directives which are not needed by the resolved rules
|
|
@@ -297,7 +312,7 @@ command.
|
|
|
297
312
|
|
|
298
313
|
The following patterns are considered problems:
|
|
299
314
|
|
|
300
|
-
|
|
315
|
+
````js
|
|
301
316
|
/**
|
|
302
317
|
* @example alert('hello')
|
|
303
318
|
*/
|
|
@@ -316,7 +331,7 @@ function quux () {
|
|
|
316
331
|
|
|
317
332
|
}
|
|
318
333
|
// Settings: {"jsdoc":{"baseConfig":{"rules":{"semi":["error","never"]}},"eslintrcForExamples":false,"exampleCodeRegex":"```js([\\s\\S]*)```"}}
|
|
319
|
-
// Message:
|
|
334
|
+
// Message: @example error (semi): Extra semicolon.
|
|
320
335
|
|
|
321
336
|
/**
|
|
322
337
|
* @example
|
|
@@ -326,7 +341,7 @@ function quux () {
|
|
|
326
341
|
|
|
327
342
|
}
|
|
328
343
|
// Settings: {"jsdoc":{"baseConfig":{"rules":{"semi":["error","never"]}},"eslintrcForExamples":false,"exampleCodeRegex":"```js ([\\s\\S]*)```"}}
|
|
329
|
-
// Message:
|
|
344
|
+
// Message: @example error (semi): Extra semicolon.
|
|
330
345
|
|
|
331
346
|
/**
|
|
332
347
|
* @example ```
|
|
@@ -336,7 +351,7 @@ function quux () {
|
|
|
336
351
|
|
|
337
352
|
}
|
|
338
353
|
// Settings: {"jsdoc":{"baseConfig":{"rules":{"semi":["error","never"]}},"eslintrcForExamples":false,"exampleCodeRegex":"```\njs ([\\s\\S]*)```"}}
|
|
339
|
-
// Message:
|
|
354
|
+
// Message: @example error (semi): Extra semicolon.
|
|
340
355
|
|
|
341
356
|
/**
|
|
342
357
|
* @example <b>Not JavaScript</b>
|
|
@@ -351,7 +366,7 @@ function quux2 () {
|
|
|
351
366
|
|
|
352
367
|
}
|
|
353
368
|
// Settings: {"jsdoc":{"baseConfig":{"rules":{"semi":["error","never"]}},"eslintrcForExamples":false,"rejectExampleCodeRegex":"^\\s*<.*>$"}}
|
|
354
|
-
// Message:
|
|
369
|
+
// Message: @example error (semi): Extra semicolon.
|
|
355
370
|
|
|
356
371
|
/**
|
|
357
372
|
* @example
|
|
@@ -361,7 +376,7 @@ function quux () {
|
|
|
361
376
|
|
|
362
377
|
}
|
|
363
378
|
// Settings: {"jsdoc":{"baseConfig":{"rules":{"no-undef":["error"]}},"eslintrcForExamples":false,"noDefaultExampleRules":true}}
|
|
364
|
-
// Message:
|
|
379
|
+
// Message: @example error (semi): Extra semicolon.
|
|
365
380
|
|
|
366
381
|
/**
|
|
367
382
|
* @example <caption>Valid usage</caption>
|
|
@@ -374,7 +389,7 @@ function quux () {
|
|
|
374
389
|
|
|
375
390
|
}
|
|
376
391
|
// Settings: {"jsdoc":{"captionRequired":true,"eslintrcForExamples":false}}
|
|
377
|
-
// Message:
|
|
392
|
+
// Message: Caption is expected for examples.
|
|
378
393
|
|
|
379
394
|
/**
|
|
380
395
|
* @example quux();
|
|
@@ -383,12 +398,27 @@ function quux () {
|
|
|
383
398
|
|
|
384
399
|
}
|
|
385
400
|
// Settings: {"jsdoc":{"baseConfig":{"rules":{"indent":["error"]}},"eslintrcForExamples":false,"noDefaultExampleRules":false}}
|
|
386
|
-
// Message:
|
|
387
|
-
|
|
401
|
+
// Message: @example error (indent): Expected indentation of 0 spaces but found 1.
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* @example test() // eslint-disable-line semi
|
|
405
|
+
*/
|
|
406
|
+
function quux () {}
|
|
407
|
+
// Settings: {"jsdoc":{"eslintrcForExamples":false,"noDefaultExampleRules":true,"reportUnusedDisableDirectives":true}}
|
|
408
|
+
// Message: @example error: Unused eslint-disable directive (no problems were reported from 'semi').
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* @example
|
|
412
|
+
test() // eslint-disable-line semi
|
|
413
|
+
*/
|
|
414
|
+
function quux () {}
|
|
415
|
+
// Settings: {"jsdoc":{"allowInlineConfig":false,"baseConfig":{"rules":{"semi":["error","always"]}},"eslintrcForExamples":false,"noDefaultExampleRules":true}}
|
|
416
|
+
// Message: @example error (semi): Missing semicolon.
|
|
417
|
+
````
|
|
388
418
|
|
|
389
419
|
The following patterns are not considered problems:
|
|
390
420
|
|
|
391
|
-
|
|
421
|
+
````js
|
|
392
422
|
/**
|
|
393
423
|
* @example ```js
|
|
394
424
|
alert('hello');
|
|
@@ -436,7 +466,20 @@ function quux () {
|
|
|
436
466
|
|
|
437
467
|
}
|
|
438
468
|
// Settings: {"jsdoc":{"captionRequired":true,"eslintrcForExamples":false}}
|
|
439
|
-
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* @example test() // eslint-disable-line semi
|
|
472
|
+
*/
|
|
473
|
+
function quux () {}
|
|
474
|
+
// Settings: {"jsdoc":{"eslintrcForExamples":false,"noDefaultExampleRules":true,"reportUnusedDisableDirectives":false}}
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* @example
|
|
478
|
+
test() // eslint-disable-line semi
|
|
479
|
+
*/
|
|
480
|
+
function quux () {}
|
|
481
|
+
// Settings: {"jsdoc":{"allowInlineConfig":true,"baseConfig":{"rules":{"semi":["error","always"]}},"eslintrcForExamples":false,"noDefaultExampleRules":true}}
|
|
482
|
+
````
|
|
440
483
|
|
|
441
484
|
|
|
442
485
|
<a name="eslint-plugin-jsdoc-rules-check-param-names"></a>
|
|
@@ -451,7 +494,7 @@ Ensures that parameter names in JSDoc match those in the function declaration.
|
|
|
451
494
|
|
|
452
495
|
The following patterns are considered problems:
|
|
453
496
|
|
|
454
|
-
|
|
497
|
+
````js
|
|
455
498
|
/**
|
|
456
499
|
* @param Foo
|
|
457
500
|
*/
|
|
@@ -512,11 +555,11 @@ function quux (foo) {
|
|
|
512
555
|
|
|
513
556
|
}
|
|
514
557
|
// Message: @param "bar" does not match an existing function parameter.
|
|
515
|
-
|
|
558
|
+
````
|
|
516
559
|
|
|
517
560
|
The following patterns are not considered problems:
|
|
518
561
|
|
|
519
|
-
|
|
562
|
+
````js
|
|
520
563
|
/**
|
|
521
564
|
*
|
|
522
565
|
*/
|
|
@@ -583,7 +626,17 @@ function quux ({a, b} = {}) {
|
|
|
583
626
|
function quux ([a, b] = []) {
|
|
584
627
|
|
|
585
628
|
}
|
|
586
|
-
|
|
629
|
+
|
|
630
|
+
/**
|
|
631
|
+
* Assign the project to a list of employees.
|
|
632
|
+
* @param {Object[]} employees - The employees who are responsible for the project.
|
|
633
|
+
* @param {string} employees[].name - The name of an employee.
|
|
634
|
+
* @param {string} employees[].department - The employee's department.
|
|
635
|
+
*/
|
|
636
|
+
function assign (employees) {
|
|
637
|
+
|
|
638
|
+
};
|
|
639
|
+
````
|
|
587
640
|
|
|
588
641
|
|
|
589
642
|
<a name="eslint-plugin-jsdoc-rules-check-param-names-deconstructing-function-parameter"></a>
|
|
@@ -686,7 +739,7 @@ version
|
|
|
686
739
|
|
|
687
740
|
The following patterns are considered problems:
|
|
688
741
|
|
|
689
|
-
|
|
742
|
+
````js
|
|
690
743
|
/**
|
|
691
744
|
* @Param
|
|
692
745
|
*/
|
|
@@ -746,11 +799,11 @@ function quux (foo) {
|
|
|
746
799
|
}
|
|
747
800
|
// Settings: {"jsdoc":{"additionalTagNames":{"customTags":["bar"]}}}
|
|
748
801
|
// Message: Invalid JSDoc tag name "baz".
|
|
749
|
-
|
|
802
|
+
````
|
|
750
803
|
|
|
751
804
|
The following patterns are not considered problems:
|
|
752
805
|
|
|
753
|
-
|
|
806
|
+
````js
|
|
754
807
|
/**
|
|
755
808
|
* @param foo
|
|
756
809
|
*/
|
|
@@ -782,7 +835,7 @@ function quux (foo) {
|
|
|
782
835
|
}
|
|
783
836
|
// Settings: {"jsdoc":{"additionalTagNames":{"customTags":["baz","bar"]}}}
|
|
784
837
|
|
|
785
|
-
/**
|
|
838
|
+
/**
|
|
786
839
|
* @abstract
|
|
787
840
|
* @access
|
|
788
841
|
* @alias
|
|
@@ -847,7 +900,7 @@ function quux (foo) {
|
|
|
847
900
|
* @version
|
|
848
901
|
*/
|
|
849
902
|
function quux (foo) {}
|
|
850
|
-
|
|
903
|
+
````
|
|
851
904
|
|
|
852
905
|
|
|
853
906
|
<a name="eslint-plugin-jsdoc-rules-check-types"></a>
|
|
@@ -870,9 +923,9 @@ RegExp
|
|
|
870
923
|
<a name="eslint-plugin-jsdoc-rules-check-types-why-not-capital-case-everything"></a>
|
|
871
924
|
#### Why not capital case everything?
|
|
872
925
|
|
|
873
|
-
Why are `boolean`, `number` and `string` exempt from starting with a capital letter? Let's take `string` as an example. In Javascript, everything is an object. The string Object has prototypes for string functions such as `.toUpperCase()`.
|
|
926
|
+
Why are `boolean`, `number` and `string` exempt from starting with a capital letter? Let's take `string` as an example. In Javascript, everything is an object. The string Object has prototypes for string functions such as `.toUpperCase()`.
|
|
874
927
|
|
|
875
|
-
Fortunately we don't have to write `new String()` everywhere in our code. Javascript will automatically wrap string primitives into string Objects when we're applying a string function to a string primitive. This way the memory footprint is a tiny little bit smaller, and the [GC](https://en.wikipedia.org/wiki/Garbage_collection_(computer_science)) has less work to do.
|
|
928
|
+
Fortunately we don't have to write `new String()` everywhere in our code. Javascript will automatically wrap string primitives into string Objects when we're applying a string function to a string primitive. This way the memory footprint is a tiny little bit smaller, and the [GC](https://en.wikipedia.org/wiki/Garbage_collection_(computer_science)) has less work to do.
|
|
876
929
|
|
|
877
930
|
So in a sense, there two types of strings in Javascript; `{string}` literals, also called primitives and `{String}` Objects. We use the primitives because it's easier to write and uses less memory. `{String}` and `{string}` are technically both valid, but they are not the same.
|
|
878
931
|
|
|
@@ -905,7 +958,7 @@ String | **string** | **string** | `("test") instanceof String` -> **`false`**
|
|
|
905
958
|
|
|
906
959
|
The following patterns are considered problems:
|
|
907
960
|
|
|
908
|
-
|
|
961
|
+
````js
|
|
909
962
|
/**
|
|
910
963
|
* @param {Number} foo
|
|
911
964
|
*/
|
|
@@ -937,11 +990,11 @@ function quux (foo, bar, baz) {
|
|
|
937
990
|
|
|
938
991
|
}
|
|
939
992
|
// Message: Invalid JSDoc @param "foo" type "Number".
|
|
940
|
-
|
|
993
|
+
````
|
|
941
994
|
|
|
942
995
|
The following patterns are not considered problems:
|
|
943
996
|
|
|
944
|
-
|
|
997
|
+
````js
|
|
945
998
|
/**
|
|
946
999
|
* @param {number} foo
|
|
947
1000
|
* @param {Bar} bar
|
|
@@ -966,7 +1019,7 @@ function quux (foo, bar, baz) {
|
|
|
966
1019
|
function quux (foo, bar, baz) {
|
|
967
1020
|
|
|
968
1021
|
}
|
|
969
|
-
|
|
1022
|
+
````
|
|
970
1023
|
|
|
971
1024
|
|
|
972
1025
|
<a name="eslint-plugin-jsdoc-rules-newline-after-description"></a>
|
|
@@ -983,7 +1036,7 @@ This rule takes one argument. If it is `"always"` then a problem is raised when
|
|
|
983
1036
|
|
|
984
1037
|
The following patterns are considered problems:
|
|
985
1038
|
|
|
986
|
-
|
|
1039
|
+
````js
|
|
987
1040
|
/**
|
|
988
1041
|
* Foo.
|
|
989
1042
|
*
|
|
@@ -1008,11 +1061,11 @@ function quux () {
|
|
|
1008
1061
|
}
|
|
1009
1062
|
// Options: ["never"]
|
|
1010
1063
|
// Message: There must be no newline after the description of the JSDoc block.
|
|
1011
|
-
|
|
1064
|
+
````
|
|
1012
1065
|
|
|
1013
1066
|
The following patterns are not considered problems:
|
|
1014
1067
|
|
|
1015
|
-
|
|
1068
|
+
````js
|
|
1016
1069
|
/**
|
|
1017
1070
|
* Foo.
|
|
1018
1071
|
*/
|
|
@@ -1047,7 +1100,7 @@ function quux () {
|
|
|
1047
1100
|
|
|
1048
1101
|
}
|
|
1049
1102
|
// Options: ["never"]
|
|
1050
|
-
|
|
1103
|
+
````
|
|
1051
1104
|
|
|
1052
1105
|
|
|
1053
1106
|
<a name="eslint-plugin-jsdoc-rules-no-undefined-types"></a>
|
|
@@ -1065,7 +1118,7 @@ When enabling this rule, types in jsdoc comments will resolve as used variables,
|
|
|
1065
1118
|
|
|
1066
1119
|
The following patterns are considered problems:
|
|
1067
1120
|
|
|
1068
|
-
|
|
1121
|
+
````js
|
|
1069
1122
|
/**
|
|
1070
1123
|
* @param {strnig} foo - Bar.
|
|
1071
1124
|
*/
|
|
@@ -1073,11 +1126,11 @@ function quux(foo) {
|
|
|
1073
1126
|
|
|
1074
1127
|
}
|
|
1075
1128
|
// Message: The type 'strnig' is undefined.
|
|
1076
|
-
|
|
1129
|
+
````
|
|
1077
1130
|
|
|
1078
1131
|
The following patterns are not considered problems:
|
|
1079
1132
|
|
|
1080
|
-
|
|
1133
|
+
````js
|
|
1081
1134
|
/**
|
|
1082
1135
|
* @param {string} foo - Bar.
|
|
1083
1136
|
*/
|
|
@@ -1144,72 +1197,7 @@ function quux(foo) {
|
|
|
1144
1197
|
function quux(foo) {
|
|
1145
1198
|
|
|
1146
1199
|
}
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
<a name="eslint-plugin-jsdoc-rules-require-description"></a>
|
|
1151
|
-
### <code>require-description</code>
|
|
1152
|
-
|
|
1153
|
-
Requires that all functions have a description.
|
|
1154
|
-
|
|
1155
|
-
* All functions must have a `@description` tag.
|
|
1156
|
-
* Every description tag must have a non-empty description that explains the purpose of the method.
|
|
1157
|
-
|
|
1158
|
-
|||
|
|
1159
|
-
|---|---|
|
|
1160
|
-
|Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`|
|
|
1161
|
-
|Tags|`class`, `example`|
|
|
1162
|
-
|
|
1163
|
-
The following patterns are considered problems:
|
|
1164
|
-
|
|
1165
|
-
```js
|
|
1166
|
-
/**
|
|
1167
|
-
*
|
|
1168
|
-
*/
|
|
1169
|
-
function quux () {
|
|
1170
|
-
|
|
1171
|
-
}
|
|
1172
|
-
// Message: Missing JSDoc @description declaration.
|
|
1173
|
-
|
|
1174
|
-
/**
|
|
1175
|
-
* @description
|
|
1176
|
-
*/
|
|
1177
|
-
function quux () {
|
|
1178
|
-
|
|
1179
|
-
}
|
|
1180
|
-
// Message: Missing JSDoc @description description.
|
|
1181
|
-
```
|
|
1182
|
-
|
|
1183
|
-
The following patterns are not considered problems:
|
|
1184
|
-
|
|
1185
|
-
```js
|
|
1186
|
-
/**
|
|
1187
|
-
* @description
|
|
1188
|
-
* // arbitrary description content
|
|
1189
|
-
*/
|
|
1190
|
-
function quux () {
|
|
1191
|
-
|
|
1192
|
-
}
|
|
1193
|
-
|
|
1194
|
-
/**
|
|
1195
|
-
* @description
|
|
1196
|
-
* quux(); // does something useful
|
|
1197
|
-
*/
|
|
1198
|
-
function quux () {
|
|
1199
|
-
|
|
1200
|
-
}
|
|
1201
|
-
|
|
1202
|
-
/**
|
|
1203
|
-
* @description <caption>Valid usage</caption>
|
|
1204
|
-
* quux(); // does something useful
|
|
1205
|
-
*
|
|
1206
|
-
* @description <caption>Invalid usage</caption>
|
|
1207
|
-
* quux('random unwanted arg'); // results in an error
|
|
1208
|
-
*/
|
|
1209
|
-
function quux () {
|
|
1210
|
-
|
|
1211
|
-
}
|
|
1212
|
-
```
|
|
1200
|
+
````
|
|
1213
1201
|
|
|
1214
1202
|
|
|
1215
1203
|
<a name="eslint-plugin-jsdoc-rules-require-description-complete-sentence"></a>
|
|
@@ -1229,7 +1217,7 @@ Requires that block description and tag description are written in complete sent
|
|
|
1229
1217
|
|
|
1230
1218
|
The following patterns are considered problems:
|
|
1231
1219
|
|
|
1232
|
-
|
|
1220
|
+
````js
|
|
1233
1221
|
/**
|
|
1234
1222
|
* foo.
|
|
1235
1223
|
*/
|
|
@@ -1375,11 +1363,11 @@ function quux (foo) {
|
|
|
1375
1363
|
|
|
1376
1364
|
}
|
|
1377
1365
|
// Message: Sentence should start with an uppercase character.
|
|
1378
|
-
|
|
1366
|
+
````
|
|
1379
1367
|
|
|
1380
1368
|
The following patterns are not considered problems:
|
|
1381
1369
|
|
|
1382
|
-
|
|
1370
|
+
````js
|
|
1383
1371
|
/**
|
|
1384
1372
|
* @param foo - Foo.
|
|
1385
1373
|
*/
|
|
@@ -1474,7 +1462,72 @@ function quux () {
|
|
|
1474
1462
|
function quux () {
|
|
1475
1463
|
|
|
1476
1464
|
}
|
|
1477
|
-
|
|
1465
|
+
````
|
|
1466
|
+
|
|
1467
|
+
|
|
1468
|
+
<a name="eslint-plugin-jsdoc-rules-require-description"></a>
|
|
1469
|
+
### <code>require-description</code>
|
|
1470
|
+
|
|
1471
|
+
Requires that all functions have a description.
|
|
1472
|
+
|
|
1473
|
+
* All functions must have a `@description` tag.
|
|
1474
|
+
* Every description tag must have a non-empty description that explains the purpose of the method.
|
|
1475
|
+
|
|
1476
|
+
|||
|
|
1477
|
+
|---|---|
|
|
1478
|
+
|Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`|
|
|
1479
|
+
|Tags|`class`, `example`|
|
|
1480
|
+
|
|
1481
|
+
The following patterns are considered problems:
|
|
1482
|
+
|
|
1483
|
+
````js
|
|
1484
|
+
/**
|
|
1485
|
+
*
|
|
1486
|
+
*/
|
|
1487
|
+
function quux () {
|
|
1488
|
+
|
|
1489
|
+
}
|
|
1490
|
+
// Message: Missing JSDoc @description declaration.
|
|
1491
|
+
|
|
1492
|
+
/**
|
|
1493
|
+
* @description
|
|
1494
|
+
*/
|
|
1495
|
+
function quux () {
|
|
1496
|
+
|
|
1497
|
+
}
|
|
1498
|
+
// Message: Missing JSDoc @description description.
|
|
1499
|
+
````
|
|
1500
|
+
|
|
1501
|
+
The following patterns are not considered problems:
|
|
1502
|
+
|
|
1503
|
+
````js
|
|
1504
|
+
/**
|
|
1505
|
+
* @description
|
|
1506
|
+
* // arbitrary description content
|
|
1507
|
+
*/
|
|
1508
|
+
function quux () {
|
|
1509
|
+
|
|
1510
|
+
}
|
|
1511
|
+
|
|
1512
|
+
/**
|
|
1513
|
+
* @description
|
|
1514
|
+
* quux(); // does something useful
|
|
1515
|
+
*/
|
|
1516
|
+
function quux () {
|
|
1517
|
+
|
|
1518
|
+
}
|
|
1519
|
+
|
|
1520
|
+
/**
|
|
1521
|
+
* @description <caption>Valid usage</caption>
|
|
1522
|
+
* quux(); // does something useful
|
|
1523
|
+
*
|
|
1524
|
+
* @description <caption>Invalid usage</caption>
|
|
1525
|
+
* quux('random unwanted arg'); // results in an error
|
|
1526
|
+
*/
|
|
1527
|
+
function quux () {
|
|
1528
|
+
|
|
1529
|
+
}
|
|
1530
|
+
````
|
|
1478
1531
|
|
|
1479
1532
|
|
|
1480
1533
|
<a name="eslint-plugin-jsdoc-rules-require-example"></a>
|
|
@@ -1492,7 +1545,7 @@ Requires that all functions have examples.
|
|
|
1492
1545
|
|
|
1493
1546
|
The following patterns are considered problems:
|
|
1494
1547
|
|
|
1495
|
-
|
|
1548
|
+
````js
|
|
1496
1549
|
/**
|
|
1497
1550
|
*
|
|
1498
1551
|
*/
|
|
@@ -1508,11 +1561,11 @@ function quux () {
|
|
|
1508
1561
|
|
|
1509
1562
|
}
|
|
1510
1563
|
// Message: Missing JSDoc @example description.
|
|
1511
|
-
|
|
1564
|
+
````
|
|
1512
1565
|
|
|
1513
1566
|
The following patterns are not considered problems:
|
|
1514
1567
|
|
|
1515
|
-
|
|
1568
|
+
````js
|
|
1516
1569
|
/**
|
|
1517
1570
|
* @example
|
|
1518
1571
|
* // arbitrary example content
|
|
@@ -1539,7 +1592,7 @@ function quux () {
|
|
|
1539
1592
|
function quux () {
|
|
1540
1593
|
|
|
1541
1594
|
}
|
|
1542
|
-
|
|
1595
|
+
````
|
|
1543
1596
|
|
|
1544
1597
|
|
|
1545
1598
|
<a name="eslint-plugin-jsdoc-rules-require-hyphen-before-param-description"></a>
|
|
@@ -1554,7 +1607,7 @@ Requires a hyphen before the `@param` description.
|
|
|
1554
1607
|
|
|
1555
1608
|
The following patterns are considered problems:
|
|
1556
1609
|
|
|
1557
|
-
|
|
1610
|
+
````js
|
|
1558
1611
|
/**
|
|
1559
1612
|
* @param foo Foo.
|
|
1560
1613
|
*/
|
|
@@ -1562,24 +1615,24 @@ function quux () {
|
|
|
1562
1615
|
|
|
1563
1616
|
}
|
|
1564
1617
|
// Message: There must be a hyphen before @param description.
|
|
1565
|
-
|
|
1618
|
+
````
|
|
1566
1619
|
|
|
1567
1620
|
The following patterns are not considered problems:
|
|
1568
1621
|
|
|
1569
|
-
|
|
1622
|
+
````js
|
|
1570
1623
|
/**
|
|
1571
1624
|
* @param foo - Foo.
|
|
1572
1625
|
*/
|
|
1573
1626
|
function quux () {
|
|
1574
1627
|
|
|
1575
1628
|
}
|
|
1576
|
-
|
|
1629
|
+
````
|
|
1577
1630
|
|
|
1578
1631
|
|
|
1579
|
-
<a name="eslint-plugin-jsdoc-rules-require-param"></a>
|
|
1580
|
-
### <code>require-param</code>
|
|
1632
|
+
<a name="eslint-plugin-jsdoc-rules-require-param-description"></a>
|
|
1633
|
+
### <code>require-param-description</code>
|
|
1581
1634
|
|
|
1582
|
-
Requires that
|
|
1635
|
+
Requires that `@param` tag has `description` value.
|
|
1583
1636
|
|
|
1584
1637
|
|||
|
|
1585
1638
|
|---|---|
|
|
@@ -1588,81 +1641,234 @@ Requires that all function parameters are documented.
|
|
|
1588
1641
|
|
|
1589
1642
|
The following patterns are considered problems:
|
|
1590
1643
|
|
|
1591
|
-
|
|
1644
|
+
````js
|
|
1592
1645
|
/**
|
|
1593
|
-
*
|
|
1646
|
+
* @param foo
|
|
1594
1647
|
*/
|
|
1595
1648
|
function quux (foo) {
|
|
1596
1649
|
|
|
1597
1650
|
}
|
|
1598
|
-
// Message: Missing JSDoc @param "foo"
|
|
1651
|
+
// Message: Missing JSDoc @param "foo" description.
|
|
1599
1652
|
|
|
1600
1653
|
/**
|
|
1601
|
-
*
|
|
1654
|
+
* @arg foo
|
|
1602
1655
|
*/
|
|
1603
1656
|
function quux (foo) {
|
|
1604
1657
|
|
|
1605
1658
|
}
|
|
1606
1659
|
// Settings: {"jsdoc":{"tagNamePreference":{"param":"arg"}}}
|
|
1607
|
-
// Message: Missing JSDoc @arg "foo"
|
|
1660
|
+
// Message: Missing JSDoc @arg "foo" description.
|
|
1661
|
+
````
|
|
1662
|
+
|
|
1663
|
+
The following patterns are not considered problems:
|
|
1608
1664
|
|
|
1665
|
+
````js
|
|
1609
1666
|
/**
|
|
1610
|
-
*
|
|
1667
|
+
*
|
|
1611
1668
|
*/
|
|
1612
|
-
function quux (foo
|
|
1669
|
+
function quux (foo) {
|
|
1613
1670
|
|
|
1614
1671
|
}
|
|
1615
|
-
// Message: Missing JSDoc @param "bar" declaration.
|
|
1616
1672
|
|
|
1617
1673
|
/**
|
|
1618
|
-
* @
|
|
1674
|
+
* @param foo Foo.
|
|
1619
1675
|
*/
|
|
1620
1676
|
function quux (foo) {
|
|
1621
1677
|
|
|
1622
1678
|
}
|
|
1623
|
-
|
|
1679
|
+
````
|
|
1680
|
+
|
|
1681
|
+
|
|
1682
|
+
<a name="eslint-plugin-jsdoc-rules-require-param-name"></a>
|
|
1683
|
+
### <code>require-param-name</code>
|
|
1684
|
+
|
|
1685
|
+
Requires that all function parameters have name.
|
|
1686
|
+
|
|
1687
|
+
> The `@param` tag requires you to specify the name of the parameter you are documenting. You can also include the parameter's type, enclosed in curly brackets, and a description of the parameter.
|
|
1688
|
+
>
|
|
1689
|
+
> [JSDoc](http://usejsdoc.org/tags-param.html#overview)
|
|
1690
|
+
|
|
1691
|
+
|||
|
|
1692
|
+
|---|---|
|
|
1693
|
+
|Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`|
|
|
1694
|
+
|Tags|`param`|
|
|
1695
|
+
|
|
1696
|
+
The following patterns are considered problems:
|
|
1624
1697
|
|
|
1698
|
+
````js
|
|
1625
1699
|
/**
|
|
1626
|
-
* @
|
|
1700
|
+
* @param
|
|
1627
1701
|
*/
|
|
1628
1702
|
function quux (foo) {
|
|
1629
1703
|
|
|
1630
1704
|
}
|
|
1631
|
-
// Message:
|
|
1705
|
+
// Message: There must be an identifier after @param type.
|
|
1632
1706
|
|
|
1633
1707
|
/**
|
|
1634
|
-
* @
|
|
1708
|
+
* @param {string}
|
|
1635
1709
|
*/
|
|
1636
1710
|
function quux (foo) {
|
|
1637
1711
|
|
|
1638
1712
|
}
|
|
1639
|
-
// Message:
|
|
1713
|
+
// Message: There must be an identifier after @param tag.
|
|
1714
|
+
````
|
|
1715
|
+
|
|
1716
|
+
The following patterns are not considered problems:
|
|
1640
1717
|
|
|
1718
|
+
````js
|
|
1641
1719
|
/**
|
|
1642
|
-
* @
|
|
1720
|
+
* @param foo
|
|
1643
1721
|
*/
|
|
1644
1722
|
function quux (foo) {
|
|
1645
1723
|
|
|
1646
1724
|
}
|
|
1647
|
-
// Message: Missing JSDoc @param "foo" declaration.
|
|
1648
1725
|
|
|
1649
1726
|
/**
|
|
1650
|
-
* @
|
|
1727
|
+
* @param {string} foo
|
|
1651
1728
|
*/
|
|
1652
|
-
|
|
1653
|
-
/**
|
|
1654
|
-
*
|
|
1655
|
-
*/
|
|
1656
|
-
quux (foo) {
|
|
1729
|
+
function quux (foo) {
|
|
1657
1730
|
|
|
1658
|
-
}
|
|
1659
1731
|
}
|
|
1660
|
-
|
|
1732
|
+
````
|
|
1661
1733
|
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1734
|
+
|
|
1735
|
+
<a name="eslint-plugin-jsdoc-rules-require-param-type"></a>
|
|
1736
|
+
### <code>require-param-type</code>
|
|
1737
|
+
|
|
1738
|
+
Requires that `@param` tag has `type` value.
|
|
1739
|
+
|
|
1740
|
+
|||
|
|
1741
|
+
|---|---|
|
|
1742
|
+
|Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`|
|
|
1743
|
+
|Tags|`param`|
|
|
1744
|
+
|
|
1745
|
+
The following patterns are considered problems:
|
|
1746
|
+
|
|
1747
|
+
````js
|
|
1748
|
+
/**
|
|
1749
|
+
* @param foo
|
|
1750
|
+
*/
|
|
1751
|
+
function quux (foo) {
|
|
1752
|
+
|
|
1753
|
+
}
|
|
1754
|
+
// Message: Missing JSDoc @param "foo" type.
|
|
1755
|
+
|
|
1756
|
+
/**
|
|
1757
|
+
* @arg foo
|
|
1758
|
+
*/
|
|
1759
|
+
function quux (foo) {
|
|
1760
|
+
|
|
1761
|
+
}
|
|
1762
|
+
// Settings: {"jsdoc":{"tagNamePreference":{"param":"arg"}}}
|
|
1763
|
+
// Message: Missing JSDoc @arg "foo" type.
|
|
1764
|
+
````
|
|
1765
|
+
|
|
1766
|
+
The following patterns are not considered problems:
|
|
1767
|
+
|
|
1768
|
+
````js
|
|
1769
|
+
/**
|
|
1770
|
+
*
|
|
1771
|
+
*/
|
|
1772
|
+
function quux (foo) {
|
|
1773
|
+
|
|
1774
|
+
}
|
|
1775
|
+
|
|
1776
|
+
/**
|
|
1777
|
+
* @param {number} foo
|
|
1778
|
+
*/
|
|
1779
|
+
function quux (foo) {
|
|
1780
|
+
|
|
1781
|
+
}
|
|
1782
|
+
````
|
|
1783
|
+
|
|
1784
|
+
|
|
1785
|
+
<a name="eslint-plugin-jsdoc-rules-require-param"></a>
|
|
1786
|
+
### <code>require-param</code>
|
|
1787
|
+
|
|
1788
|
+
Requires that all function parameters are documented.
|
|
1789
|
+
|
|
1790
|
+
|||
|
|
1791
|
+
|---|---|
|
|
1792
|
+
|Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`|
|
|
1793
|
+
|Tags|`param`|
|
|
1794
|
+
|
|
1795
|
+
The following patterns are considered problems:
|
|
1796
|
+
|
|
1797
|
+
````js
|
|
1798
|
+
/**
|
|
1799
|
+
*
|
|
1800
|
+
*/
|
|
1801
|
+
function quux (foo) {
|
|
1802
|
+
|
|
1803
|
+
}
|
|
1804
|
+
// Message: Missing JSDoc @param "foo" declaration.
|
|
1805
|
+
|
|
1806
|
+
/**
|
|
1807
|
+
*
|
|
1808
|
+
*/
|
|
1809
|
+
function quux (foo) {
|
|
1810
|
+
|
|
1811
|
+
}
|
|
1812
|
+
// Settings: {"jsdoc":{"tagNamePreference":{"param":"arg"}}}
|
|
1813
|
+
// Message: Missing JSDoc @arg "foo" declaration.
|
|
1814
|
+
|
|
1815
|
+
/**
|
|
1816
|
+
* @param foo
|
|
1817
|
+
*/
|
|
1818
|
+
function quux (foo, bar) {
|
|
1819
|
+
|
|
1820
|
+
}
|
|
1821
|
+
// Message: Missing JSDoc @param "bar" declaration.
|
|
1822
|
+
|
|
1823
|
+
/**
|
|
1824
|
+
* @override
|
|
1825
|
+
*/
|
|
1826
|
+
function quux (foo) {
|
|
1827
|
+
|
|
1828
|
+
}
|
|
1829
|
+
// Message: Missing JSDoc @param "foo" declaration.
|
|
1830
|
+
|
|
1831
|
+
/**
|
|
1832
|
+
* @implements
|
|
1833
|
+
*/
|
|
1834
|
+
function quux (foo) {
|
|
1835
|
+
|
|
1836
|
+
}
|
|
1837
|
+
// Message: Missing JSDoc @param "foo" declaration.
|
|
1838
|
+
|
|
1839
|
+
/**
|
|
1840
|
+
* @augments
|
|
1841
|
+
*/
|
|
1842
|
+
function quux (foo) {
|
|
1843
|
+
|
|
1844
|
+
}
|
|
1845
|
+
// Message: Missing JSDoc @param "foo" declaration.
|
|
1846
|
+
|
|
1847
|
+
/**
|
|
1848
|
+
* @extends
|
|
1849
|
+
*/
|
|
1850
|
+
function quux (foo) {
|
|
1851
|
+
|
|
1852
|
+
}
|
|
1853
|
+
// Message: Missing JSDoc @param "foo" declaration.
|
|
1854
|
+
|
|
1855
|
+
/**
|
|
1856
|
+
* @override
|
|
1857
|
+
*/
|
|
1858
|
+
class A {
|
|
1859
|
+
/**
|
|
1860
|
+
*
|
|
1861
|
+
*/
|
|
1862
|
+
quux (foo) {
|
|
1863
|
+
|
|
1864
|
+
}
|
|
1865
|
+
}
|
|
1866
|
+
// Message: Missing JSDoc @param "foo" declaration.
|
|
1867
|
+
|
|
1868
|
+
/**
|
|
1869
|
+
* @implements
|
|
1870
|
+
*/
|
|
1871
|
+
class A {
|
|
1666
1872
|
/**
|
|
1667
1873
|
*
|
|
1668
1874
|
*/
|
|
@@ -1697,11 +1903,11 @@ class A {
|
|
|
1697
1903
|
}
|
|
1698
1904
|
}
|
|
1699
1905
|
// Message: Missing JSDoc @param "foo" declaration.
|
|
1700
|
-
|
|
1906
|
+
````
|
|
1701
1907
|
|
|
1702
1908
|
The following patterns are not considered problems:
|
|
1703
1909
|
|
|
1704
|
-
|
|
1910
|
+
````js
|
|
1705
1911
|
/**
|
|
1706
1912
|
* @param foo
|
|
1707
1913
|
*/
|
|
@@ -1887,261 +2093,422 @@ class A {
|
|
|
1887
2093
|
|
|
1888
2094
|
}
|
|
1889
2095
|
}
|
|
1890
|
-
|
|
2096
|
+
````
|
|
1891
2097
|
|
|
1892
2098
|
|
|
1893
|
-
<a name="eslint-plugin-jsdoc-rules-require-
|
|
1894
|
-
### <code>require-
|
|
2099
|
+
<a name="eslint-plugin-jsdoc-rules-require-returns-description"></a>
|
|
2100
|
+
### <code>require-returns-description</code>
|
|
1895
2101
|
|
|
1896
|
-
Requires that `@
|
|
2102
|
+
Requires that `@returns` tag has `description` value.
|
|
1897
2103
|
|
|
1898
2104
|
|||
|
|
1899
2105
|
|---|---|
|
|
1900
2106
|
|Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`|
|
|
1901
|
-
|Tags|`
|
|
2107
|
+
|Tags|`returns`|
|
|
1902
2108
|
|
|
1903
2109
|
The following patterns are considered problems:
|
|
1904
2110
|
|
|
1905
|
-
|
|
2111
|
+
````js
|
|
1906
2112
|
/**
|
|
1907
|
-
* @
|
|
2113
|
+
* @returns
|
|
1908
2114
|
*/
|
|
1909
2115
|
function quux (foo) {
|
|
1910
2116
|
|
|
1911
2117
|
}
|
|
1912
|
-
// Message: Missing JSDoc @
|
|
2118
|
+
// Message: Missing JSDoc @returns description.
|
|
1913
2119
|
|
|
1914
2120
|
/**
|
|
1915
|
-
* @
|
|
2121
|
+
* @return
|
|
1916
2122
|
*/
|
|
1917
2123
|
function quux (foo) {
|
|
1918
2124
|
|
|
1919
2125
|
}
|
|
1920
|
-
// Settings: {"jsdoc":{"tagNamePreference":{"
|
|
1921
|
-
// Message: Missing JSDoc @
|
|
1922
|
-
|
|
2126
|
+
// Settings: {"jsdoc":{"tagNamePreference":{"returns":"return"}}}
|
|
2127
|
+
// Message: Missing JSDoc @return description.
|
|
2128
|
+
````
|
|
1923
2129
|
|
|
1924
2130
|
The following patterns are not considered problems:
|
|
1925
2131
|
|
|
1926
|
-
|
|
2132
|
+
````js
|
|
1927
2133
|
/**
|
|
1928
2134
|
*
|
|
1929
2135
|
*/
|
|
1930
|
-
function quux (
|
|
2136
|
+
function quux () {
|
|
1931
2137
|
|
|
1932
2138
|
}
|
|
1933
2139
|
|
|
1934
2140
|
/**
|
|
1935
|
-
* @
|
|
2141
|
+
* @returns Foo.
|
|
1936
2142
|
*/
|
|
1937
|
-
function quux (
|
|
2143
|
+
function quux () {
|
|
1938
2144
|
|
|
1939
2145
|
}
|
|
1940
|
-
|
|
2146
|
+
````
|
|
1941
2147
|
|
|
1942
2148
|
|
|
1943
|
-
<a name="eslint-plugin-jsdoc-rules-require-
|
|
1944
|
-
### <code>require-
|
|
1945
|
-
|
|
1946
|
-
Requires that all function parameters have name.
|
|
2149
|
+
<a name="eslint-plugin-jsdoc-rules-require-returns-type"></a>
|
|
2150
|
+
### <code>require-returns-type</code>
|
|
1947
2151
|
|
|
1948
|
-
|
|
1949
|
-
>
|
|
1950
|
-
> [JSDoc](http://usejsdoc.org/tags-param.html#overview)
|
|
2152
|
+
Requires that `@returns` tag has `type` value.
|
|
1951
2153
|
|
|
1952
2154
|
|||
|
|
1953
2155
|
|---|---|
|
|
1954
2156
|
|Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`|
|
|
1955
|
-
|Tags|`
|
|
2157
|
+
|Tags|`returns`|
|
|
1956
2158
|
|
|
1957
2159
|
The following patterns are considered problems:
|
|
1958
2160
|
|
|
1959
|
-
|
|
2161
|
+
````js
|
|
1960
2162
|
/**
|
|
1961
|
-
* @
|
|
2163
|
+
* @returns
|
|
1962
2164
|
*/
|
|
1963
|
-
function quux (
|
|
2165
|
+
function quux () {
|
|
1964
2166
|
|
|
1965
2167
|
}
|
|
1966
|
-
// Message:
|
|
2168
|
+
// Message: Missing JSDoc @returns type.
|
|
1967
2169
|
|
|
1968
2170
|
/**
|
|
1969
|
-
* @
|
|
2171
|
+
* @returns Foo.
|
|
1970
2172
|
*/
|
|
1971
|
-
function quux (
|
|
2173
|
+
function quux () {
|
|
1972
2174
|
|
|
1973
2175
|
}
|
|
1974
|
-
// Message:
|
|
1975
|
-
```
|
|
1976
|
-
|
|
1977
|
-
The following patterns are not considered problems:
|
|
2176
|
+
// Message: Missing JSDoc @returns type.
|
|
1978
2177
|
|
|
1979
|
-
```js
|
|
1980
2178
|
/**
|
|
1981
|
-
* @
|
|
2179
|
+
* @return Foo.
|
|
1982
2180
|
*/
|
|
1983
|
-
function quux (
|
|
2181
|
+
function quux () {
|
|
1984
2182
|
|
|
1985
2183
|
}
|
|
2184
|
+
// Settings: {"jsdoc":{"tagNamePreference":{"returns":"return"}}}
|
|
2185
|
+
// Message: Missing JSDoc @return type.
|
|
2186
|
+
````
|
|
1986
2187
|
|
|
2188
|
+
The following patterns are not considered problems:
|
|
2189
|
+
|
|
2190
|
+
````js
|
|
1987
2191
|
/**
|
|
1988
|
-
* @
|
|
2192
|
+
* @returns {number}
|
|
1989
2193
|
*/
|
|
1990
|
-
function quux (
|
|
2194
|
+
function quux () {
|
|
1991
2195
|
|
|
1992
2196
|
}
|
|
1993
|
-
|
|
2197
|
+
````
|
|
1994
2198
|
|
|
1995
2199
|
|
|
1996
|
-
<a name="eslint-plugin-jsdoc-rules-require-
|
|
1997
|
-
### <code>require-
|
|
2200
|
+
<a name="eslint-plugin-jsdoc-rules-require-returns"></a>
|
|
2201
|
+
### <code>require-returns</code>
|
|
1998
2202
|
|
|
1999
|
-
Requires
|
|
2203
|
+
Requires returns are documented.
|
|
2000
2204
|
|
|
2001
2205
|
|||
|
|
2002
2206
|
|---|---|
|
|
2003
2207
|
|Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`|
|
|
2004
|
-
|Tags|`
|
|
2208
|
+
|Tags|`returns`|
|
|
2005
2209
|
|
|
2006
2210
|
The following patterns are considered problems:
|
|
2007
2211
|
|
|
2008
|
-
|
|
2212
|
+
````js
|
|
2009
2213
|
/**
|
|
2010
|
-
*
|
|
2214
|
+
*
|
|
2011
2215
|
*/
|
|
2012
2216
|
function quux (foo) {
|
|
2013
2217
|
|
|
2014
2218
|
}
|
|
2015
|
-
// Message: Missing JSDoc @param "foo"
|
|
2219
|
+
// Message: Missing JSDoc @param "foo" declaration.
|
|
2016
2220
|
|
|
2017
2221
|
/**
|
|
2018
|
-
*
|
|
2222
|
+
*
|
|
2019
2223
|
*/
|
|
2020
2224
|
function quux (foo) {
|
|
2021
2225
|
|
|
2022
2226
|
}
|
|
2023
2227
|
// Settings: {"jsdoc":{"tagNamePreference":{"param":"arg"}}}
|
|
2024
|
-
// Message: Missing JSDoc @arg "foo"
|
|
2025
|
-
|
|
2228
|
+
// Message: Missing JSDoc @arg "foo" declaration.
|
|
2229
|
+
|
|
2230
|
+
/**
|
|
2231
|
+
* @param foo
|
|
2232
|
+
*/
|
|
2233
|
+
function quux (foo, bar) {
|
|
2234
|
+
|
|
2235
|
+
}
|
|
2236
|
+
// Message: Missing JSDoc @param "bar" declaration.
|
|
2237
|
+
|
|
2238
|
+
/**
|
|
2239
|
+
* @override
|
|
2240
|
+
*/
|
|
2241
|
+
function quux (foo) {
|
|
2242
|
+
|
|
2243
|
+
}
|
|
2244
|
+
// Message: Missing JSDoc @param "foo" declaration.
|
|
2245
|
+
|
|
2246
|
+
/**
|
|
2247
|
+
* @implements
|
|
2248
|
+
*/
|
|
2249
|
+
function quux (foo) {
|
|
2250
|
+
|
|
2251
|
+
}
|
|
2252
|
+
// Message: Missing JSDoc @param "foo" declaration.
|
|
2253
|
+
|
|
2254
|
+
/**
|
|
2255
|
+
* @augments
|
|
2256
|
+
*/
|
|
2257
|
+
function quux (foo) {
|
|
2258
|
+
|
|
2259
|
+
}
|
|
2260
|
+
// Message: Missing JSDoc @param "foo" declaration.
|
|
2261
|
+
|
|
2262
|
+
/**
|
|
2263
|
+
* @extends
|
|
2264
|
+
*/
|
|
2265
|
+
function quux (foo) {
|
|
2266
|
+
|
|
2267
|
+
}
|
|
2268
|
+
// Message: Missing JSDoc @param "foo" declaration.
|
|
2269
|
+
|
|
2270
|
+
/**
|
|
2271
|
+
* @override
|
|
2272
|
+
*/
|
|
2273
|
+
class A {
|
|
2274
|
+
/**
|
|
2275
|
+
*
|
|
2276
|
+
*/
|
|
2277
|
+
quux (foo) {
|
|
2278
|
+
|
|
2279
|
+
}
|
|
2280
|
+
}
|
|
2281
|
+
// Message: Missing JSDoc @param "foo" declaration.
|
|
2282
|
+
|
|
2283
|
+
/**
|
|
2284
|
+
* @implements
|
|
2285
|
+
*/
|
|
2286
|
+
class A {
|
|
2287
|
+
/**
|
|
2288
|
+
*
|
|
2289
|
+
*/
|
|
2290
|
+
quux (foo) {
|
|
2291
|
+
|
|
2292
|
+
}
|
|
2293
|
+
}
|
|
2294
|
+
// Message: Missing JSDoc @param "foo" declaration.
|
|
2295
|
+
|
|
2296
|
+
/**
|
|
2297
|
+
* @augments
|
|
2298
|
+
*/
|
|
2299
|
+
class A {
|
|
2300
|
+
/**
|
|
2301
|
+
*
|
|
2302
|
+
*/
|
|
2303
|
+
quux (foo) {
|
|
2304
|
+
|
|
2305
|
+
}
|
|
2306
|
+
}
|
|
2307
|
+
// Message: Missing JSDoc @param "foo" declaration.
|
|
2308
|
+
|
|
2309
|
+
/**
|
|
2310
|
+
* @extends
|
|
2311
|
+
*/
|
|
2312
|
+
class A {
|
|
2313
|
+
/**
|
|
2314
|
+
*
|
|
2315
|
+
*/
|
|
2316
|
+
quux (foo) {
|
|
2317
|
+
|
|
2318
|
+
}
|
|
2319
|
+
}
|
|
2320
|
+
// Message: Missing JSDoc @param "foo" declaration.
|
|
2321
|
+
````
|
|
2026
2322
|
|
|
2027
2323
|
The following patterns are not considered problems:
|
|
2028
2324
|
|
|
2029
|
-
|
|
2325
|
+
````js
|
|
2030
2326
|
/**
|
|
2031
|
-
*
|
|
2327
|
+
* @param foo
|
|
2032
2328
|
*/
|
|
2033
2329
|
function quux (foo) {
|
|
2034
2330
|
|
|
2035
2331
|
}
|
|
2036
2332
|
|
|
2037
2333
|
/**
|
|
2038
|
-
* @
|
|
2334
|
+
* @inheritdoc
|
|
2039
2335
|
*/
|
|
2040
2336
|
function quux (foo) {
|
|
2041
2337
|
|
|
2042
2338
|
}
|
|
2043
|
-
```
|
|
2044
2339
|
|
|
2340
|
+
/**
|
|
2341
|
+
* @arg foo
|
|
2342
|
+
*/
|
|
2343
|
+
function quux (foo) {
|
|
2045
2344
|
|
|
2046
|
-
|
|
2047
|
-
|
|
2345
|
+
}
|
|
2346
|
+
// Settings: {"jsdoc":{"tagNamePreference":{"param":"arg"}}}
|
|
2048
2347
|
|
|
2049
|
-
|
|
2348
|
+
/**
|
|
2349
|
+
* @override
|
|
2350
|
+
* @param foo
|
|
2351
|
+
*/
|
|
2352
|
+
function quux (foo) {
|
|
2050
2353
|
|
|
2051
|
-
|
|
2052
|
-
|---|---|
|
|
2053
|
-
|Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`|
|
|
2054
|
-
|Tags|`returns`|
|
|
2354
|
+
}
|
|
2055
2355
|
|
|
2056
|
-
|
|
2356
|
+
/**
|
|
2357
|
+
* @override
|
|
2358
|
+
*/
|
|
2359
|
+
function quux (foo) {
|
|
2360
|
+
|
|
2361
|
+
}
|
|
2362
|
+
// Settings: {"jsdoc":{"allowOverrideWithoutParam":true}}
|
|
2057
2363
|
|
|
2058
|
-
```js
|
|
2059
2364
|
/**
|
|
2060
|
-
* @
|
|
2365
|
+
* @implements
|
|
2061
2366
|
*/
|
|
2062
2367
|
function quux (foo) {
|
|
2063
2368
|
|
|
2064
2369
|
}
|
|
2065
|
-
//
|
|
2370
|
+
// Settings: {"jsdoc":{"allowImplementsWithoutParam":true}}
|
|
2066
2371
|
|
|
2067
2372
|
/**
|
|
2068
|
-
* @
|
|
2373
|
+
* @implements
|
|
2374
|
+
* @param foo
|
|
2069
2375
|
*/
|
|
2070
2376
|
function quux (foo) {
|
|
2071
2377
|
|
|
2072
2378
|
}
|
|
2073
|
-
// Settings: {"jsdoc":{"tagNamePreference":{"returns":"return"}}}
|
|
2074
|
-
// Message: Missing JSDoc @return description.
|
|
2075
|
-
```
|
|
2076
2379
|
|
|
2077
|
-
|
|
2380
|
+
/**
|
|
2381
|
+
* @augments
|
|
2382
|
+
*/
|
|
2383
|
+
function quux (foo) {
|
|
2384
|
+
|
|
2385
|
+
}
|
|
2386
|
+
// Settings: {"jsdoc":{"allowAugmentsExtendsWithoutParam":true}}
|
|
2078
2387
|
|
|
2079
|
-
```js
|
|
2080
2388
|
/**
|
|
2081
|
-
*
|
|
2389
|
+
* @augments
|
|
2390
|
+
* @param foo
|
|
2082
2391
|
*/
|
|
2083
|
-
function quux () {
|
|
2392
|
+
function quux (foo) {
|
|
2084
2393
|
|
|
2085
2394
|
}
|
|
2086
2395
|
|
|
2087
2396
|
/**
|
|
2088
|
-
* @
|
|
2397
|
+
* @extends
|
|
2089
2398
|
*/
|
|
2090
|
-
function quux () {
|
|
2399
|
+
function quux (foo) {
|
|
2091
2400
|
|
|
2092
2401
|
}
|
|
2093
|
-
|
|
2402
|
+
// Settings: {"jsdoc":{"allowAugmentsExtendsWithoutParam":true}}
|
|
2094
2403
|
|
|
2404
|
+
/**
|
|
2405
|
+
* @extends
|
|
2406
|
+
* @param foo
|
|
2407
|
+
*/
|
|
2408
|
+
function quux (foo) {
|
|
2095
2409
|
|
|
2096
|
-
|
|
2097
|
-
### <code>require-returns-type</code>
|
|
2410
|
+
}
|
|
2098
2411
|
|
|
2099
|
-
|
|
2412
|
+
/**
|
|
2413
|
+
* @override
|
|
2414
|
+
*/
|
|
2415
|
+
class A {
|
|
2416
|
+
/**
|
|
2417
|
+
* @param foo
|
|
2418
|
+
*/
|
|
2419
|
+
quux (foo) {
|
|
2100
2420
|
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`|
|
|
2104
|
-
|Tags|`returns`|
|
|
2421
|
+
}
|
|
2422
|
+
}
|
|
2105
2423
|
|
|
2106
|
-
|
|
2424
|
+
/**
|
|
2425
|
+
* @override
|
|
2426
|
+
*/
|
|
2427
|
+
class A {
|
|
2428
|
+
/**
|
|
2429
|
+
*
|
|
2430
|
+
*/
|
|
2431
|
+
quux (foo) {
|
|
2432
|
+
|
|
2433
|
+
}
|
|
2434
|
+
}
|
|
2435
|
+
// Settings: {"jsdoc":{"allowOverrideWithoutParam":true}}
|
|
2107
2436
|
|
|
2108
|
-
```js
|
|
2109
2437
|
/**
|
|
2110
|
-
* @
|
|
2438
|
+
* @implements
|
|
2111
2439
|
*/
|
|
2112
|
-
|
|
2440
|
+
class A {
|
|
2441
|
+
/**
|
|
2442
|
+
*
|
|
2443
|
+
*/
|
|
2444
|
+
quux (foo) {
|
|
2113
2445
|
|
|
2446
|
+
}
|
|
2114
2447
|
}
|
|
2115
|
-
//
|
|
2448
|
+
// Settings: {"jsdoc":{"allowImplementsWithoutParam":true}}
|
|
2116
2449
|
|
|
2117
2450
|
/**
|
|
2118
|
-
* @
|
|
2451
|
+
* @implements
|
|
2119
2452
|
*/
|
|
2120
|
-
|
|
2453
|
+
class A {
|
|
2454
|
+
/**
|
|
2455
|
+
* @param foo
|
|
2456
|
+
*/
|
|
2457
|
+
quux (foo) {
|
|
2121
2458
|
|
|
2459
|
+
}
|
|
2122
2460
|
}
|
|
2123
|
-
// Message: Missing JSDoc @returns type.
|
|
2124
2461
|
|
|
2125
2462
|
/**
|
|
2126
|
-
* @
|
|
2463
|
+
* @augments
|
|
2127
2464
|
*/
|
|
2128
|
-
|
|
2465
|
+
class A {
|
|
2466
|
+
/**
|
|
2467
|
+
*
|
|
2468
|
+
*/
|
|
2469
|
+
quux (foo) {
|
|
2129
2470
|
|
|
2471
|
+
}
|
|
2130
2472
|
}
|
|
2131
|
-
// Settings: {"jsdoc":{"
|
|
2132
|
-
// Message: Missing JSDoc @return type.
|
|
2133
|
-
```
|
|
2473
|
+
// Settings: {"jsdoc":{"allowAugmentsExtendsWithoutParam":true}}
|
|
2134
2474
|
|
|
2135
|
-
|
|
2475
|
+
/**
|
|
2476
|
+
* @augments
|
|
2477
|
+
*/
|
|
2478
|
+
class A {
|
|
2479
|
+
/**
|
|
2480
|
+
* @param foo
|
|
2481
|
+
*/
|
|
2482
|
+
quux (foo) {
|
|
2483
|
+
|
|
2484
|
+
}
|
|
2485
|
+
}
|
|
2136
2486
|
|
|
2137
|
-
```js
|
|
2138
2487
|
/**
|
|
2139
|
-
* @
|
|
2488
|
+
* @extends
|
|
2140
2489
|
*/
|
|
2141
|
-
|
|
2490
|
+
class A {
|
|
2491
|
+
/**
|
|
2492
|
+
*
|
|
2493
|
+
*/
|
|
2494
|
+
quux (foo) {
|
|
2142
2495
|
|
|
2496
|
+
}
|
|
2143
2497
|
}
|
|
2144
|
-
|
|
2498
|
+
// Settings: {"jsdoc":{"allowAugmentsExtendsWithoutParam":true}}
|
|
2499
|
+
|
|
2500
|
+
/**
|
|
2501
|
+
* @extends
|
|
2502
|
+
*/
|
|
2503
|
+
class A {
|
|
2504
|
+
/**
|
|
2505
|
+
* @param foo
|
|
2506
|
+
*/
|
|
2507
|
+
quux (foo) {
|
|
2508
|
+
|
|
2509
|
+
}
|
|
2510
|
+
}
|
|
2511
|
+
````
|
|
2145
2512
|
|
|
2146
2513
|
|
|
2147
2514
|
<a name="eslint-plugin-jsdoc-rules-valid-types"></a>
|
|
@@ -2156,7 +2523,7 @@ Requires all types to be valid JSDoc or Closure compiler types without syntax er
|
|
|
2156
2523
|
|
|
2157
2524
|
The following patterns are considered problems:
|
|
2158
2525
|
|
|
2159
|
-
|
|
2526
|
+
````js
|
|
2160
2527
|
/**
|
|
2161
2528
|
* @param {Array<string} foo
|
|
2162
2529
|
*/
|
|
@@ -2164,11 +2531,11 @@ function quux() {
|
|
|
2164
2531
|
|
|
2165
2532
|
}
|
|
2166
2533
|
// Message: Syntax error in type: Array<string
|
|
2167
|
-
|
|
2534
|
+
````
|
|
2168
2535
|
|
|
2169
2536
|
The following patterns are not considered problems:
|
|
2170
2537
|
|
|
2171
|
-
|
|
2538
|
+
````js
|
|
2172
2539
|
/**
|
|
2173
2540
|
* @param {Array<string>} foo
|
|
2174
2541
|
*/
|
|
@@ -2189,4 +2556,6 @@ function quux() {
|
|
|
2189
2556
|
function quux() {
|
|
2190
2557
|
|
|
2191
2558
|
}
|
|
2192
|
-
|
|
2559
|
+
````
|
|
2560
|
+
|
|
2561
|
+
|