eslint-doc-generator
raw JSON → 3.3.2 verified Sat Apr 25 auth: no javascript
Automatic documentation generator for ESLint plugins and rules v3.3.2 (stable, monthly releases). Generates README rules/configs tables, rule doc titles, notices, and option lists from rule metadata. Key differentiator: eliminates custom documentation scripts and tests by providing a single CLI tool that enforces consistent documentation conventions across ESLint plugins. Supports configurable output formats, badges, emoji suggestions (including AI-powered), and integration with prettier/markdownlint. Ships TypeScript declarations.
Common errors
error Error: Cannot find module 'eslint-doc-generator' ↓
cause Package not installed or not in node_modules.
fix
Run
npm install eslint-doc-generator --save-dev and ensure dependencies are installed. error Error: The "path" argument must be of type string. Received undefined ↓
cause Missing `cwd` option when calling generate() programmatically.
fix
Pass a valid directory:
await generate({ cwd: process.cwd() }). error error: Cannot find module 'prettier' ↓
cause Optional peer dependency prettier is missing but required for formatting.
fix
Install prettier:
npm install prettier --save-dev or set --no-prettier if using a different formatter. error SyntaxError: Invalid or unexpected token (when using require) ↓
cause The package is ESM-only since v3; require() is not supported.
fix
Use
import syntax or switch to dynamic import('eslint-doc-generator'). Upgrade Node to >=20. Warnings
breaking v3.0.0 removed implicit config badge fallback. Configs without an explicit badge now show no badge instead of a fallback. ↓
fix Add explicit badge definitions for each config in your configuration file or use --config-badge flag.
breaking v3.0.0 dropped support for Node.js <20, <22.13.0 (for 22.x), and <24. Node 18 and below are no longer supported. ↓
fix Upgrade to Node.js 20, 22.13.0+, or 24+. Run `nvm install 22` or update your CI Node version.
breaking v3.0.0 updated default rule doc title format from 'desc-name' to 'desc' (no rule name in title). Notices formatting changed. ↓
fix Run `eslint-doc-generator` to regenerate rule docs. If you prefer the old format, use `--rule-doc-title-format desc-name`.
breaking v3.3.0 introduced support for new `DeprecatedInfo` format for rule meta.deprecated. Docs may display deprecation info differently. ↓
fix Ensure rule meta.deprecated follows the new format (object with `message` and `replacedBy`). If using old flat string, update rules.
deprecated v3.0.0 removed the `--config-badge` implicit fallback. The `--config-format` option no longer supports `'ruleCount'` (removed in v2). ↓
fix Use `--config-badge` with explicit badge names, or omit to get no badge. For rule count, use `--config-format name` (no count).
gotcha The tool modifies files in-place. If run with `--check`, it exits with non-zero if docs are outdated, which is intended for CI but may confuse first-time users. ↓
fix Always run `eslint-doc-generator` without `--check` to regenerate docs, then commit. Use `--check` only in CI to catch staleness.
Install
npm install eslint-doc-generator yarn add eslint-doc-generator pnpm add eslint-doc-generator Imports
- default wrong
const eslintDocGenerator = require('eslint-doc-generator')correctimport eslintDocGenerator from 'eslint-doc-generator' - generate wrong
const { generate } = require('eslint-doc-generator')correctimport { generate } from 'eslint-doc-generator' - ESLintDocGeneratorOptions wrong
import { ESLintDocGeneratorOptions } from 'eslint-doc-generator'correctimport type { ESLintDocGeneratorOptions } from 'eslint-doc-generator'
Quickstart
// Install: npm i --save-dev eslint-doc-generator eslint prettier
// ESM usage:
import { generate } from 'eslint-doc-generator';
// CLI (programmatic):
await generate({
cwd: process.cwd(),
check: false,
configFormat: 'name',
ruleDocTitleFormat: 'desc',
suggestEmojis: false,
});
// The CLI also supports direct invocation: eslint-doc-generator --check
console.log('Documentation updated successfully.');