useSingleJsDocAsterisk
Summary
Section titled “Summary”- Diagnostic Category:
lint/nursery/useSingleJsDocAsterisk
- This rule has an unsafe fix.
- The default severity of this rule is information.
- Sources:
- Same as
jsdoc/no-multi-asterisks
- Same as
Description
Section titled “Description”Enforce JSDoc comment lines to start with a single asterisk, except for the first one.
This rule ensures that every line in a JSDoc block, except the opening one, starts with exactly one asterisk (*
).
Extra asterisks are unnecessary in JSDoc comments and are often introduced by mistake.
Double asterisks (**
) are still allowed, because they mark the start of bold text.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”/**** Description*/
code-block.js:2:1 lint/nursery/useSingleJsDocAsterisk FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ JSDoc comment line should start with a single asterisk.
1 │ /**
> 2 │ ** Description
│ ^^^^^^^^^^^^^^
3 │ */
4 │
ℹ In JSDoc comments, extra asterisks beyond the first are unnecessary and are often added by mistake.
ℹ Unsafe fix: Remove additional asterisks.
2 │ **·Description
│ -
/*** Description* */
code-block.js:3:1 lint/nursery/useSingleJsDocAsterisk FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ JSDoc comment line should end with a single asterisk.
1 │ /**
2 │ * Description
> 3 │ * */
│ ^^^^
4 │
ℹ In JSDoc comments, extra asterisks beyond the first are unnecessary and are often added by mistake.
ℹ Unsafe fix: Remove additional asterisks.
3 │ *·*/
│ --
/** @ts-ignore **/
code-block.js:1:1 lint/nursery/useSingleJsDocAsterisk FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ JSDoc comment line should end with a single asterisk.
> 1 │ /** @ts-ignore **/
│ ^^^^^^^^^^^^^^^^^^
2 │
ℹ In JSDoc comments, extra asterisks beyond the first are unnecessary and are often added by mistake.
ℹ Unsafe fix: Remove additional asterisks.
1 │ /**·@ts-ignore·**/
│ -
/** * Description * @public */
/** @ts-ignore */
/** * **Bold** text */
How to configure
Section titled “How to configure”{ "linter": { "rules": { "nursery": { "useSingleJsDocAsterisk": "error" } } }}