@@ -2354,26 +2354,38 @@ it by setting it to `false`.
2354
2354
<a name =" eslint-plugin-jsdoc-rules-match-description-options-1-contexts " ></a >
2355
2355
##### <code >contexts</code >
2356
2356
2357
- Set this to a string or array of strings representing the AST context
2357
+ Set this to an array of strings representing the AST context
2358
2358
where you wish the rule to be applied (e.g., ` ClassDeclaration ` for ES6 classes).
2359
-
2360
- <a name =" eslint-plugin-jsdoc-rules-match-description-options-1-nodefaults " ></a >
2361
- ##### <code >noDefaults</code >
2362
-
2363
- By default, ` contexts ` will permit ` ArrowFunctionExpression ` ,
2364
- ` FunctionDeclaration ` , and ` FunctionExpression ` . Set this instead to ` true ` to
2365
- have ` contexts ` override these.
2359
+ Overrides the defaults.
2366
2360
2367
2361
|||
2368
2362
| ---| ---|
2369
2363
| Context| ` ArrowFunctionExpression ` , ` FunctionDeclaration ` , ` FunctionExpression ` ; others when ` contexts ` option enabled|
2370
2364
| Tags| N/A by default but see ` tags ` options|
2371
2365
| Settings||
2372
- | Options| ` contexts ` , ` noDefaults ` , ` tags ` (allows for 'param', 'arg', 'argument', 'returns', 'return'), ` matchDescription ` |
2366
+ | Options| ` contexts ` , ` tags ` (allows for 'param', 'arg', 'argument', 'returns', 'return'), ` matchDescription ` |
2373
2367
2374
2368
The following patterns are considered problems:
2375
2369
2376
2370
```` js
2371
+ /**
2372
+ * foo.
2373
+ */
2374
+ const q = class {
2375
+
2376
+ }
2377
+ // Options: [{"contexts":["ClassExpression"]}]
2378
+ // Message: JSDoc description does not satisfy the regex pattern.
2379
+
2380
+ /**
2381
+ * foo.
2382
+ */
2383
+ const q = {
2384
+
2385
+ };
2386
+ // Options: [{"contexts":["ObjectExpression"]}]
2387
+ // Message: JSDoc description does not satisfy the regex pattern.
2388
+
2377
2389
/**
2378
2390
* foo.
2379
2391
*/
@@ -2397,8 +2409,6 @@ function quux () {
2397
2409
2398
2410
}
2399
2411
// Options: [{"matchDescription":"[А-Я][А-я]+\\."}]
2400
- <<<<<< < HEAD
2401
- ====== =
2402
2412
// Message: JSDoc description does not satisfy the regex pattern.
2403
2413
2404
2414
/**
@@ -2407,12 +2417,7 @@ function quux () {
2407
2417
function quux () {
2408
2418
2409
2419
}
2410
- <<<<<< < HEAD
2411
- // Options: [{"tags":{"main description":"[А-Я][А-я]+\\.","param":true}}]
2412
- >>>>>> > feat (match- description): allow ` main description: string|boolean` to override or disable main description separate from default
2413
- ====== =
2414
2420
// Options: [{"mainDescription":"[А-Я][А-я]+\\.","tags":{"param":true}}]
2415
- >>>>>> > Switch " main description" on ` tags` to its own option as ` mainDescription`
2416
2421
// Message: JSDoc description does not satisfy the regex pattern.
2417
2422
2418
2423
/**
@@ -2556,8 +2561,6 @@ function quux () {
2556
2561
2557
2562
}
2558
2563
// Options: [{"tags":{"param":"[А-Я][А-я]+\\."}}]
2559
- <<<<<< < HEAD
2560
- ====== =
2561
2564
// Message: JSDoc description does not satisfy the regex pattern.
2562
2565
2563
2566
/**
@@ -2566,8 +2569,7 @@ function quux () {
2566
2569
class quux {
2567
2570
2568
2571
}
2569
- // Options: [{"contexts":["ClassDeclaration"],"noDefaults":true}]
2570
- >>>>>> > feat (match- description): allow ` main description: string|boolean` to override or disable main description separate from default
2572
+ // Options: [{"contexts":["ClassDeclaration"]}]
2571
2573
// Message: JSDoc description does not satisfy the regex pattern.
2572
2574
2573
2575
class MyClass {
@@ -2576,7 +2578,7 @@ class MyClass {
2576
2578
*/
2577
2579
myClassField = 1
2578
2580
}
2579
- // Options: [{"contexts":["ClassProperty"],"noDefaults":true }]
2581
+ // Options: [{"contexts":["ClassProperty"]}]
2580
2582
// Message: JSDoc description does not satisfy the regex pattern.
2581
2583
2582
2584
/**
@@ -2585,7 +2587,7 @@ class MyClass {
2585
2587
interface quux {
2586
2588
2587
2589
}
2588
- // Options: [{"contexts":["TSInterfaceDeclaration"],"noDefaults":true }]
2590
+ // Options: [{"contexts":["TSInterfaceDeclaration"]}]
2589
2591
// Message: JSDoc description does not satisfy the regex pattern.
2590
2592
2591
2593
const myObject = {
@@ -2594,7 +2596,7 @@ const myObject = {
2594
2596
*/
2595
2597
myProp: true
2596
2598
};
2597
- // Options: [{"contexts":["Property"],"noDefaults":true }]
2599
+ // Options: [{"contexts":["Property"]}]
2598
2600
// Message: JSDoc description does not satisfy the regex pattern.
2599
2601
````
2600
2602
@@ -2739,7 +2741,6 @@ function quux () {
2739
2741
class quux {
2740
2742
2741
2743
}
2742
- // Message: JSDoc description does not satisfy the regex pattern.
2743
2744
2744
2745
/**
2745
2746
* foo.
@@ -2755,23 +2756,39 @@ class MyClass {
2755
2756
*/
2756
2757
myClassField = 1
2757
2758
}
2758
- // Options: [{"contexts":["ClassProperty"],"noDefaults":true }]
2759
+ // Options: [{"contexts":["ClassProperty"]}]
2759
2760
2760
2761
/**
2761
2762
* Foo.
2762
2763
*/
2763
2764
interface quux {
2764
2765
2765
2766
}
2766
- // Options: [{"contexts":["TSInterfaceDeclaration"],"noDefaults":true }]
2767
+ // Options: [{"contexts":["TSInterfaceDeclaration"]}]
2767
2768
2768
2769
const myObject = {
2769
2770
/**
2770
2771
* Bad description
2771
2772
*/
2772
2773
myProp: true
2773
2774
};
2774
- // Options: [{"contexts":[],"noDefaults":true}]
2775
+ // Options: [{"contexts":[]}]
2776
+
2777
+ /**
2778
+ * foo.
2779
+ */
2780
+ const q = class {
2781
+
2782
+ }
2783
+ // Options: [{"contexts":[]}]
2784
+
2785
+ /**
2786
+ * foo.
2787
+ */
2788
+ const q = {
2789
+
2790
+ };
2791
+ // Options: [{"contexts":[]}]
2775
2792
````
2776
2793
2777
2794
@@ -3511,20 +3528,18 @@ Requires that all functions have a description.
3511
3528
3512
3529
An options object may have any of the following properties:
3513
3530
3514
- - ` contexts ` - Set to a string or array of strings representing the AST context
3531
+ - ` contexts ` - Set to an array of strings representing the AST context
3515
3532
where you wish the rule to be applied (e.g., ` ClassDeclaration ` for ES6 classes).
3533
+ Overrides the defaults.
3516
3534
- ` exemptedBy ` - Array of tags (e.g., ` ['type'] ` ) whose presence on the document
3517
3535
block avoids the need for a ` @description ` .
3518
- - ` noDefaults ` - By default, ` contexts ` will permit ` ArrowFunctionExpression ` ,
3519
- ` FunctionDeclaration ` , and ` FunctionExpression ` . Set this instead to ` true ` to
3520
- have ` contexts ` override these.
3521
3536
3522
3537
|||
3523
3538
| ---| ---|
3524
3539
| Context| ` ArrowFunctionExpression ` , ` FunctionDeclaration ` , ` FunctionExpression ` ; others when ` contexts ` option enabled|
3525
3540
| Tags| ` description ` |
3526
3541
| Aliases| ` desc ` |
3527
- | Options| ` contexts ` , ` exemptedBy ` , ` noDefaults ` |
3542
+ | Options| ` contexts ` , ` exemptedBy ` |
3528
3543
3529
3544
The following patterns are considered problems:
3530
3545
@@ -3543,7 +3558,7 @@ function quux () {
3543
3558
class quux {
3544
3559
3545
3560
}
3546
- // Options: [{"contexts":"ClassDeclaration"}]
3561
+ // Options: [{"contexts":[ "ClassDeclaration"] }]
3547
3562
// Message: Missing JSDoc @description declaration.
3548
3563
3549
3564
/**
@@ -3552,7 +3567,7 @@ class quux {
3552
3567
class quux {
3553
3568
3554
3569
}
3555
- // Options: [{"contexts":"ClassDeclaration","noDefaults":true }]
3570
+ // Options: [{"contexts":[ "ClassDeclaration"] }]
3556
3571
// Message: Missing JSDoc @description declaration.
3557
3572
3558
3573
/**
@@ -3578,9 +3593,8 @@ function quux () {
3578
3593
interface quux {
3579
3594
3580
3595
}
3581
- // Options: [{"contexts":["TSInterfaceDeclaration"],"noDefaults":true }]
3596
+ // Options: [{"contexts":["TSInterfaceDeclaration"]}]
3582
3597
// Message: Missing JSDoc @description declaration.
3583
- <<<<<< < HEAD
3584
3598
3585
3599
/**
3586
3600
*
@@ -3599,8 +3613,6 @@ var quux = {
3599
3613
};
3600
3614
// Options: [{"contexts":["ObjectExpression"]}]
3601
3615
// Message: Missing JSDoc @description declaration.
3602
- ====== =
3603
- >>>>>> > fix (match- description): tighten default regex to require punctuation at the end even if only a single character
3604
3616
````
3605
3617
3606
3618
The following patterns are not considered problems:
@@ -3646,7 +3658,7 @@ class quux {
3646
3658
function quux () {
3647
3659
3648
3660
}
3649
- // Options: [{"noDefaults":true }]
3661
+ // Options: [{"contexts":["ClassDeclaration"] }]
3650
3662
3651
3663
/**
3652
3664
* @type {MyCallback}
@@ -3662,7 +3674,6 @@ function quux () {
3662
3674
interface quux {
3663
3675
3664
3676
}
3665
- <<<<<< < HEAD
3666
3677
3667
3678
/**
3668
3679
*
@@ -3677,9 +3688,6 @@ var quux = class {
3677
3688
var quux = {
3678
3689
3679
3690
};
3680
- ====== =
3681
- // Message: Missing JSDoc @description declaration.
3682
- >>>>>> > fix (match- description): tighten default regex to require punctuation at the end even if only a single character
3683
3691
````
3684
3692
3685
3693
@@ -3947,10 +3955,8 @@ be checked by the rule.
3947
3955
- ` FunctionExpression `
3948
3956
- ` MethodDefinition `
3949
3957
3950
- - ` contexts ` - Set this to a string or array of strings representing the additional
3958
+ - ` contexts ` - Set this to an array of strings representing the additional
3951
3959
AST context where you wish the rule to be applied (e.g., ` Property ` for properties).
3952
- Note that unlike ` require-description ` and ` match-description ` , this rule has no
3953
- ` noDefaults ` option because its defaults are instead set up by ` require ` .
3954
3960
3955
3961
|||
3956
3962
| ---| ---|
0 commit comments