Skip to main content

complete-sentences-jsdoc

Requires complete sentences for JSDoc comments.

This rule is similar to the jsdoc/require-description-complete-sentence rule, but it is smarter in that it will generate less false positives. (See the cases outlined below.)

For more information on why you should use this rule, see the comment formatting discussion.

Rule Details

// Bad
/** sometimes I forget to capitalize my sentences. */

// Good
/** Sometimes I forget to capitalize my sentences. */
// Bad
/** Sometimes I forget to put a period on my comments */

// Good
/** Sometimes I forget to put a period on my comments. */
// Good
/**
* - This JSDoc comment has a bullet and that's fine as far as this lint rule is concerned.
*/
// Good
/**
* Ending a sentence with a colon is okay:
*
* - Because there might be a list coming afterwards.
*/
// Good
/**
* URLS are ignored.
* https://github.com/foo/bar/tree/main/packages/baz/
*/
// Good
/**
* Putting code blocks inside a JSDoc comment is okay:
*
* ```ts
* function foo() {}
* ```
*/
// Good
/**
* Asking questions is okay. What is the meaning of life?
*/

The rule tries to be as smart as possible. You can open a GitHub issue if you find a situation where this rule should be smarter.

Options and Defaults

{
"rules": {
"complete/complete-sentences-jsdoc": "error"
}
}

This rule is not configurable.

Resources