Skip to content

Commit 84fb449

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents b7f22cd + 4bb3af6 commit 84fb449

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1533
-281
lines changed

.README/README.md

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -72,39 +72,50 @@ Add `plugins` section and specify `eslint-plugin-jsdoc` as a plugin.
7272

7373
Finally, enable all of the rules that you would like to use.
7474

75-
```json
75+
```javascript
7676
{
7777
"rules": {
78-
"jsdoc/check-alignment": 1,
78+
"jsdoc/check-alignment": 1, // Recommended
7979
"jsdoc/check-examples": 1,
8080
"jsdoc/check-indentation": 1,
81-
"jsdoc/check-param-names": 1,
81+
"jsdoc/check-param-names": 1, // Recommended
8282
"jsdoc/check-syntax": 1,
83-
"jsdoc/check-tag-names": 1,
84-
"jsdoc/check-types": 1,
85-
"jsdoc/implements-on-classes": 1,
83+
"jsdoc/check-tag-names": 1, // Recommended
84+
"jsdoc/check-types": 1, // Recommended
85+
"jsdoc/implements-on-classes": 1, // Recommended
8686
"jsdoc/match-description": 1,
87-
"jsdoc/newline-after-description": 1,
87+
"jsdoc/newline-after-description": 1, // Recommended
8888
"jsdoc/no-types": 1,
89-
"jsdoc/no-undefined-types": 1,
89+
"jsdoc/no-undefined-types": 1, // Recommended
9090
"jsdoc/require-description": 1,
9191
"jsdoc/require-description-complete-sentence": 1,
9292
"jsdoc/require-example": 1,
9393
"jsdoc/require-hyphen-before-param-description": 1,
94-
"jsdoc/require-jsdoc": 1,
95-
"jsdoc/require-param": 1,
96-
"jsdoc/require-param-description": 1,
97-
"jsdoc/require-param-name": 1,
98-
"jsdoc/require-param-type": 1,
99-
"jsdoc/require-returns": 1,
100-
"jsdoc/require-returns-check": 1,
101-
"jsdoc/require-returns-description": 1,
102-
"jsdoc/require-returns-type": 1,
103-
"jsdoc/valid-types": 1
94+
"jsdoc/require-jsdoc": 1, // Recommended
95+
"jsdoc/require-param": 1, // Recommended
96+
"jsdoc/require-param-description": 1, // Recommended
97+
"jsdoc/require-param-name": 1, // Recommended
98+
"jsdoc/require-param-type": 1, // Recommended
99+
"jsdoc/require-returns": 1, // Recommended
100+
"jsdoc/require-returns-check": 1, // Recommended
101+
"jsdoc/require-returns-description": 1, // Recommended
102+
"jsdoc/require-returns-type": 1, // Recommended
103+
"jsdoc/valid-types": 1 // Recommended
104104
}
105105
}
106106
```
107107

108+
Or you can simply use the following which enables the rules commented
109+
above as "recommended":
110+
111+
```json
112+
{
113+
"extends": ["plugin:jsdoc/recommended"]
114+
}
115+
```
116+
117+
You can then selectively add to or override the recommended rules.
118+
108119
## Settings
109120

110121
### Allow `@private` to disable rules for that comment block
@@ -354,7 +365,8 @@ decreasing precedence:
354365
with JavaScript Markdown lintable by
355366
[other plugins](https://github.com/eslint/eslint-plugin-markdown), e.g.,
356367
if one sets `matchingFileName` to `dummy.md` so that `@example` rules will
357-
follow one's Markdown rules).
368+
follow one's Markdown rules). Note that this option may come at somewhat
369+
of a performance penalty as the file's existence is checked by eslint.
358370
* `settings.jsdoc.configFile` - A config file. Corresponds to ESLint's `-c`.
359371
* `settings.jsdoc.eslintrcForExamples` - Defaults to `true` in adding rules
360372
based on an `.eslintrc.*` file. Setting to `false` corresponds to

.README/rules/check-indentation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Reports invalid padding inside JSDoc block.
44

55
|||
66
|---|---|
7-
|Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`|
7+
|Context|everywhere|
88
|Tags|N/A|
99

1010
<!-- assertions checkIndentation -->

.README/rules/check-syntax.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Reports against Google Closure Compiler syntax.
44

55
|||
66
|---|---|
7-
|Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`|
7+
|Context|everywhere|
88
|Tags|N/A|
99

1010
<!-- assertions checkSyntax -->

.README/rules/check-tag-names.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ yields
7777

7878
|||
7979
|---|---|
80-
|Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`|
80+
|Context|everywhere|
8181
|Tags|N/A|
8282
|Settings|`tagNamePreference`, `additionalTagNames`|
8383

.README/rules/check-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ String | **string** | **string** | `("test") instanceof String` -> **`false`**
8282

