Generates TypeScript types from ESLint rule JSON schemas automatically, providing auto-completion and type-checking for rule options. Current stable version is 2.3.1, with an active release cadence. Key differentiators: leverages ESLint's flat config to generate types on the fly, uses json-schema-to-typescript-lite under the hood, and is ESM-only from v2.0.0. Eliminates manual type definitions for ESLint plugin options.
npm install eslint-typegenVerified import paths — ran on the pinned version, not inferred.
Wraps ESLint flat config with typegen() to auto-generate TypeScript declarations for rule options.
Convert to ESM (use 'import' syntax or dynamic import) or pin to v1.x if CJS is required.
Upgrade to v0.3.2+ to avoid needing @types/eslint separately.
Run ESLint at least once after configuration changes to regenerate eslint-typegen.d.ts.
Skip installing eslint-typegen if using @antfu/eslint-config; its types are pre-generated.
Ensure project uses ESLint 9+ with flat config (eslint.config.js/mjs). Not compatible with legacy .eslintrc.
Ensure typegen() receives an array of valid flat config objects: typegen([...configs]).
Convert your script to ESM (use 'import') or use dynamic import: const typegen = (await import('eslint-typegen')).default.Upgrade to v2.0.0+ or use import { pluginsToRulesDTS } from 'eslint-typegen' in older versions (check docs accordingly).Use typegen as an exported function, not as a plugin. Remove from plugins array and wrap config: export default typegen([...]).