eslint-plugin-jsdoc
raw JSON → 62.9.0 verified Sat Apr 25 auth: no javascript
An ESLint plugin providing over 80 JSDoc linting rules, including checks for tag presence, type correctness, param consistency, and comment formatting. At version 62.9.0, it supports ESLint 7–10 and ships TypeScript types. It offers flat config (recommended) and eslintrc configs, with a dedicated TSDoc ruleset. Compared to alternatives like eslint-plugin-require-jsdoc, it is the most comprehensive and actively maintained JSDoc linter, with a monthly release cadence and strong community adoption.
Common errors
error Cannot find module 'eslint-plugin-jsdoc' ↓
cause The package is not installed or is listed in devDependencies but not installed.
fix
Run
npm install --save-dev eslint-plugin-jsdoc. error Error: Invalid config: 'flat/recommended' is not a valid config name. ↓
cause Using the config string without the `config` property or misspelling the config name.
fix
Correct usage:
jsdoc({ config: 'flat/recommended' }) error TypeError: jsdoc is not a function ↓
cause Importing the plugin incorrectly (e.g., import * as jsdocPlugin from 'eslint-plugin-jsdoc' and trying to call it).
fix
Use
import { jsdoc } from 'eslint-plugin-jsdoc' and call jsdoc(options). Warnings
breaking ESLint 10 support added in v62.7.0; v62.6.x may not be compatible with ESLint 10. ↓
fix Upgrade to eslint-plugin-jsdoc >=62.7.0 to use ESLint 10.
breaking Flat config is the only supported config format for ESLint 9+. eslintrc configs are deprecated and may be removed in a future major. ↓
fix Migrate to flat config using `jsdoc({ config: 'flat/recommended' })`.
deprecated The `default-expressions` and `examples` configs use deprecated rules that now trigger ESLint warnings. ↓
fix Avoid using those configs; configure individual rules instead.
gotcha When using `jsdoc()` in flat config, do not nest settings under a `jsdoc` key; pass them directly. Merging is recursive by default unless `mergeSettings: false`. ↓
fix Set settings at top level of the config object, not under `settings.jsdoc`.
gotcha The `check-param-names` rule may not correctly check TypeScript property signatures in interfaces prior to v62.5.5. ↓
fix Upgrade to v62.5.5 or later to support TSPropertySignature inside interfaces.
Install
npm install eslint-plugin-jsdoc yarn add eslint-plugin-jsdoc pnpm add eslint-plugin-jsdoc Imports
- jsdoc wrong
const { jsdoc } = require('eslint-plugin-jsdoc')correctimport { jsdoc } from 'eslint-plugin-jsdoc' - plugin wrong
const plugin = require('eslint-plugin-jsdoc')correctimport plugin from 'eslint-plugin-jsdoc' - flat/recommended wrong
import { recommended } from 'eslint-plugin-jsdoc'correctimport { jsdoc } from 'eslint-plugin-jsdoc'; export default [ jsdoc({ config: 'flat/recommended' }) ]
Quickstart
import { jsdoc } from 'eslint-plugin-jsdoc';
export default [
jsdoc({
config: 'flat/recommended',
rules: {
'jsdoc/require-description': 'warn',
'jsdoc/check-param-names': ['error', { checkRestProperty: true }]
},
settings: {
// Custom tag definitions
structuredTags: {
customTag: {
name: 'text',
type: false,
required: ['name']
}
}
}
})
];