@@ -24,6 +24,7 @@ JSDoc linting rules for ESLint.
24
24
* [ ` check-examples ` ] ( #eslint-plugin-jsdoc-rules-check-examples )
25
25
* [ ` check-indentation ` ] ( #eslint-plugin-jsdoc-rules-check-indentation )
26
26
* [ ` check-param-names ` ] ( #eslint-plugin-jsdoc-rules-check-param-names )
27
+ * [ ` check-property-names ` ] ( #eslint-plugin-jsdoc-rules-check-property-names )
27
28
* [ ` check-syntax ` ] ( #eslint-plugin-jsdoc-rules-check-syntax )
28
29
* [ ` check-tag-names ` ] ( #eslint-plugin-jsdoc-rules-check-tag-names )
29
30
* [ ` check-types ` ] ( #eslint-plugin-jsdoc-rules-check-types )
@@ -1728,6 +1729,121 @@ function quux ({
1728
1729
1729
1730
Likewise for the pattern ` [a, b] ` which is an [ ` ArrayPattern ` ] ( https://github.com/estree/estree/blob/master/es2015.md#arraypattern ) .
1730
1731
1732
+ <a name =" eslint-plugin-jsdoc-rules-check-property-names " ></a >
1733
+ ### <code >check-property-names</code >
1734
+
1735
+ Ensures that property names in JSDoc are not duplicated on the same block
1736
+ and that nested properties have defined roots.
1737
+
1738
+ <a name =" eslint-plugin-jsdoc-rules-check-property-names-options-4 " ></a >
1739
+ #### Options
1740
+
1741
+ |||
1742
+ | ---| ---|
1743
+ | Context| Everywhere|
1744
+ | Tags| ` property ` |
1745
+
1746
+ The following patterns are considered problems:
1747
+
1748
+ ```` js
1749
+ /**
1750
+ * @typedef (SomeType) SomeTypedef
1751
+ * @property Foo.Bar
1752
+ */
1753
+ // Message: @property path declaration ("Foo.Bar") appears before any real property.
1754
+
1755
+ /**
1756
+ * @typedef (SomeType) SomeTypedef
1757
+ * @property foo
1758
+ * @property Foo.Bar
1759
+ */
1760
+ // Message: @property path declaration ("Foo.Bar") root node name ("Foo") does not match previous real property name ("foo").
1761
+
1762
+ /**
1763
+ * @typedef (SomeType) SomeTypedef
1764
+ * @property foo
1765
+ * @property foo
1766
+ */
1767
+ // Message: Duplicate @property "foo"
1768
+
1769
+ /**
1770
+ * @typedef (SomeType) SomeTypedef
1771
+ * @prop foo
1772
+ * @prop foo
1773
+ */
1774
+ // Settings: {"jsdoc":{"tagNamePreference":{"property":"prop"}}}
1775
+ // Message: Duplicate @prop "foo"
1776
+
1777
+ /**
1778
+ * @typedef (SomeType) SomeTypedef
1779
+ * @property foo
1780
+ */
1781
+ // Settings: {"jsdoc":{"tagNamePreference":{"property":false}}}
1782
+ // Message: Unexpected tag `@property`
1783
+ ````
1784
+
1785
+ The following patterns are not considered problems:
1786
+
1787
+ ```` js
1788
+ /**
1789
+ *
1790
+ */
1791
+
1792
+ /**
1793
+ * @typedef (SomeType) SomeTypedef
1794
+ * @property foo
1795
+ */
1796
+
1797
+ /**
1798
+ * @typedef (SomeType) SomeTypedef
1799
+ * @prop foo
1800
+ */
1801
+
1802
+ /**
1803
+ * @typedef (SomeType) SomeTypedef
1804
+ * @property foo
1805
+ * @property bar
1806
+ */
1807
+
1808
+ /**
1809
+ * @typedef (SomeType) SomeTypedef
1810
+ * @property foo
1811
+ * @property foo.foo
1812
+ * @property bar
1813
+ */
1814
+
1815
+ /**
1816
+ * Assign the project to a list of employees.
1817
+ * @typedef (SomeType) SomeTypedef
1818
+ * @property {object[]} employees - The employees who are responsible for the project.
1819
+ * @property {string} employees[].name - The name of an employee.
1820
+ * @property {string} employees[].department - The employee's department.
1821
+ */
1822
+
1823
+ /**
1824
+ * @typedef (SomeType) SomeTypedef
1825
+ * @property {Error} error Exit code
1826
+ * @property {number} [code = 1 ] Exit code
1827
+ */
1828
+
1829
+ /**
1830
+ * @namespace (SomeType) SomeNamespace
1831
+ * @property {Error} error Exit code
1832
+ * @property {number} [code = 1 ] Exit code
1833
+ */
1834
+
1835
+ /**
1836
+ * @class
1837
+ * @property {Error} error Exit code
1838
+ * @property {number} [code = 1 ] Exit code
1839
+ */
1840
+ function quux (code = 1 ) {
1841
+ this .error = new Error (' oops' );
1842
+ this .code = code;
1843
+ }
1844
+ ````
1845
+
1846
+
1731
1847
<a name =" eslint-plugin-jsdoc-rules-check-syntax " ></a >
1732
1848
### <code >check-syntax</code >
1733
1849
@@ -1926,10 +2042,10 @@ wizaction
1926
2042
1927
2043
Note that the tags indicated as replacements in ` settings.jsdoc.tagNamePreference ` will automatically be considered as valid.
1928
2044
1929
- <a name =" eslint-plugin-jsdoc-rules-check-tag-names-options-4 " ></a >
2045
+ <a name =" eslint-plugin-jsdoc-rules-check-tag-names-options-5 " ></a >
1930
2046
#### Options
1931
2047
1932
- <a name =" eslint-plugin-jsdoc-rules-check-tag-names-options-4 -definedtags " ></a >
2048
+ <a name =" eslint-plugin-jsdoc-rules-check-tag-names-options-5 -definedtags " ></a >
1933
2049
##### <code >definedTags</code >
1934
2050
1935
2051
Use an array of ` definedTags ` strings to configure additional, allowed tags.
@@ -2529,7 +2645,7 @@ Date
2529
2645
RegExp
2530
2646
```
2531
2647
2532
- <a name =" eslint-plugin-jsdoc-rules-check-types-options-5 " ></a >
2648
+ <a name =" eslint-plugin-jsdoc-rules-check-types-options-6 " ></a >
2533
2649
#### Options
2534
2650
2535
2651
` check-types ` allows one option:
@@ -3416,22 +3532,22 @@ This rule checks the values for a handful of tags:
3416
3532
` allowedAuthors ` is present, ensure that the author value is one
3417
3533
of these array items.
3418
3534
3419
- <a name =" eslint-plugin-jsdoc-rules-check-values-options-6 " ></a >
3535
+ <a name =" eslint-plugin-jsdoc-rules-check-values-options-7 " ></a >
3420
3536
#### Options
3421
3537
3422
- <a name =" eslint-plugin-jsdoc-rules-check-values-options-6 -allowedauthors " ></a >
3538
+ <a name =" eslint-plugin-jsdoc-rules-check-values-options-7 -allowedauthors " ></a >
3423
3539
##### <code >allowedAuthors</code >
3424
3540
3425
3541
An array of allowable author values. If absent, only non-whitespace will
3426
3542
be checked for.
3427
3543
3428
- <a name =" eslint-plugin-jsdoc-rules-check-values-options-6 -allowedlicenses " ></a >
3544
+ <a name =" eslint-plugin-jsdoc-rules-check-values-options-7 -allowedlicenses " ></a >
3429
3545
##### <code >allowedLicenses</code >
3430
3546
3431
3547
An array of allowable license values or ` true ` to allow any license text.
3432
3548
If present as an array, will be used in place of SPDX identifiers.
3433
3549
3434
- <a name =" eslint-plugin-jsdoc-rules-check-values-options-6 -licensepattern " ></a >
3550
+ <a name =" eslint-plugin-jsdoc-rules-check-values-options-7 -licensepattern " ></a >
3435
3551
##### <code >licensePattern</code >
3436
3552
3437
3553
A string to be converted into a ` RegExp ` (with ` u ` flag) and whose first
@@ -3664,10 +3780,10 @@ Note that `@private` will still be checked for content by this rule even with
3664
3780
`settings.jsdoc.ignorePrivate` set to `true` (a setting which normally
3665
3781
causes rules not to take effect).
3666
3782
3667
- <a name=" eslint- plugin- jsdoc- rules- empty- tags- options- 7 " ></a>
3783
+ <a name=" eslint- plugin- jsdoc- rules- empty- tags- options- 8 " ></a>
3668
3784
#### Options
3669
3785
3670
- <a name=" eslint- plugin- jsdoc- rules- empty- tags- options- 7 - tags" ></a>
3786
+ <a name=" eslint- plugin- jsdoc- rules- empty- tags- options- 8 - tags" ></a>
3671
3787
##### <code>tags</code>
3672
3788
3673
3789
If you want additional tags to be checked for their descriptions, you may
@@ -3895,10 +4011,10 @@ by our supported Node versions):
3895
4011
Applies to the jsdoc block description and `@description` (or `@desc`)
3896
4012
by default but the `tags` option (see below) may be used to match other tags.
3897
4013
3898
- <a name=" eslint- plugin- jsdoc- rules- match- description- options- 8 " ></a>
4014
+ <a name=" eslint- plugin- jsdoc- rules- match- description- options- 9 " ></a>
3899
4015
#### Options
3900
4016
3901
- <a name=" eslint- plugin- jsdoc- rules- match- description- options- 8 - matchdescription" ></a>
4017
+ <a name=" eslint- plugin- jsdoc- rules- match- description- options- 9 - matchdescription" ></a>
3902
4018
##### <code>matchDescription</code>
3903
4019
3904
4020
You can supply your own expression to override the default, passing a
@@ -3913,7 +4029,7 @@ You can supply your own expression to override the default, passing a
3913
4029
As with the default, the supplied regular expression will be applied with the
3914
4030
Unicode (`" u" `) flag and is *not* case-insensitive.
3915
4031
3916
- <a name=" eslint- plugin- jsdoc- rules- match- description- options- 8 - tags- 1 " ></a>
4032
+ <a name=" eslint- plugin- jsdoc- rules- match- description- options- 9 - tags- 1 " ></a>
3917
4033
##### <code>tags</code>
3918
4034
3919
4035
If you want different regular expressions to apply to tags, you may use
@@ -3950,7 +4066,7 @@ its "description" (e.g., for `@returns {someType} some description`, the
3950
4066
description is `some description` while for `@some-tag xyz`, the description
3951
4067
is `xyz`).
3952
4068
3953
- <a name=" eslint- plugin- jsdoc- rules- match- description- options- 8 - maindescription" ></a>
4069
+ <a name=" eslint- plugin- jsdoc- rules- match- description- options- 9 - maindescription" ></a>
3954
4070
##### <code>mainDescription</code>
3955
4071
3956
4072
If you wish to override the main function description without changing the
@@ -3972,7 +4088,7 @@ There is no need to add `mainDescription: true`, as by default, the main
3972
4088
function (and only the main function) is linted, though you may disable checking
3973
4089
it by setting it to `false`.
3974
4090
3975
- <a name=" eslint- plugin- jsdoc- rules- match- description- options- 8 - contexts" ></a>
4091
+ <a name=" eslint- plugin- jsdoc- rules- match- description- options- 9 - contexts" ></a>
3976
4092
##### <code>contexts</code>
3977
4093
3978
4094
Set this to an array of strings representing the AST context
@@ -4616,7 +4732,7 @@ function quux () {
4616
4732
4617
4733
Enforces a consistent padding of the block description.
4618
4734
4619
- <a name=" eslint- plugin- jsdoc- rules- newline- after- description- options- 9 " ></a>
4735
+ <a name=" eslint- plugin- jsdoc- rules- newline- after- description- options- 10 " ></a>
4620
4736
#### Options
4621
4737
4622
4738
This rule allows one optional string argument. If it is `" always" ` then a problem is raised when there is no newline after the description. If it is `" never" ` then a problem is raised when there is a newline after the description. The default value is `" always" `.
@@ -4887,7 +5003,7 @@ The following types are always considered defined.
4887
5003
Note that preferred types indicated within `settings.jsdoc.preferredTypes` will
4888
5004
also be assumed to be defined.
4889
5005
4890
- <a name=" eslint- plugin- jsdoc- rules- no- undefined - types- options- 10 " ></a>
5006
+ <a name=" eslint- plugin- jsdoc- rules- no- undefined - types- options- 11 " ></a>
4891
5007
#### Options
4892
5008
4893
5009
An option object may have the following key:
@@ -5316,10 +5432,10 @@ tag descriptions are written in complete sentences, i.e.,
5316
5432
* Periods after items within the `abbreviations` option array are not treated
5317
5433
as sentence endings.
5318
5434
5319
- <a name=" eslint- plugin- jsdoc- rules- require- description- complete- sentence- options- 11 " ></a>
5435
+ <a name=" eslint- plugin- jsdoc- rules- require- description- complete- sentence- options- 12 " ></a>
5320
5436
#### Options
5321
5437
5322
- <a name=" eslint- plugin- jsdoc- rules- require- description- complete- sentence- options- 11 - tags- 2 " ></a>
5438
+ <a name=" eslint- plugin- jsdoc- rules- require- description- complete- sentence- options- 12 - tags- 2 " ></a>
5323
5439
##### <code>tags</code>
5324
5440
5325
5441
If you want additional tags to be checked for their descriptions, you may
@@ -5341,7 +5457,7 @@ its "description" (e.g., for `@returns {someType} some description`, the
5341
5457
description is `some description` while for `@some-tag xyz`, the description
5342
5458
is `xyz`).
5343
5459
5344
- <a name=" eslint- plugin- jsdoc- rules- require- description- complete- sentence- options- 11 - abbreviations" ></a>
5460
+ <a name=" eslint- plugin- jsdoc- rules- require- description- complete- sentence- options- 12 - abbreviations" ></a>
5345
5461
##### <code>abbreviations</code>
5346
5462
5347
5463
You can provide an `abbreviations` options array to avoid such strings of text
@@ -5973,7 +6089,7 @@ Requires that all functions have a description.
5973
6089
`" tag" `) must have a non-empty description that explains the purpose of the
5974
6090
method.
5975
6091
5976
- <a name=" eslint- plugin- jsdoc- rules- require- description- options- 12 " ></a>
6092
+ <a name=" eslint- plugin- jsdoc- rules- require- description- options- 13 " ></a>
5977
6093
#### Options
5978
6094
5979
6095
An options object may have any of the following properties:
@@ -6269,25 +6385,25 @@ Requires that all functions have examples.
6269
6385
* All functions must have one or more `@example` tags.
6270
6386
* Every example tag must have a non-empty description that explains the method's usage.
6271
6387
6272
- <a name=" eslint- plugin- jsdoc- rules- require- example- options- 13 " ></a>
6388
+ <a name=" eslint- plugin- jsdoc- rules- require- example- options- 14 " ></a>
6273
6389
#### Options
6274
6390
6275
6391
This rule has an object option.
6276
6392
6277
- <a name=" eslint- plugin- jsdoc- rules- require- example- options- 13 - exemptedby" ></a>
6393
+ <a name=" eslint- plugin- jsdoc- rules- require- example- options- 14 - exemptedby" ></a>
6278
6394
##### <code>exemptedBy</code>
6279
6395
6280
6396
Array of tags (e.g., `['type']`) whose presence on the document
6281
6397
block avoids the need for an `@example`. Defaults to an empty array.
6282
6398
6283
- <a name=" eslint- plugin- jsdoc- rules- require- example- options- 13 - avoidexampleonconstructors" ></a>
6399
+ <a name=" eslint- plugin- jsdoc- rules- require- example- options- 14 - avoidexampleonconstructors" ></a>
6284
6400
##### <code>avoidExampleOnConstructors</code>
6285
6401
6286
6402
Set to `true` to avoid the need for an example on a constructor (whether
6287
6403
indicated as such by a jsdoc tag or by being within an ES6 `class`).
6288
6404
Defaults to `false`.
6289
6405
6290
- <a name=" eslint- plugin- jsdoc- rules- require- example- options- 13 - contexts- 1 " ></a>
6406
+ <a name=" eslint- plugin- jsdoc- rules- require- example- options- 14 - contexts- 1 " ></a>
6291
6407
##### <code>contexts</code>
6292
6408
6293
6409
Set this to an array of strings representing the AST context
@@ -6612,7 +6728,7 @@ function quux () {
6612
6728
6613
6729
Requires a hyphen before the `@param` description.
6614
6730
6615
- <a name="eslint-plugin-jsdoc-rules-require-hyphen-before-param-description-options-14 "></a>
6731
+ <a name="eslint-plugin-jsdoc-rules-require-hyphen-before-param-description-options-15 "></a>
6616
6732
#### Options
6617
6733
6618
6734
This rule takes one optional string argument. If it is `"always"` then a problem is raised when there is no hyphen before the description. If it is `"never"` then a problem is raised when there is a hyphen before the description. The default value is `"always"`.
@@ -6718,7 +6834,7 @@ function quux () {
6718
6834
Checks for presence of jsdoc comments, on class declarations as well as
6719
6835
functions.
6720
6836
6721
- <a name="eslint-plugin-jsdoc-rules-require-jsdoc-options-15 "></a>
6837
+ <a name="eslint-plugin-jsdoc-rules-require-jsdoc-options-16 "></a>
6722
6838
#### Options
6723
6839
6724
6840
Accepts one optional options object with the following optional keys.
@@ -7919,7 +8035,7 @@ function quux (foo) {
7919
8035
7920
8036
Requires that all function parameters are documented.
7921
8037
7922
- <a name="eslint-plugin-jsdoc-rules-require-param-options-16 "></a>
8038
+ <a name="eslint-plugin-jsdoc-rules-require-param-options-17 "></a>
7923
8039
#### Options
7924
8040
7925
8041
An options object accepts one optional property:
@@ -9308,7 +9424,7 @@ Requires returns are documented.
9308
9424
9309
9425
Will also report if multiple ` @returns` tags are present.
9310
9426
9311
- < a name= " eslint-plugin-jsdoc-rules-require-returns-options-17 " >< / a>
9427
+ < a name= " eslint-plugin-jsdoc-rules-require-returns-options-18 " >< / a>
9312
9428
#### Options
9313
9429
9314
9430
- ` exemptedBy` - Array of tags (e .g ., ` ['type']` ) whose presence on the document
@@ -9810,7 +9926,7 @@ Also impacts behaviors on namepath (or event)-defining and pointing tags:
9810
9926
allow `#`, `.`, or `~` at the end (which is not allowed at the end of
9811
9927
normal paths).
9812
9928
9813
- <a name="eslint-plugin-jsdoc-rules-valid-types-options-18 "></a>
9929
+ <a name="eslint-plugin-jsdoc-rules-valid-types-options-19 "></a>
9814
9930
#### Options
9815
9931
9816
9932
- `allowEmptyNamepaths` (default: true) - Set to `false` to disallow
0 commit comments