8383
|||
8484
|---|---|
85-
|Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`|
85+
|Context|everywhere|
8686
|Tags|`class`, `constant`, `enum`, `implements`, `member`, `module`, `namespace`, `param`, `property`, `returns`, `throws`, `type`, `typedef`, `yields`|
8787
|Aliases|`constructor`, `const`, `var`, `arg`, `argument`, `prop`, `return`, `exception`|
8888
|Closure-only|`package`, `private`, `protected`, `public`, `static`|

.README/rules/match-description.md

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,26 @@ The default is this basic expression to match English sentences (Support
66
for Unicode upper case may be added in a future version when it can be handled
77
by our supported Node versions):
88

9-
``^([A-Z]|[`\\d_])([\\s\\S]*[.?!`])?$``
9+
``^([A-Z]|[`\\d_])[\\s\\S]*[.?!`]$``
1010

11-
You can supply your own expression passing a `matchDescription` string on
12-
the options object.
11+
#### Options
12+
13+
##### `matchDescription`
14+
15+
You can supply your own expression to override the default, passing a
16+
`matchDescription` string on the options object.
1317

1418
```js
1519
{
1620
'jsdoc/match-description': ['error', {matchDescription: '[A-Z].*\\.'}]
1721
}
1822
```
1923

24+
As with the default, the supplied regular expression will be applied with the
25+
Unicode (`"u"`) flag and is *not* case-insensitive.
26+
27+
##### `tags`
28+
2029
If you want different regular expressions to apply to tags, you may use
2130
the `tags` option object:
2231

@@ -41,14 +50,36 @@ tag should be linted with the `matchDescription` value (or the default).
4150
}
4251
```
4352

53+
If you wish to override the main function description without changing the
54+
default `match-description`, you may use `mainDescription`:
55+
56+
```js
57+
{
58+
'jsdoc/match-description': ['error', {
59+
mainDescription: '[A-Z].*\\.',
60+
tags: {
61+
param: true,
62+
returns: true
63+
}
64+
}]
65+
}
66+
```
67+
68+
There is no need to add `mainDescription: true`, as by default, the main
69+
function (and only the main function) is linted, though you may disable checking
70+
it by setting it to `false`.
71+
72+
##### `contexts`
4473

45-
By default, only the main function description is linted.
74+
Set this to an array of strings representing the AST context
75+
where you wish the rule to be applied (e.g., `ClassDeclaration` for ES6 classes).
76+
Overrides the defaults.
4677

4778
|||
4879
|---|---|
49-
|Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`|
80+
|Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled|
5081
|Tags|N/A by default but see `tags` options|
5182
|Settings||
52-
|Options|`tags` (allows for 'param', 'arg', 'argument', 'returns', 'return'), `matchDescription`|
83+
|Options|`contexts`, `tags` (allows for 'param', 'arg', 'argument', 'returns', 'return'), `matchDescription`|
5384

5485
<!-- assertions matchDescription -->

.README/rules/newline-after-description.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This rule takes one argument. If it is `"always"` then a problem is raised when
66

77
|||
88
|---|---|
9-
|Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`|
9+
|Context|everywhere|
1010
|Tags|N/A|
1111

1212
<!-- assertions newlineAfterDescription -->

.README/rules/no-undefined-types.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ In addition to considering globals found in code (or in ESLint-indicated
1111
name(path) definitions to also serve as a potential "type" for checking
1212
the tag types in the table below:
1313

14-
`@callback`, `@class` (or `@constructor`), `@constant` (or `@const`), `@event`, `@external` (or `@host`), `@function` (or `@func` or `@method`), `@interface`, `@member` (or `@var`), `@mixin`, `@name`, `@namespace`, `@template`, `@typedef`.
14+
`@callback`, `@class` (or `@constructor`), `@constant` (or `@const`), `@event`, `@external` (or `@host`), `@function` (or `@func` or `@method`), `@interface`, `@member` (or `@var`), `@mixin`, `@name`, `@namespace`, `@template` (for Closure/TypeScript), `@typedef`.
1515

1616
The following types are always considered defined.
1717

@@ -32,7 +32,7 @@ An option object may have the following keys:
3232

3333
|||
3434
|---|---|
35-
|Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`|
35+
|Context|everywhere|
3636
|Tags|`class`, `constant`, `enum`, `implements`, `member`, `module`, `namespace`, `param`, `property`, `returns`, `throws`, `type`, `typedef`, `yields`|
3737
|Aliases|`constructor`, `const`, `var`, `arg`, `argument`, `prop`, `return`, `exception`, `yield`|
3838
|Closure-only|`package`, `private`, `protected`, `public`, `static`|

.README/rules/require-description-complete-sentence.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Requires that block description and tag description are written in complete sent
99

1010
|||
1111
|---|---|
12-
|Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`|
12+
|Context|everywhere|
1313
|Tags|`param`, `returns`|
1414
|Aliases|`arg`, `argument`, `return`|
1515

.README/rules/require-description.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,17 @@ Requires that all functions have a description.
99

1010
An options object may have any of the following properties:
1111

12-
- `contexts` - Set to a string or array of strings representing the AST context
12+
- `contexts` - Set to an array of strings representing the AST context
1313
where you wish the rule to be applied (e.g., `ClassDeclaration` for ES6 classes).
14+
Overrides the defaults.
1415
- `exemptedBy` - Array of tags (e.g., `['type']`) whose presence on the document
1516
block avoids the need for a `@description`.
16-
- `noDefaults` - By default, `contexts` will permit `ArrowFunctionExpression`,
17-
`FunctionDeclaration`, and `FunctionExpression`. Set this instead to `true` to
18-
have `contexts` override these.
1917

2018
|||
2119
|---|---|
2220
|Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled|
2321
|Tags|`description`|
2422
|Aliases|`desc`|
25-
|Options|`contexts`, `exemptedBy`, `noDefaults`|
23+
|Options|`contexts`, `exemptedBy`|
2624

2725
<!-- assertions requireDescription -->

0 commit comments

Comments
 (0)