Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add require-asterisk-prefix rule (#446)
feat: add require-asterisk-prefix rule; fixes #199 This rule checks that each line of the jsdoc comment starts with an asterisk. For composability with other rules, this does not check the alignment or indentation of the comment content. Allow any/never/always option and `tags` option. Co-authored-by: Eli Skeggs <eli@mixmax.com> Co-authored-by: Brett Zamir <brettz9@yahoo.com>
- Loading branch information
1 parent
7de397b
commit f892338
Showing
8 changed files
with
1,051 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
### `require-asterisk-prefix` | ||
|
||
Requires that each JSDoc line starts with an `*`. | ||
|
||
#### Options | ||
|
||
This rule allows an optional string argument. If it is `"always"` then a | ||
problem is raised when there is no asterisk prefix on a given jsdoc line. If | ||
it is `"never"` then a problem is raised when there is an asterisk present. | ||
The default value is `"always"`. You may also set the default to `"any"` | ||
and use the `tags` option to apply to specific tags only. | ||
|
||
After the string option, one may add an object with the following. | ||
|
||
##### `tags` | ||
|
||
If you want different values to apply to specific tags, you may use | ||
the `tags` option object. The keys are `always`, `never`, or `any` and | ||
the values are arrays of tag names or the special value `*description` | ||
which applies to the main jsdoc block description. | ||
|
||
```js | ||
{ | ||
'jsdoc/require-asterisk-prefix': ['error', 'always', { | ||
tags: { | ||
always: ['*description'], | ||
any: ['example', 'license'], | ||
never: ['copyright'] | ||
} | ||
}] | ||
} | ||
``` | ||
|
||
||| | ||
|---|---| | ||
|Context|everywhere| | ||
|Tags|All or as limited by the `tags` option| | ||
|Options|(a string matching `"always"|"never"` and optional object with `tags`)| | ||
|
||
<!-- assertions requireAsteriskPrefix --> |
Oops, something went wrong.