Skip to content

match-description options #294

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jun 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 26 additions & 4 deletions .README/rules/match-description.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The default is this basic expression to match English sentences (Support
for Unicode upper case may be added in a future version when it can be handled
by our supported Node versions):

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

#### Options

Expand Down Expand Up @@ -50,14 +50,36 @@ tag should be linted with the `matchDescription` value (or the default).
}
```

If you wish to override the main function description without changing the
default `match-description`, you may use `mainDescription`:

By default, only the main function description is linted.
```js
{
'jsdoc/match-description': ['error', {
mainDescription: '[A-Z].*\\.',
tags: {
param: true,
returns: true
}
}]
}
```

There is no need to add `mainDescription: true`, as by default, the main
function (and only the main function) is linted, though you may disable checking
it by setting it to `false`.

##### `contexts`

Set this to an array of strings representing the AST context
where you wish the rule to be applied (e.g., `ClassDeclaration` for ES6 classes).
Overrides the defaults.

|||
|---|---|
|Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`|
|Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled|
|Tags|N/A by default but see `tags` options|
|Settings||
|Options|`tags` (allows for 'param', 'arg', 'argument', 'returns', 'return'), `matchDescription`|
|Options|`contexts`, `tags` (allows for 'param', 'arg', 'argument', 'returns', 'return'), `matchDescription`|

<!-- assertions matchDescription -->
8 changes: 3 additions & 5 deletions .README/rules/require-description.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,17 @@ Requires that all functions have a description.

An options object may have any of the following properties:

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

|||
|---|---|
|Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled|
|Tags|`description`|
|Aliases|`desc`|
|Options|`contexts`, `exemptedBy`, `noDefaults`|
|Options|`contexts`, `exemptedBy`|

<!-- assertions requireDescription -->
3 changes: 3 additions & 0 deletions .README/rules/require-jsdoc.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ be checked by the rule.
- `FunctionExpression`
- `MethodDefinition`

- `contexts` - Set this to an array of strings representing the additional
AST context where you wish the rule to be applied (e.g., `Property` for properties).

|||
|---|---|
|Context|`ArrowFunctionExpression`, `ClassDeclaration`, `ClassExpression`, `FunctionDeclaration`, `FunctionExpression`|
Expand Down
Loading