@@ -27,6 +27,7 @@ JSDoc linting rules for ESLint.
27
27
* [ ` check-syntax ` ] ( #eslint-plugin-jsdoc-rules-check-syntax )
28
28
* [ ` check-tag-names ` ] ( #eslint-plugin-jsdoc-rules-check-tag-names )
29
29
* [ ` check-types ` ] ( #eslint-plugin-jsdoc-rules-check-types )
30
+ * [ ` check-values ` ] ( #eslint-plugin-jsdoc-rules-check-values )
30
31
* [ ` empty-tags ` ] ( #eslint-plugin-jsdoc-rules-empty-tags )
31
32
* [ ` implements-on-classes ` ] ( #eslint-plugin-jsdoc-rules-implements-on-classes )
32
33
* [ ` match-description ` ] ( #eslint-plugin-jsdoc-rules-match-description )
@@ -3126,6 +3127,177 @@ var subscribe = function(callback) {};
3126
3127
````
3127
3128
3128
3129
3130
+ <a name =" eslint-plugin-jsdoc-rules-check-values " ></a >
3131
+ ### <code >check-values</code >
3132
+
3133
+ This rule checks the values for a handful of tags:
3134
+
3135
+ 1 . ` @version ` - Checks that there is a present and valid
3136
+ [ semver] ( https://semver.org/ ) version value.
3137
+ 2 . ` @since ` - As with ` @version `
3138
+ 3 . ` @license ` - Checks that there is a present and valid SPDX identifier
3139
+ or is present within an ` allowedLicenses ` option.
3140
+ 4 . ` @author ` - Checks there is a value present, and if the option
3141
+ ` allowedAuthors ` is present, ensure that the author value is one
3142
+ of these array items.
3143
+
3144
+ <a name =" eslint-plugin-jsdoc-rules-check-values-options-5 " ></a >
3145
+ #### Options
3146
+
3147
+ <a name =" eslint-plugin-jsdoc-rules-check-values-options-5-allowedauthors " ></a >
3148
+ ##### <code >allowedAuthors</code >
3149
+
3150
+ An array of allowable author values. If absent, only non-whitespace will
3151
+ be checked for.
3152
+
3153
+ <a name =" eslint-plugin-jsdoc-rules-check-values-options-5-allowedlicenses " ></a >
3154
+ ##### <code >allowedLicenses</code >
3155
+
3156
+ An array of allowable license values or ` true ` to allow any license text.
3157
+ If present as an array, will be used in place of SPDX identifiers.
3158
+
3159
+ |||
3160
+ | ---| ---|
3161
+ | Context| everywhere|
3162
+ | Tags| ` @version ` , ` @since ` , ` @license ` , ` @author ` |
3163
+ | Options| ` allowedAuthors ` , ` allowedLicenses ` |
3164
+ | Settings| ` tagNamePreference ` |
3165
+
3166
+ The following patterns are considered problems:
3167
+
3168
+ ```` js
3169
+ /**
3170
+ * @version
3171
+ */
3172
+ function quux (foo ) {
3173
+
3174
+ }
3175
+ // Message: Missing JSDoc @version.
3176
+
3177
+ /**
3178
+ * @version 3.1
3179
+ */
3180
+ function quux (foo ) {
3181
+
3182
+ }
3183
+ // Message: Invalid JSDoc @version: "3.1".
3184
+
3185
+ /**
3186
+ * @since
3187
+ */
3188
+ function quux (foo ) {
3189
+
3190
+ }
3191
+ // Message: Missing JSDoc @since.
3192
+
3193
+ /**
3194
+ * @since 3.1
3195
+ */
3196
+ function quux (foo ) {
3197
+
3198
+ }
3199
+ // Message: Invalid JSDoc @since: "3.1".
3200
+
3201
+ /**
3202
+ * @license
3203
+ */
3204
+ function quux (foo ) {
3205
+
3206
+ }
3207
+ // Message: Missing JSDoc @license.
3208
+
3209
+ /**
3210
+ * @license FOO
3211
+ */
3212
+ function quux (foo ) {
3213
+
3214
+ }
3215
+ // Message: Invalid JSDoc @license: "FOO"; expected SPDX identifier: https://spdx.org/licenses/.
3216
+
3217
+ /**
3218
+ * @license FOO
3219
+ */
3220
+ function quux (foo ) {
3221
+
3222
+ }
3223
+ // Options: [{"allowedLicenses":["BAR","BAX"]}]
3224
+ // Message: Invalid JSDoc @license: "FOO"; expected one of BAR, BAX.
3225
+
3226
+ /**
3227
+ * @author
3228
+ */
3229
+ function quux (foo ) {
3230
+
3231
+ }
3232
+ // Message: Missing JSDoc @author.
3233
+
3234
+ /**
3235
+ * @author Brett Zamir
3236
+ */
3237
+ function quux (foo ) {
3238
+
3239
+ }
3240
+ // Options: [{"allowedAuthors":["Gajus Kuizinas","golopot"]}]
3241
+ // Message: Invalid JSDoc @author: "Brett Zamir"; expected one of Gajus Kuizinas, golopot.
3242
+ ````
3243
+
3244
+ The following patterns are not considered problems:
3245
+
3246
+ ```` js
3247
+ /**
3248
+ * @version 3.4.1
3249
+ */
3250
+ function quux (foo ) {
3251
+
3252
+ }
3253
+
3254
+ /**
3255
+ * @since 3.4.1
3256
+ */
3257
+ function quux (foo ) {
3258
+
3259
+ }
3260
+
3261
+ /**
3262
+ * @license MIT
3263
+ */
3264
+ function quux (foo ) {
3265
+
3266
+ }
3267
+
3268
+ /**
3269
+ * @license FOO
3270
+ */
3271
+ function quux (foo ) {
3272
+
3273
+ }
3274
+ // Options: [{"allowedLicenses":["FOO","BAR","BAX"]}]
3275
+
3276
+ /**
3277
+ * @license FOO
3278
+ */
3279
+ function quux (foo ) {
3280
+
3281
+ }
3282
+ // Options: [{"allowedLicenses":true}]
3283
+
3284
+ /**
3285
+ * @author Gajus Kuizinas
3286
+ */
3287
+ function quux (foo ) {
3288
+
3289
+ }
3290
+
3291
+ /**
3292
+ * @author Brett Zamir
3293
+ */
3294
+ function quux (foo ) {
3295
+
3296
+ }
3297
+ // Options: [{"allowedAuthors":["Gajus Kuizinas","golopot","Brett Zamir"]}]
3298
+ ````
3299
+
3300
+
3129
3301
<a name =" eslint-plugin-jsdoc-rules-empty-tags " ></a >
3130
3302
### <code >empty-tags</code >
3131
3303
@@ -3152,10 +3324,10 @@ is set to "closure" (which allows types).
3152
3324
- ` @public `
3153
3325
- ` @static `
3154
3326
3155
- <a name =" eslint-plugin-jsdoc-rules-empty-tags-options-5 " ></a >
3327
+ <a name =" eslint-plugin-jsdoc-rules-empty-tags-options-6 " ></a >
3156
3328
#### Options
3157
3329
3158
- <a name =" eslint-plugin-jsdoc-rules-empty-tags-options-5 -tags " ></a >
3330
+ <a name =" eslint-plugin-jsdoc-rules-empty-tags-options-6 -tags " ></a >
3159
3331
##### <code >tags</code >
3160
3332
3161
3333
If you want additional tags to be checked for their descriptions, you may
@@ -3370,10 +3542,10 @@ by our supported Node versions):
3370
3542
Applies to the jsdoc block description and ` @description ` (or ` @desc ` )
3371
3543
by default but the ` tags ` option (see below) may be used to match other tags.
3372
3544
3373
- <a name =" eslint-plugin-jsdoc-rules-match-description-options-6 " ></a >
3545
+ <a name =" eslint-plugin-jsdoc-rules-match-description-options-7 " ></a >
3374
3546
#### Options
3375
3547
3376
- <a name =" eslint-plugin-jsdoc-rules-match-description-options-6 -matchdescription " ></a >
3548
+ <a name =" eslint-plugin-jsdoc-rules-match-description-options-7 -matchdescription " ></a >
3377
3549
##### <code >matchDescription</code >
3378
3550
3379
3551
You can supply your own expression to override the default, passing a
@@ -3388,7 +3560,7 @@ You can supply your own expression to override the default, passing a
3388
3560
As with the default, the supplied regular expression will be applied with the
3389
3561
Unicode (` "u" ` ) flag and is * not* case-insensitive.
3390
3562
3391
- <a name =" eslint-plugin-jsdoc-rules-match-description-options-6 -tags-1 " ></a >
3563
+ <a name =" eslint-plugin-jsdoc-rules-match-description-options-7 -tags-1 " ></a >
3392
3564
##### <code >tags</code >
3393
3565
3394
3566
If you want different regular expressions to apply to tags, you may use
@@ -3425,7 +3597,7 @@ its "description" (e.g., for `@returns {someType} some description`, the
3425
3597
description is ` some description ` while for ` @some-tag xyz ` , the description
3426
3598
is ` xyz ` ).
3427
3599
3428
- <a name =" eslint-plugin-jsdoc-rules-match-description-options-6 -maindescription " ></a >
3600
+ <a name =" eslint-plugin-jsdoc-rules-match-description-options-7 -maindescription " ></a >
3429
3601
##### <code >mainDescription</code >
3430
3602
3431
3603
If you wish to override the main function description without changing the
@@ -3447,7 +3619,7 @@ There is no need to add `mainDescription: true`, as by default, the main
3447
3619
function (and only the main function) is linted, though you may disable checking
3448
3620
it by setting it to ` false ` .
3449
3621
3450
- <a name =" eslint-plugin-jsdoc-rules-match-description-options-6 -contexts " ></a >
3622
+ <a name =" eslint-plugin-jsdoc-rules-match-description-options-7 -contexts " ></a >
3451
3623
##### <code >contexts</code >
3452
3624
3453
3625
Set this to an array of strings representing the AST context
@@ -4067,7 +4239,7 @@ function quux () {
4067
4239
4068
4240
Enforces a consistent padding of the block description.
4069
4241
4070
- <a name =" eslint-plugin-jsdoc-rules-newline-after-description-options-7 " ></a >
4242
+ <a name =" eslint-plugin-jsdoc-rules-newline-after-description-options-8 " ></a >
4071
4243
#### Options
4072
4244
4073
4245
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" ` .
@@ -4251,7 +4423,7 @@ The following types are always considered defined.
4251
4423
Note that preferred types indicated within ` settings.jsdoc.preferredTypes ` will
4252
4424
also be assumed to be defined.
4253
4425
4254
- <a name =" eslint-plugin-jsdoc-rules-no-undefined-types-options-8 " ></a >
4426
+ <a name =" eslint-plugin-jsdoc-rules-no-undefined-types-options-9 " ></a >
4255
4427
#### Options
4256
4428
4257
4429
An option object may have the following key:
@@ -4633,10 +4805,10 @@ tag descriptions are written in complete sentences, i.e.,
4633
4805
* A colon or semi-colon followed by two line breaks is still part of the
4634
4806
containing paragraph (unlike normal dual line breaks).
4635
4807
4636
- <a name =" eslint-plugin-jsdoc-rules-require-description-complete-sentence-options-9 " ></a >
4808
+ <a name =" eslint-plugin-jsdoc-rules-require-description-complete-sentence-options-10 " ></a >
4637
4809
#### Options
4638
4810
4639
- <a name =" eslint-plugin-jsdoc-rules-require-description-complete-sentence-options-9 -tags-2 " ></a >
4811
+ <a name =" eslint-plugin-jsdoc-rules-require-description-complete-sentence-options-10 -tags-2 " ></a >
4640
4812
##### <code >tags</code >
4641
4813
4642
4814
If you want additional tags to be checked for their descriptions, you may
@@ -5108,7 +5280,7 @@ Requires that all functions have a description.
5108
5280
` "tag" ` ) must have a non-empty description that explains the purpose of the
5109
5281
method.
5110
5282
5111
- <a name =" eslint-plugin-jsdoc-rules-require-description-options-10 " ></a >
5283
+ <a name =" eslint-plugin-jsdoc-rules-require-description-options-11 " ></a >
5112
5284
#### Options
5113
5285
5114
5286
An options object may have any of the following properties:
@@ -5393,25 +5565,25 @@ Requires that all functions have examples.
5393
5565
* All functions must have one or more ` @example ` tags.
5394
5566
* Every example tag must have a non-empty description that explains the method's usage.
5395
5567
5396
- <a name =" eslint-plugin-jsdoc-rules-require-example-options-11 " ></a >
5568
+ <a name =" eslint-plugin-jsdoc-rules-require-example-options-12 " ></a >
5397
5569
#### Options
5398
5570
5399
5571
This rule has an object option.
5400
5572
5401
- <a name =" eslint-plugin-jsdoc-rules-require-example-options-11 -exemptedby " ></a >
5573
+ <a name =" eslint-plugin-jsdoc-rules-require-example-options-12 -exemptedby " ></a >
5402
5574
##### <code >exemptedBy</code >
5403
5575
5404
5576
Array of tags (e.g., ` ['type'] ` ) whose presence on the document
5405
5577
block avoids the need for an ` @example ` . Defaults to an empty array.
5406
5578
5407
- <a name =" eslint-plugin-jsdoc-rules-require-example-options-11 -avoidexampleonconstructors " ></a >
5579
+ <a name =" eslint-plugin-jsdoc-rules-require-example-options-12 -avoidexampleonconstructors " ></a >
5408
5580
##### <code >avoidExampleOnConstructors</code >
5409
5581
5410
5582
Set to ` true ` to avoid the need for an example on a constructor (whether
5411
5583
indicated as such by a jsdoc tag or by being within an ES6 ` class ` ).
5412
5584
Defaults to ` false ` .
5413
5585
5414
- <a name =" eslint-plugin-jsdoc-rules-require-example-options-11 -contexts-1 " ></a >
5586
+ <a name =" eslint-plugin-jsdoc-rules-require-example-options-12 -contexts-1 " ></a >
5415
5587
##### <code >contexts</code >
5416
5588
5417
5589
Set this to an array of strings representing the AST context
@@ -5589,7 +5761,7 @@ function quux () {
5589
5761
5590
5762
Requires a hyphen before the ` @param ` description.
5591
5763
5592
- <a name =" eslint-plugin-jsdoc-rules-require-hyphen-before-param-description-options-12 " ></a >
5764
+ <a name =" eslint-plugin-jsdoc-rules-require-hyphen-before-param-description-options-13 " ></a >
5593
5765
#### Options
5594
5766
5595
5767
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" ` .
@@ -5695,7 +5867,7 @@ function quux () {
5695
5867
Checks for presence of jsdoc comments, on class declarations as well as
5696
5868
functions.
5697
5869
5698
- <a name =" eslint-plugin-jsdoc-rules-require-jsdoc-options-13 " ></a >
5870
+ <a name =" eslint-plugin-jsdoc-rules-require-jsdoc-options-14 " ></a >
5699
5871
#### Options
5700
5872
5701
5873
Accepts one optional options object with the following optional keys.
@@ -6883,7 +7055,7 @@ function quux (foo) {
6883
7055
6884
7056
Requires that all function parameters are documented.
6885
7057
6886
- <a name =" eslint-plugin-jsdoc-rules-require-param-options-14 " ></a >
7058
+ <a name =" eslint-plugin-jsdoc-rules-require-param-options-15 " ></a >
6887
7059
#### Options
6888
7060
6889
7061
An options object accepts one optional property:
@@ -7956,7 +8128,7 @@ Requires returns are documented.
7956
8128
7957
8129
Will also report if multiple ` @returns ` tags are present.
7958
8130
7959
- <a name =" eslint-plugin-jsdoc-rules-require-returns-options-15 " ></a >
8131
+ <a name =" eslint-plugin-jsdoc-rules-require-returns-options-16 " ></a >
7960
8132
#### Options
7961
8133
7962
8134
- ` exemptedBy ` - Array of tags (e.g., ` ['type'] ` ) whose presence on the document
@@ -8421,7 +8593,7 @@ Also impacts behaviors on namepath (or event)-defining and pointing tags:
8421
8593
allow ` # ` , ` . ` , or ` ~ ` at the end (which is not allowed at the end of
8422
8594
normal paths).
8423
8595
8424
- <a name =" eslint-plugin-jsdoc-rules-valid-types-options-16 " ></a >
8596
+ <a name =" eslint-plugin-jsdoc-rules-valid-types-options-17 " ></a >
8425
8597
#### Options
8426
8598
8427
8599
- ` allowEmptyNamepaths ` (default: true) - Set to ` false ` to disallow
0 commit comments