9
9
JSDoc linting rules for ESLint.
10
10
11
11
* [ eslint-plugin-jsdoc] ( #eslint-plugin-jsdoc )
12
- * [ Reference to jscs-jsdoc] ( #eslint-plugin-jsdoc-reference-to-jscs-jsdoc )
13
12
* [ Installation] ( #eslint-plugin-jsdoc-installation )
14
13
* [ Configuration] ( #eslint-plugin-jsdoc-configuration )
15
14
* [ Settings] ( #eslint-plugin-jsdoc-settings )
@@ -20,7 +19,6 @@ JSDoc linting rules for ESLint.
20
19
* [ Rules] ( #eslint-plugin-jsdoc-rules )
21
20
* [ ` check-alignment ` ] ( #eslint-plugin-jsdoc-rules-check-alignment )
22
21
* [ ` check-examples ` ] ( #eslint-plugin-jsdoc-rules-check-examples )
23
- * [ Options] ( #eslint-plugin-jsdoc-rules-options )
24
22
* [ ` check-indentation ` ] ( #eslint-plugin-jsdoc-rules-check-indentation )
25
23
* [ ` check-param-names ` ] ( #eslint-plugin-jsdoc-rules-check-param-names )
26
24
* [ ` check-syntax ` ] ( #eslint-plugin-jsdoc-rules-check-syntax )
@@ -47,42 +45,6 @@ JSDoc linting rules for ESLint.
47
45
* [ ` valid-types ` ] ( #eslint-plugin-jsdoc-rules-valid-types )
48
46
49
47
50
- <a name =" eslint-plugin-jsdoc-reference-to-jscs-jsdoc " ></a >
51
- ### Reference to jscs-jsdoc
52
-
53
- This table maps the rules between ` eslint-plugin-jsdoc ` and ` jscs-jsdoc ` .
54
-
55
- | ` eslint-plugin-jsdoc ` | ` jscs-jsdoc ` |
56
- | --- | --- |
57
- | [ ` check-alignment ` ] ( https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-alignment ) | N/A |
58
- | [ ` check-examples ` ] ( https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-examples ) | N/A |
59
- | [ ` check-indentation ` ] ( https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-indentation ) | N/A |
60
- | [ ` check-param-names ` ] ( https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-param-names ) | [ ` checkParamNames ` ] ( https://github.com/jscs-dev/jscs-jsdoc#checkparamnames ) |
61
- | [ ` check-syntax ` ] ( https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-syntax ) | N/A |
62
- | [ ` check-tag-names ` ] ( https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-tag-names ) | N/A ~ [ ` checkAnnotations ` ] ( https://github.com/jscs-dev/jscs-jsdoc#checkannotations ) |
63
- | [ ` check-types ` ] ( https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-check-types ) | [ ` checkTypes ` ] ( https://github.com/jscs-dev/jscs-jsdoc#checktypes ) |
64
- | [ ` newline-after-description ` ] ( https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-newline-after-description ) | [ ` requireNewlineAfterDescription ` ] ( https://github.com/jscs-dev/jscs-jsdoc#requirenewlineafterdescription ) and [ ` disallowNewlineAfterDescription ` ] ( https://github.com/jscs-dev/jscs-jsdoc#disallownewlineafterdescription ) |
65
- | [ ` require-description ` ] ( https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-description ) | N/A |
66
- | [ ` require-description-complete-sentence ` ] ( https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-description-complete-sentence ) | [ ` requireDescriptionCompleteSentence ` ] ( https://github.com/jscs-dev/jscs-jsdoc#requiredescriptioncompletesentence ) |
67
- | [ ` require-example ` ] ( https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-example ) | N/A |
68
- | [ ` require-hyphen-before-param-description ` ] ( https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-hyphen-before-param-description ) | [ ` requireHyphenBeforeDescription ` ] ( https://github.com/jscs-dev/jscs-jsdoc#requirehyphenbeforedescription ) |
69
- | [ ` require-param ` ] ( https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-param ) | [ ` checkParamExistence ` ] ( https://github.com/jscs-dev/jscs-jsdoc#checkparamexistence ) |
70
- | [ ` 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 ) |
71
- | [ ` require-param-name ` ] ( https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-param-name ) | N/A |
72
- | [ ` 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 ) |
73
- | [ ` require-returns ` ] ( https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-returns ) | [ ` requireReturn ` ] ( https://github.com/jscs-dev/jscs-jsdoc#requirereturn ) |
74
- | [ ` require-returns-check ` ] ( https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-returns-check ) | [ ` requireReturn ` ] ( https://github.com/jscs-dev/jscs-jsdoc#requirereturncheck ) |
75
- | [ ` 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 ) |
76
- | [ ` 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 ) |
77
- | [ ` valid-types ` ] ( https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-valid-types ) | N/A |
78
- | [ ` no-undefined-types ` ] ( https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-no-undefined-types ) | N/A |
79
- | N/A | [ ` checkReturnTypes ` ] ( https://github.com/jscs-dev/jscs-jsdoc#checkreturntypes ) |
80
- | N/A | [ ` checkRedundantParams ` ] ( https://github.com/jscs-dev/jscs-jsdoc#checkredundantparams ) |
81
- | N/A | [ ` checkReturnTypes ` ] ( https://github.com/jscs-dev/jscs-jsdoc#checkreturntypes ) |
82
- | N/A | [ ` checkRedundantAccess ` ] ( https://github.com/jscs-dev/jscs-jsdoc#checkredundantaccess ) |
83
- | N/A | [ ` enforceExistence ` ] ( https://github.com/jscs-dev/jscs-jsdoc#enforceexistence ) |
84
- | N/A | [ ` leadingUnderscoreAccess ` ] ( https://github.com/jscs-dev/jscs-jsdoc#leadingunderscoreaccess ) |
85
-
86
48
<a name =" eslint-plugin-jsdoc-installation " ></a >
87
49
## Installation
88
50
@@ -464,22 +426,22 @@ function quux (foo) {}
464
426
465
427
Ensures that (JavaScript) examples within JSDoc adhere to ESLint rules.
466
428
467
- <a name =" eslint-plugin-jsdoc-rules-options " ></a >
468
- ### Options
429
+ <a name =" eslint-plugin-jsdoc-rules-check-examples- options " ></a >
430
+ #### Options
469
431
470
432
The options below all default to no-op/` false ` except as noted.
471
433
472
- <a name =" eslint-plugin-jsdoc-rules-options-captionrequired " ></a >
473
- #### <code >captionRequired</code >
434
+ <a name =" eslint-plugin-jsdoc-rules-check-examples- options-captionrequired " ></a >
435
+ ##### <code >captionRequired</code >
474
436
475
437
JSDoc specs use of an optional ` <caption> ` element at the beginning of
476
438
` @example ` .
477
439
478
440
The option ` captionRequired ` insists on a ` <caption> ` being present at
479
441
the beginning of any ` @example ` .
480
442
481
- <a name =" eslint-plugin-jsdoc-rules-options-examplecoderegex-and-rejectexamplecoderegex " ></a >
482
- #### <code >exampleCodeRegex</code > and <code >rejectExampleCodeRegex</code >
443
+ <a name =" eslint-plugin-jsdoc-rules-check-examples- options-examplecoderegex-and-rejectexamplecoderegex " ></a >
444
+ ##### <code >exampleCodeRegex</code > and <code >rejectExampleCodeRegex</code >
483
445
484
446
JSDoc does not specify a formal means for delimiting code blocks within
485
447
` @example ` (it uses generic syntax highlighting techniques for its own
@@ -502,8 +464,8 @@ If neither is in use, all examples will be matched. Note also that even if
502
464
` captionRequired ` is not set, any initial ` <caption> ` will be stripped out
503
465
before doing the regex matching.
504
466
505
- <a name =" eslint-plugin-jsdoc-rules-options-paddedindent " ></a >
506
- #### <code >paddedIndent</code >
467
+ <a name =" eslint-plugin-jsdoc-rules-check-examples- options-paddedindent " ></a >
468
+ ##### <code >paddedIndent</code >
507
469
508
470
This integer property allows one to add a fixed amount of whitespace at the
509
471
beginning of the second or later lines of the example to be stripped so as
@@ -521,8 +483,8 @@ out before evaluation.
521
483
*/
522
484
```
523
485
524
- <a name =" eslint-plugin-jsdoc-rules-options-reportunuseddisabledirectives " ></a >
525
- #### <code >reportUnusedDisableDirectives</code >
486
+ <a name =" eslint-plugin-jsdoc-rules-check-examples- options-reportunuseddisabledirectives " ></a >
487
+ ##### <code >reportUnusedDisableDirectives</code >
526
488
527
489
If not set to ` false ` , ` reportUnusedDisableDirectives ` will report disabled
528
490
directives which are not used (and thus not needed). Defaults to ` true ` .
@@ -533,7 +495,7 @@ disabling of ESLint directives which are not needed by the resolved rules
533
495
will be reported as with the ESLint ` --report-unused-disable-directives `
534
496
command.
535
497
536
- <a name =" eslint-plugin-jsdoc-rules-options -options-for-determining-eslint-rule-applicability-allowinlineconfig-nodefaultexamplerules-matchingfilename-configfile-eslintrcforexamples-and-baseconfig " ></a >
498
+ <a name =" eslint-plugin-jsdoc-rules-check-examples -options-for-determining-eslint-rule-applicability-allowinlineconfig-nodefaultexamplerules-matchingfilename-configfile-eslintrcforexamples-and-baseconfig " ></a >
537
499
#### Options for Determining ESLint Rule Applicability (<code >allowInlineConfig</code >, <code >noDefaultExampleRules</code >, <code >matchingFileName</code >, <code >configFile</code >, <code >eslintrcForExamples</code >, and <code >baseConfig</code >)
538
500
539
501
The following options determine which individual ESLint rules will be
@@ -564,7 +526,7 @@ decreasing precedence:
564
526
* ` baseConfig ` - An object of rules with the same schema
565
527
as ` .eslintrc.* ` for defaults
566
528
567
- <a name =" eslint-plugin-jsdoc-rules-options -options-for-determining-eslint-rule-applicability-allowinlineconfig-nodefaultexamplerules-matchingfilename-configfile-eslintrcforexamples-and-baseconfig-rules-disabled-by-default-unless-nodefaultexamplerules-is-set-to-true " ></a >
529
+ <a name =" eslint-plugin-jsdoc-rules-check-examples -options-for-determining-eslint-rule-applicability-allowinlineconfig-nodefaultexamplerules-matchingfilename-configfile-eslintrcforexamples-and-baseconfig-rules-disabled-by-default-unless-nodefaultexamplerules-is-set-to-true " ></a >
568
530
##### Rules Disabled by Default Unless <code >noDefaultExampleRules</code > is Set to <code >true</code >
569
531
570
532
* ` eol-last ` - Insisting that a newline "always" be at the end is less likely
@@ -5812,6 +5774,30 @@ function quux (foo) {
5812
5774
}
5813
5775
// Message: Missing JSDoc @param "foo" declaration.
5814
5776
5777
+ /**
5778
+ *
5779
+ */
5780
+ function quux (foo , bar ) {
5781
+
5782
+ }
5783
+ // Message: Missing JSDoc @param "foo" declaration.
5784
+
5785
+ /**
5786
+ * @param bar
5787
+ */
5788
+ function quux (foo , bar , baz ) {
5789
+
5790
+ }
5791
+ // Message: Missing JSDoc @param "foo" declaration.
5792
+
5793
+ /**
5794
+ * @param baz
5795
+ */
5796
+ function quux (foo , bar , baz ) {
5797
+
5798
+ }
5799
+ // Message: Missing JSDoc @param "foo" declaration.
5800
+
5815
5801
/**
5816
5802
* @param
5817
5803
*/
@@ -7295,31 +7281,31 @@ function quux() {
7295
7281
// Message: Tag @callback must have a namepath
7296
7282
7297
7283
/**
7298
- * @constant {str%ng}
7299
- */
7300
- const FOO = ' foo' ;
7284
+ * @constant {str%ng}
7285
+ */
7286
+ const FOO = ' foo' ;
7301
7287
// Message: Syntax error in type: str%ng
7302
7288
7303
7289
/**
7304
- * @typedef {str%ng} UserString
7305
- */
7290
+ * @typedef {str%ng} UserString
7291
+ */
7306
7292
// Message: Syntax error in type: str%ng
7307
7293
7308
7294
/**
7309
- * @typedef {string} UserStr%ng
7310
- */
7295
+ * @typedef {string} UserStr%ng
7296
+ */
7311
7297
// Message: Syntax error in type: UserStr%ng
7312
7298
7313
7299
/**
7314
- * @extends
7315
- */
7316
- class Bar {};
7300
+ * @extends
7301
+ */
7302
+ class Bar {};
7317
7303
// Message: Tag @extends must have either a type or namepath
7318
7304
7319
7305
/**
7320
- * @type
7321
- */
7322
- let foo;
7306
+ * @type
7307
+ */
7308
+ let foo;
7323
7309
// Message: Tag @type must have a type
7324
7310
````
7325
7311
@@ -7419,23 +7405,23 @@ function quux() {
7419
7405
}
7420
7406
7421
7407
/**
7422
- * @constant {string}
7423
- */
7424
- const FOO = ' foo' ;
7408
+ * @constant {string}
7409
+ */
7410
+ const FOO = ' foo' ;
7425
7411
7426
7412
/**
7427
- * @extends Foo
7428
- */
7429
- class Bar {};
7413
+ * @extends Foo
7414
+ */
7415
+ class Bar {};
7430
7416
7431
7417
/**
7432
- * @extends {Foo<String>}
7433
- */
7434
- class Bar {};
7418
+ * @extends {Foo<String>}
7419
+ */
7420
+ class Bar {};
7435
7421
7436
7422
/**
7437
- * @typedef {number|string} UserDefinedType
7438
- */
7423
+ * @typedef {number|string} UserDefinedType
7424
+ */
7439
7425
7440
7426
/**
7441
7427
* @typedef {number|string}
0 commit comments