Skip to content

Commit f075b67

Browse files
committed
docs: generate docs
1 parent 2c34e21 commit f075b67

File tree

1 file changed

+66
-54
lines changed

1 file changed

+66
-54
lines changed

README.md

Lines changed: 66 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -2333,45 +2333,59 @@ tag should be linted with the `matchDescription` value (or the default).
23332333
```
23342334

23352335
If you wish to override the main function description without changing the
2336-
default `mainDescription`, you may use `tags` with `main description`:
2336+
default `match-description`, you may use `mainDescription`:
23372337

23382338
```js
23392339
{
2340-
'jsdoc/match-description': ['error', {tags: {
2341-
'main description': '[A-Z].*\\.',
2342-
param: true,
2343-
returns: true
2344-
}}]
2340+
'jsdoc/match-description': ['error', {
2341+
mainDescription: '[A-Z].*\\.',
2342+
tags: {
2343+
param: true,
2344+
returns: true
2345+
}
2346+
}]
23452347
}
23462348
```
23472349

2348-
There is no need to add `"main description": true`, as by default, the main
2350+
There is no need to add `mainDescription: true`, as by default, the main
23492351
function (and only the main function) is linted, though you may disable checking
23502352
it by setting it to `false`.
23512353

23522354
<a name="eslint-plugin-jsdoc-rules-match-description-options-1-contexts"></a>
23532355
##### <code>contexts</code>
23542356

2355-
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
23562358
where you wish the rule to be applied (e.g., `ClassDeclaration` for ES6 classes).
2357-
2358-
<a name="eslint-plugin-jsdoc-rules-match-description-options-1-nodefaults"></a>
2359-
##### <code>noDefaults</code>
2360-
2361-
By default, `contexts` will permit `ArrowFunctionExpression`,
2362-
`FunctionDeclaration`, and `FunctionExpression`. Set this instead to `true` to
2363-
have `contexts` override these.
2359+
Overrides the defaults.
23642360

23652361
|||
23662362
|---|---|
23672363
|Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled|
23682364
|Tags|N/A by default but see `tags` options|
23692365
|Settings||
2370-
|Options|`contexts`, `noDefaults`, `tags` (allows for 'param', 'arg', 'argument', 'returns', 'return'), `matchDescription`|
2366+
|Options|`contexts`, `tags` (allows for 'param', 'arg', 'argument', 'returns', 'return'), `matchDescription`|
23712367

23722368
The following patterns are considered problems:
23732369

23742370
````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+
23752389
/**
23762390
* foo.
23772391
*/
@@ -2395,8 +2409,6 @@ function quux () {
23952409

23962410
}
23972411
// Options: [{"matchDescription":"[А-Я][А-я]+\\."}]
2398-
<<<<<<< HEAD
2399-
=======
24002412
// Message: JSDoc description does not satisfy the regex pattern.
24012413

24022414
/**
@@ -2405,8 +2417,7 @@ function quux () {
24052417
function quux () {
24062418

24072419
}
2408-
// Options: [{"tags":{"main description":"[А-Я][А-я]+\\.","param":true}}]
2409-
>>>>>>> feat(match-description): allow `main description: string|boolean` to override or disable main description separate from default
2420+
// Options: [{"mainDescription":"[А-Я][А-я]+\\.","tags":{"param":true}}]
24102421
// Message: JSDoc description does not satisfy the regex pattern.
24112422

24122423
/**
@@ -2436,7 +2447,7 @@ function quux (foo) {
24362447
function quux (foo) {
24372448

24382449
}
2439-
// Options: [{"tags":{"main description":"^[a-zA-Z]*$","param":true}}]
2450+
// Options: [{"mainDescription":"^[a-zA-Z]*$","tags":{"param":true}}]
24402451
// Message: JSDoc description does not satisfy the regex pattern.
24412452

24422453
/**
@@ -2447,7 +2458,7 @@ function quux (foo) {
24472458
function quux (foo) {
24482459

24492460
}
2450-
// Options: [{"tags":{"main description":false,"param":true}}]
2461+
// Options: [{"mainDescription":false,"tags":{"param":true}}]
24512462
// Message: JSDoc description does not satisfy the regex pattern.
24522463

24532464
/**
@@ -2550,8 +2561,6 @@ function quux () {
25502561

25512562
}
25522563
// Options: [{"tags":{"param":"[А-Я][А-я]+\\."}}]
2553-
<<<<<<< HEAD
2554-
=======
25552564
// Message: JSDoc description does not satisfy the regex pattern.
25562565

25572566
/**
@@ -2560,8 +2569,7 @@ function quux () {
25602569
class quux {
25612570

25622571
}
2563-
// Options: [{"contexts":["ClassDeclaration"],"noDefaults":true}]
2564-
>>>>>>> feat(match-description): allow `main description: string|boolean` to override or disable main description separate from default
2572+
// Options: [{"contexts":["ClassDeclaration"]}]
25652573
// Message: JSDoc description does not satisfy the regex pattern.
25662574

25672575
class MyClass {
@@ -2570,7 +2578,7 @@ class MyClass {
25702578
*/
25712579
myClassField = 1
25722580
}
2573-
// Options: [{"contexts":["ClassProperty"],"noDefaults":true}]
2581+
// Options: [{"contexts":["ClassProperty"]}]
25742582
// Message: JSDoc description does not satisfy the regex pattern.
25752583

25762584
/**
@@ -2579,7 +2587,7 @@ class MyClass {
25792587
interface quux {
25802588

25812589
}
2582-
// Options: [{"contexts":["TSInterfaceDeclaration"],"noDefaults":true}]
2590+
// Options: [{"contexts":["TSInterfaceDeclaration"]}]
25832591
// Message: JSDoc description does not satisfy the regex pattern.
25842592

25852593
const myObject = {
@@ -2588,7 +2596,7 @@ const myObject = {
25882596
*/
25892597
myProp: true
25902598
};
2591-
// Options: [{"contexts":["Property"],"noDefaults":true}]
2599+
// Options: [{"contexts":["Property"]}]
25922600
// Message: JSDoc description does not satisfy the regex pattern.
25932601
````
25942602

@@ -2725,47 +2733,62 @@ function quux () {
27252733
function quux () {
27262734

27272735
}
2728-
// Options: [{"tags":{"main description":false}}]
2736+
// Options: [{"mainDescription":false}]
27292737

27302738
/**
27312739
* foo.
27322740
*/
27332741
class quux {
27342742

27352743
}
2736-
// Message: JSDoc description does not satisfy the regex pattern.
27372744

27382745
/**
27392746
* foo.
27402747
*/
27412748
class quux {
27422749

27432750
}
2744-
// Options: [{"tags":{"main description":true}}]
2751+
// Options: [{"mainDescription":true}]
27452752

27462753
class MyClass {
27472754
/**
27482755
* Abc.
27492756
*/
27502757
myClassField = 1
27512758
}
2752-
// Options: [{"contexts":["ClassProperty"],"noDefaults":true}]
2759+
// Options: [{"contexts":["ClassProperty"]}]
27532760

27542761
/**
27552762
* Foo.
27562763
*/
27572764
interface quux {
27582765

27592766
}
2760-
// Options: [{"contexts":["TSInterfaceDeclaration"],"noDefaults":true}]
2767+
// Options: [{"contexts":["TSInterfaceDeclaration"]}]
27612768

27622769
const myObject = {
27632770
/**
27642771
* Bad description
27652772
*/
27662773
myProp: true
27672774
};
2768-
// 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":[]}]
27692792
````
27702793

27712794

@@ -3505,20 +3528,18 @@ Requires that all functions have a description.
35053528

35063529
An options object may have any of the following properties:
35073530

3508-
- `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
35093532
where you wish the rule to be applied (e.g., `ClassDeclaration` for ES6 classes).
3533+
Overrides the defaults.
35103534
- `exemptedBy` - Array of tags (e.g., `['type']`) whose presence on the document
35113535
block avoids the need for a `@description`.
3512-
- `noDefaults` - By default, `contexts` will permit `ArrowFunctionExpression`,
3513-
`FunctionDeclaration`, and `FunctionExpression`. Set this instead to `true` to
3514-
have `contexts` override these.
35153536

