@@ -16,7 +16,6 @@ JSDoc linting rules for ESLint.
16
16
* [ Allow ` @private ` to disable rules for that comment block] ( #eslint-plugin-jsdoc-settings-allow-private-to-disable-rules-for-that-comment-block )
17
17
* [ Exempting empty functions from ` require-jsdoc ` ] ( #eslint-plugin-jsdoc-settings-exempting-empty-functions-from-require-jsdoc )
18
18
* [ Alias Preference] ( #eslint-plugin-jsdoc-settings-alias-preference )
19
- * [ Additional Tag Names] ( #eslint-plugin-jsdoc-settings-additional-tag-names )
20
19
* [ ` @override ` /` @augments ` /` @extends ` /` @implements ` Without Accompanying ` @param ` /` @description ` /` @example ` /` @returns ` ] ( #eslint-plugin-jsdoc-settings-override-augments-extends-implements-without-accompanying-param-description-example-returns )
21
20
* [ Settings to Configure ` check-types ` and ` no-undefined-types ` ] ( #eslint-plugin-jsdoc-settings-settings-to-configure-check-types-and-no-undefined-types )
22
21
* [ Settings to Configure ` valid-types ` ] ( #eslint-plugin-jsdoc-settings-settings-to-configure-valid-types )
@@ -249,6 +248,8 @@ Or one may set the targeted tag to an object with a custom `message`, but withou
249
248
}
250
249
```
251
250
251
+ Note that the preferred tags indicated in the ` settings.jsdoc.tagNamePreference `
252
+ map will be assumed to be defined by ` check-tag-names ` .
252
253
253
254
The defaults in ` eslint-plugin-jsdoc ` (for tags which offer
254
255
aliases) are as follows:
@@ -286,25 +287,6 @@ This setting is utilized by the the rule for tag name checking
286
287
- ` require-returns-description `
287
288
- ` require-returns-type `
288
289
289
- <a name =" eslint-plugin-jsdoc-settings-additional-tag-names " ></a >
290
- ### Additional Tag Names
291
-
292
- Use ` settings.jsdoc.additionalTagNames ` to configure additional, allowed JSDoc
293
- tags in the rule ` check-tag-names ` . The format of the configuration is as follows:
294
-
295
- ``` json
296
- {
297
- "rules" : {},
298
- "settings" : {
299
- "jsdoc" : {
300
- "additionalTagNames" : {
301
- "customTags" : [" define" , " record" ]
302
- }
303
- }
304
- }
305
- }
306
- ```
307
-
308
290
<a name =" eslint-plugin-jsdoc-settings-override-augments-extends-implements-without-accompanying-param-description-example-returns " ></a >
309
291
### <code >@override </code >/<code >@augments </code >/<code >@extends </code >/<code >@implements </code > Without Accompanying <code >@param </code >/<code >@description </code >/<code >@example </code >/<code >@returns </code >
310
292
@@ -1249,11 +1231,29 @@ version
1249
1231
yields
1250
1232
```
1251
1233
1234
+ Note that the tags indicated as replacements in ` settings.jsdoc.tagNamePreference ` will automatically be considered as valid.
1235
+
1236
+ <a name =" eslint-plugin-jsdoc-rules-check-tag-names-options " ></a >
1237
+ #### Options
1238
+
1239
+ <a name =" eslint-plugin-jsdoc-rules-check-tag-names-options-definedtags " ></a >
1240
+ ##### <code >definedTags</code >
1241
+
1242
+ Use an array of ` definedTags ` strings to configure additional, allowed JSDoc tags.
1243
+ The format is as follows:
1244
+
1245
+ ``` json
1246
+ {
1247
+ "definedTags" : [" define" , " record" ]
1248
+ }
1249
+ ```
1250
+
1252
1251
|||
1253
1252
| ---| ---|
1254
1253
| Context| everywhere|
1255
1254
| Tags| N/A|
1256
- | Settings| ` tagNamePreference ` , ` additionalTagNames ` |
1255
+ | Options| ` definedTags ` |
1256
+ | Settings| ` tagNamePreference ` |
1257
1257
1258
1258
The following patterns are considered problems:
1259
1259
@@ -1327,7 +1327,7 @@ function quux (foo) {
1327
1327
function quux (foo ) {
1328
1328
1329
1329
}
1330
- // Settings: {"jsdoc":{"additionalTagNames":{"customTags": ["bar"]}}}
1330
+ // Options: [{"definedTags": ["bar"]}]
1331
1331
// Message: Invalid JSDoc tag name "baz".
1332
1332
1333
1333
/**
@@ -1337,7 +1337,7 @@ function quux (foo) {
1337
1337
function quux (foo ) {
1338
1338
1339
1339
}
1340
- // Settings: {"jsdoc":{"additionalTagNames":{"customTags": ["bar"]}}}
1340
+ // Options: [{"definedTags": ["bar"]}]
1341
1341
// Message: Invalid JSDoc tag name "baz".
1342
1342
1343
1343
/**
@@ -1375,6 +1375,15 @@ function quux () {
1375
1375
}
1376
1376
// Settings: {"jsdoc":{"tagNamePreference":{"todo":{"message":"Please use x-todo instead of todo","replacement":"x-todo"}}}}
1377
1377
// Message: Please use x-todo instead of todo
1378
+
1379
+ /**
1380
+ * @todo
1381
+ */
1382
+ function quux () {
1383
+
1384
+ }
1385
+ // Settings: {"jsdoc":{"tagNamePreference":{"todo":55}}}
1386
+ // Message: Invalid `settings.jsdoc.tagNamePreference`. Values must be falsy, a string, or an object.
1378
1387
````
1379
1388
1380
1389
The following patterns are not considered problems:
@@ -1408,15 +1417,23 @@ function quux (foo) {
1408
1417
function quux (foo ) {
1409
1418
1410
1419
}
1411
- // Settings: {"jsdoc":{"additionalTagNames":{"customTags":["bar"]}}}
1420
+ // Options: [{"definedTags":["bar"]}]
1421
+
1422
+ /**
1423
+ * @baz @bar foo
1424
+ */
1425
+ function quux (foo ) {
1426
+
1427
+ }
1428
+ // Options: [{"definedTags":["baz","bar"]}]
1412
1429
1413
1430
/**
1414
1431
* @baz @bar foo
1415
1432
*/
1416
1433
function quux (foo ) {
1417
1434
1418
1435
}
1419
- // Settings: {"jsdoc":{"additionalTagNames ":{"customTags":[ "baz","bar"] }}}
1436
+ // Settings: {"jsdoc":{"tagNamePreference ":{"param": "baz","returns":{"message":"Prefer ` bar`","replacement":"bar"},"todo":false }}}
1420
1437
1421
1438
/**
1422
1439
* @abstract
@@ -1521,7 +1538,7 @@ Date
1521
1538
RegExp
1522
1539
```
1523
1540
1524
- <a name =" eslint-plugin-jsdoc-rules-check-types-options " ></a >
1541
+ <a name =" eslint-plugin-jsdoc-rules-check-types-options-1 " ></a >
1525
1542
#### Options
1526
1543
1527
1544
` check-types ` allows one option:
@@ -2402,10 +2419,10 @@ by our supported Node versions):
2402
2419
2403
2420
`` ^([A-Z]|[`\\d_])[\\s\\S]*[.?!`]$ ``
2404
2421
2405
- <a name =" eslint-plugin-jsdoc-rules-match-description-options-1 " ></a >
2422
+ <a name =" eslint-plugin-jsdoc-rules-match-description-options-2 " ></a >
2406
2423
#### Options
2407
2424
2408
- <a name =" eslint-plugin-jsdoc-rules-match-description-options-1 -matchdescription " ></a >
2425
+ <a name =" eslint-plugin-jsdoc-rules-match-description-options-2 -matchdescription " ></a >
2409
2426
##### <code >matchDescription</code >
2410
2427
2411
2428
You can supply your own expression to override the default, passing a
@@ -2420,7 +2437,7 @@ You can supply your own expression to override the default, passing a
2420
2437
As with the default, the supplied regular expression will be applied with the
2421
2438
Unicode (` "u" ` ) flag and is * not* case-insensitive.
2422
2439
2423
- <a name =" eslint-plugin-jsdoc-rules-match-description-options-1 -tags " ></a >
2440
+ <a name =" eslint-plugin-jsdoc-rules-match-description-options-2 -tags " ></a >
2424
2441
##### <code >tags</code >
2425
2442
2426
2443
If you want different regular expressions to apply to tags, you may use
@@ -2447,7 +2464,7 @@ tag should be linted with the `matchDescription` value (or the default).
2447
2464
}
2448
2465
```
2449
2466
2450
- <a name =" eslint-plugin-jsdoc-rules-match-description-options-1 -maindescription " ></a >
2467
+ <a name =" eslint-plugin-jsdoc-rules-match-description-options-2 -maindescription " ></a >
2451
2468
##### <code >mainDescription</code >
2452
2469
2453
2470
If you wish to override the main function description without changing the
@@ -2469,7 +2486,7 @@ There is no need to add `mainDescription: true`, as by default, the main
2469
2486
function (and only the main function) is linted, though you may disable checking
2470
2487
it by setting it to ` false ` .
2471
2488
2472
- <a name =" eslint-plugin-jsdoc-rules-match-description-options-1 -contexts " ></a >
2489
+ <a name =" eslint-plugin-jsdoc-rules-match-description-options-2 -contexts " ></a >
2473
2490
##### <code >contexts</code >
2474
2491
2475
2492
Set this to an array of strings representing the AST context
@@ -2915,7 +2932,7 @@ const q = {
2915
2932
2916
2933
Enforces a consistent padding of the block description.
2917
2934
2918
- <a name =" eslint-plugin-jsdoc-rules-newline-after-description-options-2 " ></a >
2935
+ <a name =" eslint-plugin-jsdoc-rules-newline-after-description-options-3 " ></a >
2919
2936
#### Options
2920
2937
2921
2938
This rule allows one optional string argument. If it is ` "always" ` then a problem is raised when there is a newline after the description. If it is ` "never" ` then a problem is raised when there is no newline after the description. The default value is ` "always" ` .
@@ -3075,7 +3092,7 @@ The following types are always considered defined.
3075
3092
- ` any ` , ` * `
3076
3093
- ` Array ` , ` Object ` , ` RegExp ` , ` Date ` , ` Function `
3077
3094
3078
- <a name =" eslint-plugin-jsdoc-rules-no-undefined-types-options-3 " ></a >
3095
+ <a name =" eslint-plugin-jsdoc-rules-no-undefined-types-options-4 " ></a >
3079
3096
#### Options
3080
3097
3081
3098
An option object may have the following keys:
@@ -3671,7 +3688,7 @@ Requires that all functions have a description.
3671
3688
* All functions must have a ` @description ` tag.
3672
3689
* Every description tag must have a non-empty description that explains the purpose of the method.
3673
3690
3674
- <a name =" eslint-plugin-jsdoc-rules-require-description-options-4 " ></a >
3691
+ <a name =" eslint-plugin-jsdoc-rules-require-description-options-5 " ></a >
3675
3692
#### Options
3676
3693
3677
3694
An options object may have any of the following properties:
@@ -3865,7 +3882,7 @@ Requires that all functions have examples.
3865
3882
* All functions must have one or more ` @example ` tags.
3866
3883
* Every example tag must have a non-empty description that explains the method's usage.
3867
3884
3868
- <a name =" eslint-plugin-jsdoc-rules-require-example-options-5 " ></a >
3885
+ <a name =" eslint-plugin-jsdoc-rules-require-example-options-6 " ></a >
3869
3886
#### Options
3870
3887
3871
3888
Has an object option with one optional property:
@@ -3996,7 +4013,7 @@ function quux () {
3996
4013
3997
4014
Requires a hyphen before the ` @param ` description.
3998
4015
3999
- <a name =" eslint-plugin-jsdoc-rules-require-hyphen-before-param-description-options-6 " ></a >
4016
+ <a name =" eslint-plugin-jsdoc-rules-require-hyphen-before-param-description-options-7 " ></a >
4000
4017
#### Options
4001
4018
4002
4019
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" ` .
@@ -4102,7 +4119,7 @@ function quux () {
4102
4119
Checks for presence of jsdoc comments, on class declarations as well as
4103
4120
functions.
4104
4121
4105
- <a name =" eslint-plugin-jsdoc-rules-require-jsdoc-options-7 " ></a >
4122
+ <a name =" eslint-plugin-jsdoc-rules-require-jsdoc-options-8 " ></a >
4106
4123
#### Options
4107
4124
4108
4125
Accepts one optional options object with the following optional keys.
@@ -5138,7 +5155,7 @@ function quux (foo) {
5138
5155
5139
5156
Requires that all function parameters are documented.
5140
5157
5141
- <a name =" eslint-plugin-jsdoc-rules-require-param-options-8 " ></a >
5158
+ <a name =" eslint-plugin-jsdoc-rules-require-param-options-9 " ></a >
5142
5159
#### Options
5143
5160
5144
5161
An options object accepts one optional property:
@@ -6065,7 +6082,7 @@ function quux () {
6065
6082
6066
6083
Requires returns are documented.
6067
6084
6068
- <a name =" eslint-plugin-jsdoc-rules-require-returns-options-9 " ></a >
6085
+ <a name =" eslint-plugin-jsdoc-rules-require-returns-options-10 " ></a >
6069
6086
#### Options
6070
6087
6071
6088
- ` exemptedBy ` - Array of tags (e.g., ` ['type'] ` ) whose presence on the document
0 commit comments