@@ -8296,48 +8296,85 @@ functions.
8296
8296
8297
8297
Accepts one optional options object with the following optional keys.
8298
8298
8299
- - `publicOnly` - This option will insist that missing jsdoc blocks are
8300
- only reported for function bodies / class declarations that are exported
8301
- from the module. May be a boolean or object. If set to `true`, the defaults
8302
- below will be used. If unset, jsdoc block reporting will not be limited to
8303
- exports.
8304
-
8305
- This object supports the following optional boolean keys (`false` unless
8306
- otherwise noted):
8307
-
8308
- - `ancestorsOnly` - Only check node ancestors to check if node is exported
8309
- - `esm` - ESM exports are checked for JSDoc comments (Defaults to `true`)
8310
- - `cjs` - CommonJS exports are checked for JSDoc comments (Defaults to `true`)
8311
- - `window` - Window global exports are checked for JSDoc comments
8312
-
8313
- - `require` - An object with the following optional boolean keys which all
8314
- default to `false` except as noted, indicating the contexts where the rule
8315
- will apply:
8316
-
8317
- - `ArrowFunctionExpression`
8318
- - `ClassDeclaration`
8319
- - `ClassExpression`
8320
- - `FunctionDeclaration` (defaults to `true`)
8321
- - `FunctionExpression`
8322
- - `MethodDefinition`
8323
-
8324
- - `contexts` - Set this to an array of strings or objects representing the
8325
- additional AST contexts where you wish the rule to be applied (e.g.,
8326
- `Property` for properties). If specified as an object, it should have a
8327
- `context` property and can have an `inlineCommentBlock` property which,
8328
- if set to `true`, will add an inline `/** */` instead of the regular,
8329
- multi-line, indented jsdoc block which will otherwise be added. Defaults
8330
- to an empty array.
8331
-
8332
- - `exemptEmptyFunctions` (default: false) - When `true`, the rule will not report
8333
- missing jsdoc blocks above functions/methods with no parameters or return values
8334
- (intended where variable names are sufficient for themselves as documentation).
8299
+ <a name="eslint-plugin-jsdoc-rules-require-jsdoc-options-19-publiconly"></a>
8300
+ ##### <code>publicOnly</code>
8301
+
8302
+ This option will insist that missing jsdoc blocks are only reported for
8303
+ function bodies / class declarations that are exported from the module.
8304
+ May be a boolean or object. If set to `true`, the defaults below will be
8305
+ used. If unset, jsdoc block reporting will not be limited to exports.
8306
+
8307
+ This object supports the following optional boolean keys (`false` unless
8308
+ otherwise noted):
8309
+
8310
+ - `ancestorsOnly` - Only check node ancestors to check if node is exported
8311
+ - `esm` - ESM exports are checked for JSDoc comments (Defaults to `true`)
8312
+ - `cjs` - CommonJS exports are checked for JSDoc comments (Defaults to `true`)
8313
+ - `window` - Window global exports are checked for JSDoc comments
8314
+
8315
+ <a name="eslint-plugin-jsdoc-rules-require-jsdoc-options-19-require"></a>
8316
+ ##### <code>require</code>
8317
+
8318
+ An object with the following optional boolean keys which all default to
8319
+ `false` except as noted, indicating the contexts where the rule will apply:
8320
+
8321
+ - `ArrowFunctionExpression`
8322
+ - `ClassDeclaration`
8323
+ - `ClassExpression`
8324
+ - `FunctionDeclaration` (defaults to `true`)
8325
+ - `FunctionExpression`
8326
+ - `MethodDefinition`
8327
+
8328
+ <a name="eslint-plugin-jsdoc-rules-require-jsdoc-options-19-contexts-4"></a>
8329
+ ##### <code>contexts</code>
8330
+
8331
+ Set this to an array of strings or objects representing the additional AST
8332
+ contexts where you wish the rule to be applied (e.g., `Property` for
8333
+ properties). If specified as an object, it should have a `context` property
8334
+ and can have an `inlineCommentBlock` property which, if set to `true`, will
8335
+ add an inline `/** */` instead of the regular, multi-line, indented jsdoc
8336
+ block which will otherwise be added. Defaults to an empty array.
8337
+
8338
+ <a name="eslint-plugin-jsdoc-rules-require-jsdoc-options-19-exemptemptyconstructors"></a>
8339
+ ##### <code>exemptEmptyConstructors</code>
8340
+
8341
+ Default: true
8342
+
8343
+ When `true`, the rule will not report missing jsdoc blocks above constructors
8344
+ with no parameters or return values (this is enabled by default as the class
8345
+ name or description should be seen as sufficient to convey intent).
8346
+
8347
+ <a name="eslint-plugin-jsdoc-rules-require-jsdoc-options-19-exemptemptyfunctions"></a>
8348
+ ##### <code>exemptEmptyFunctions</code>
8349
+
8350
+ Default: false.
8351
+
8352
+ When `true`, the rule will not report missing jsdoc blocks above
8353
+ functions/methods with no parameters or return values (intended where
8354
+ function/method names are sufficient for themselves as documentation).
8355
+
8356
+ <a name="eslint-plugin-jsdoc-rules-require-jsdoc-options-19-checkconstructors-1"></a>
8357
+ ##### <code>checkConstructors</code>
8358
+
8359
+ A value indicating whether `constructor`s should be checked. Defaults to `true`.
8360
+ When `true`, `exemptEmptyConstructors` may still avoid reporting when no
8361
+ parameters or return values are found.
8362
+
8363
+ <a name="eslint-plugin-jsdoc-rules-require-jsdoc-options-19-checkgetters-1"></a>
8364
+ ##### <code>checkGetters</code>
8365
+
8366
+ A value indicating whether getters should be checked. Defaults to `false`.
8367
+
8368
+ <a name="eslint-plugin-jsdoc-rules-require-jsdoc-options-19-checksetters-1"></a>
8369
+ ##### <code>checkSetters</code>
8370
+
8371
+ A value indicating whether getters should be checked. Defaults to `false`.
8335
8372
8336
8373
|||
8337
8374
|---|---|
8338
8375
|Context|`ArrowFunctionExpression`, `ClassDeclaration`, `ClassExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled|
8339
8376
|Tags|N/A|
8340
- |Options|`publicOnly`, `require`, `contexts`, `exemptEmptyFunctions`|
8377
+ |Options|`publicOnly`, `require`, `contexts`, `exemptEmptyConstructors`, ` exemptEmptyFunctions`|
8341
8378
8342
8379
The following patterns are considered problems:
8343
8380
@@ -8858,6 +8895,36 @@ class Animal {
8858
8895
export class User {}
8859
8896
// Options: [{"require":{"ClassDeclaration":true}}]
8860
8897
// Message: Missing JSDoc comment.
8898
+
8899
+ /**
8900
+ *
8901
+ */
8902
+ class Foo {
8903
+ constructor() {}
8904
+ }
8905
+ // Options: [{"exemptEmptyConstructors":false,"require":{"MethodDefinition":true}}]
8906
+ // Message: Missing JSDoc comment.
8907
+
8908
+ /**
8909
+ *
8910
+ */
8911
+ class Foo {
8912
+ constructor(notEmpty) {}
8913
+ }
8914
+ // Options: [{"exemptEmptyConstructors":true,"require":{"MethodDefinition":true}}]
8915
+ // Message: Missing JSDoc comment.
8916
+
8917
+ /**
8918
+ *
8919
+ */
8920
+ class Foo {
8921
+ constructor() {
8922
+ const notEmpty = true;
8923
+ return notEmpty;
8924
+ }
8925
+ }
8926
+ // Options: [{"exemptEmptyConstructors":true,"require":{"MethodDefinition":true}}]
8927
+ // Message: Missing JSDoc comment.
8861
8928
````
8862
8929
8863
8930
The following patterns are not considered problems:
@@ -9521,6 +9588,22 @@ export class User {
9521
9588
export class User {
9522
9589
}
9523
9590
// Options: [{"require":{"ArrowFunctionExpression":false,"ClassDeclaration":true,"ClassExpression":true,"FunctionDeclaration":true,"FunctionExpression":false,"MethodDefinition":true}}]
9591
+
9592
+ /**
9593
+ *
9594
+ */
9595
+ class Foo {
9596
+ constructor() {}
9597
+ }
9598
+ // Options: [{"exemptEmptyConstructors":true,"require":{"MethodDefinition":true}}]
9599
+
9600
+ /**
9601
+ *
9602
+ */
9603
+ class Foo {
9604
+ constructor() {}
9605
+ }
9606
+ // Options: [{"checkConstructors":false,"require":{"MethodDefinition":true}}]
9524
9607
````
9525
9608
9526
9609
@@ -9532,7 +9615,7 @@ Requires that each `@param` tag has a `description` value.
9532
9615
<a name="eslint-plugin-jsdoc-rules-require-param-description-options-20"></a>
9533
9616
#### Options
9534
9617
9535
- <a name="eslint-plugin-jsdoc-rules-require-param-description-options-20-contexts-4 "></a>
9618
+ <a name="eslint-plugin-jsdoc-rules-require-param-description-options-20-contexts-5 "></a>
9536
9619
##### <code>contexts</code>
9537
9620
9538
9621
Set this to an array of strings representing the AST context
@@ -9655,7 +9738,7 @@ Requires that all function parameters have names.
9655
9738
< a name= " eslint-plugin-jsdoc-rules-require-param-name-options-21" >< / a>
9656
9739
#### Options
9657
9740
9658
- < a name= " eslint-plugin-jsdoc-rules-require-param-name-options-21-contexts-5 " >< / a>
9741
+ < a name= " eslint-plugin-jsdoc-rules-require-param-name-options-21-contexts-6 " >< / a>
9659
9742
##### < code> contexts< / code>
9660
9743
9661
9744
Set this to an array of strings representing the AST context
@@ -9773,7 +9856,7 @@ Requires that each `@param` tag has a `type` value.
9773
9856
< a name= " eslint-plugin-jsdoc-rules-require-param-type-options-22" >< / a>
9774
9857
#### Options
9775
9858
9776
- < a name= " eslint-plugin-jsdoc-rules-require-param-type-options-22-contexts-6 " >< / a>
9859
+ < a name= " eslint-plugin-jsdoc-rules-require-param-type-options-22-contexts-7 " >< / a>
9777
9860
##### < code> contexts< / code>
9778
9861
9779
9862
Set this to an array of strings representing the AST context
@@ -10216,7 +10299,7 @@ You could set this regular expression to a more expansive list, or you
10216
10299
could restrict it such that even types matching those strings would not
10217
10300
need destructuring.
10218
10301
10219
- <a name="eslint-plugin-jsdoc-rules-require-param-options-23-contexts-7 "></a>
10302
+ <a name="eslint-plugin-jsdoc-rules-require-param-options-23-contexts-8 "></a>
10220
10303
##### <code>contexts</code>
10221
10304
10222
10305
Set this to an array of strings representing the AST context
@@ -10228,17 +10311,17 @@ which are checked.
10228
10311
See the ["AST and Selectors"](#eslint-plugin-jsdoc-advanced-ast-and-selectors) section of our README for
10229
10312
more on the expected format.
10230
10313
10231
- <a name="eslint-plugin-jsdoc-rules-require-param-options-23-checkconstructors-1 "></a>
10314
+ <a name="eslint-plugin-jsdoc-rules-require-param-options-23-checkconstructors-2 "></a>
10232
10315
##### <code>checkConstructors</code>
10233
10316
10234
10317
A value indicating whether ` constructor `s should be checked. Defaults to `true`.
10235
10318
10236
- <a name="eslint-plugin-jsdoc-rules-require-param-options-23-checkgetters-1 "></a>
10319
+ <a name="eslint-plugin-jsdoc-rules-require-param-options-23-checkgetters-2 "></a>
10237
10320
##### <code>checkGetters</code>
10238
10321
10239
10322
A value indicating whether getters should be checked. Defaults to `false`.
10240
10323
10241
- <a name="eslint-plugin-jsdoc-rules-require-param-options-23-checksetters-1 "></a>
10324
+ <a name="eslint-plugin-jsdoc-rules-require-param-options-23-checksetters-2 "></a>
10242
10325
##### <code>checkSetters</code>
10243
10326
10244
10327
A value indicating whether getters should be checked. Defaults to `false`.
@@ -12066,7 +12149,7 @@ or if it is `Promise<void>` or `Promise<undefined>`.
12066
12149
< a name= " eslint-plugin-jsdoc-rules-require-returns-description-options-24" >< / a>
12067
12150
#### Options
12068
12151
12069
- < a name= " eslint-plugin-jsdoc-rules-require-returns-description-options-24-contexts-8 " >< / a>
12152
+ < a name= " eslint-plugin-jsdoc-rules-require-returns-description-options-24-contexts-9 " >< / a>
12070
12153
##### < code> contexts< / code>
12071
12154
12072
12155
Set this to an array of strings representing the AST context
@@ -12221,7 +12304,7 @@ Requires that `@returns` tag has `type` value.
12221
12304
< a name= " eslint-plugin-jsdoc-rules-require-returns-type-options-25" >< / a>
12222
12305
#### Options
12223
12306
12224
- < a name= " eslint-plugin-jsdoc-rules-require-returns-type-options-25-contexts-9 " >< / a>
12307
+ < a name= " eslint-plugin-jsdoc-rules-require-returns-type-options-25-contexts-10 " >< / a>
12225
12308
##### < code> contexts< / code>
12226
12309
12227
12310
Set this to an array of strings representing the AST context
0 commit comments