35163537
|||
35173538
|---|---|
35183539
|Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled|
35193540
|Tags|`description`|
35203541
|Aliases|`desc`|
3521-
|Options|`contexts`, `exemptedBy`, `noDefaults`|
3542+
|Options|`contexts`, `exemptedBy`|
35223543

35233544
The following patterns are considered problems:
35243545

@@ -3537,7 +3558,7 @@ function quux () {
35373558
class quux {
35383559

35393560
}
3540-
// Options: [{"contexts":"ClassDeclaration"}]
3561+
// Options: [{"contexts":["ClassDeclaration"]}]
35413562
// Message: Missing JSDoc @description declaration.
35423563

35433564
/**
@@ -3546,7 +3567,7 @@ class quux {
35463567
class quux {
35473568

35483569
}
3549-
// Options: [{"contexts":"ClassDeclaration","noDefaults":true}]
3570+
// Options: [{"contexts":["ClassDeclaration"]}]
35503571
// Message: Missing JSDoc @description declaration.
35513572

35523573
/**
@@ -3572,9 +3593,8 @@ function quux () {
35723593
interface quux {
35733594

35743595
}
3575-
// Options: [{"contexts":["TSInterfaceDeclaration"],"noDefaults":true}]
3596+
// Options: [{"contexts":["TSInterfaceDeclaration"]}]
35763597
// Message: Missing JSDoc @description declaration.
3577-
<<<<<<< HEAD
35783598

35793599
/**
35803600
*
@@ -3593,8 +3613,6 @@ var quux = {
35933613
};
35943614
// Options: [{"contexts":["ObjectExpression"]}]
35953615
// Message: Missing JSDoc @description declaration.
3596-
=======
3597-
>>>>>>> fix(match-description): tighten default regex to require punctuation at the end even if only a single character
35983616
````
35993617

36003618
The following patterns are not considered problems:
@@ -3640,7 +3658,7 @@ class quux {
36403658
function quux () {
36413659

36423660
}
3643-
// Options: [{"noDefaults":true}]
3661+
// Options: [{"contexts":["ClassDeclaration"]}]
36443662

36453663
/**
36463664
* @type {MyCallback}
@@ -3656,7 +3674,6 @@ function quux () {
36563674
interface quux {
36573675

36583676
}
3659-
<<<<<<< HEAD
36603677

36613678
/**
36623679
*
@@ -3671,9 +3688,6 @@ var quux = class {
36713688
var quux = {
36723689

36733690
};
3674-
=======
3675-
// Message: Missing JSDoc @description declaration.
3676-
>>>>>>> fix(match-description): tighten default regex to require punctuation at the end even if only a single character
36773691
````
36783692

36793693

@@ -3941,10 +3955,8 @@ be checked by the rule.
39413955
- `FunctionExpression`
39423956
- `MethodDefinition`
39433957

3944-
- `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
39453959
AST context where you wish the rule to be applied (e.g., `Property` for properties).
3946-
Note that unlike `require-description` and `match-description`, this rule has no
3947-
`noDefaults` option because its defaults are instead set up by `require`.
39483960

39493961
|||
39503962
|---|---|

0 commit comments

Comments
 (0)