Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: gajus/eslint-plugin-jsdoc
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v33.1.1
Choose a base ref
...
head repository: gajus/eslint-plugin-jsdoc
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v33.2.0
Choose a head ref
  • 1 commit
  • 8 files changed
  • 3 contributors

Commits on May 10, 2021

  1. 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>
    3 people authored May 10, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f892338 View commit details
Showing with 1,051 additions and 58 deletions.
  1. +2 −0 .README/README.md
  2. +40 −0 .README/rules/require-asterisk-prefix.md
  3. +332 −57 README.md
  4. +3 −0 src/index.js
  5. +1 −1 src/iterateJsdoc.js
  6. +149 −0 src/rules/requireAsteriskPrefix.js
  7. +523 −0 test/rules/assertions/requireAsteriskPrefix.js
  8. +1 −0 test/rules/index.js
2 changes: 2 additions & 0 deletions .README/README.md
Original file line number Diff line number Diff line change
@@ -63,6 +63,7 @@ Finally, enable all of the rules that you would like to use.
"jsdoc/no-defaults": 1,
"jsdoc/no-types": 1,
"jsdoc/no-undefined-types": 1, // Recommended
"jsdoc/require-asterisk-prefix": 1,
"jsdoc/require-description": 1,
"jsdoc/require-description-complete-sentence": 1,
"jsdoc/require-example": 1,
@@ -558,6 +559,7 @@ selector).
{"gitdown": "include", "file": "./rules/no-restricted-syntax.md"}
{"gitdown": "include", "file": "./rules/no-types.md"}
{"gitdown": "include", "file": "./rules/no-undefined-types.md"}
{"gitdown": "include", "file": "./rules/require-asterisk-prefix.md"}
{"gitdown": "include", "file": "./rules/require-description-complete-sentence.md"}
{"gitdown": "include", "file": "./rules/require-description.md"}
{"gitdown": "include", "file": "./rules/require-example.md"}
40 changes: 40 additions & 0 deletions .README/rules/require-asterisk-prefix.md
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 -->
Loading