Require JSDoc Private
Require a @private tag in JSDoc blocks for private class members.
Summary
The require-jsdoc-private rule reports any private class member (method or property) that has a JSDoc block but is missing a @private tag.
A member is considered private if it uses the private keyword or a # private identifier. Members without a JSDoc block are not flagged.
Why Use This Rule?
- Keeps JSDoc tags consistent with TypeScript access modifiers so readers do not have to check two places.
- Ensures documentation tools that consume
@privatetags correctly hide internal members. - Catches cases where a member was made private but the JSDoc block was not updated.
Examples
Configuration
Options
warning
ignoreFiles is an escape hatch for files where this rule genuinely does not apply. It is not intended for routine use.
| Option | Type | Default | Description |
|---|---|---|---|
ignoreFiles | string[] | [] | File patterns to skip. |
Autofix
This rule provides automatic fixes. Run ESLint with the --fix flag:
npx eslint --fix . --rule '@cbnventures/nova/require-jsdoc-private: error'
Troubleshooting
- Warning does not fire for members without JSDoc — The rule only checks members that already have a JSDoc block. If a private member has no JSDoc comment, the rule does not report it.
- Public members with
@privateare not flagged — This rule only checks that private members have the tag. It does not check for mismatched tags on public members.