Configuration
All presets use TypeScript's projectService for zero-config support.
No tsconfig.json required (though recommended for better inference).
Quick Start
The simplest configuration uses a preset:
// eslint.config.js
import tjd from 'eslint-plugin-typed-jsdoc';
export default [
tjd.configs.recommended,
];Preset Configurations
Choose a preset that matches your needs:
recommended
Balanced defaults for most projects. Start here.
Rules included:
tjd/accurate-jsdocerrortjd/no-redundant-jsdocwarn
strict
All rules as errors.
Rules included:
tjd/accurate-jsdocerrortjd/no-redundant-jsdocerror
rules-only
Just rules, no parser config. Use if you have TypeScript parser already.
Rules included:
tjd/accurate-jsdocerrortjd/no-redundant-jsdocwarn
Config Factory
For more control, use the createConfig() factory function:
// eslint.config.js
import tjd from 'eslint-plugin-typed-jsdoc';
export default [
...tjd.createConfig({
preset: 'strict',
framework: 'next',
projectType: 'app',
ignorePatterns: ['test*', '_*'],
}),
];Factory Options
preset- Rule severity:'recommended'(warn) |'strict'(error)framework- Framework-specific file patterns and ignoresprojectType- Affects file patterns:'app'|'library'|'cli'|'monorepo'|'legacy'typescript- Custom tsconfig:{ project: "./tsconfig.json" }files- Additional file patterns to includeignores- Additional patterns to ignorerules- Rule severity overridesignorePatterns- Function names to skip
Framework Presets
Built-in support for popular frameworks:
| Framework | Description |
|---|---|
next | Next.js - ignores .next/, includes JSX |
react | React - ignores build/, includes JSX |
vue | Vue - ignores dist/, .nuxt/, includes .vue files |
svelte | Svelte - ignores .svelte-kit/, includes .svelte files |
ember | Ember - ignores dist/, tmp/, includes .gjs files |
express | Express - ignores public/ |
fastify | Fastify - Node.js server setup |
node | Generic Node.js - .js, .mjs, .cjs files |
// eslint.config.js
import tjd from 'eslint-plugin-typed-jsdoc';
export default [
...tjd.createConfig({ framework: 'next' }),
// or use framework-specific preset:
// ...tjd.configs.next,
];Project Types
Project types adjust file patterns and rule strictness:
| Type | Description |
|---|---|
app | Application (default) - standard file patterns |
library | Library - stricter rules for public APIs |
cli | CLI tool - includes bin/ directory |
monorepo | Monorepo - handles packages/*/ |
legacy | Legacy project - more lenient rules |
Existing TypeScript Setup
If you already have @typescript-eslint/parser configured, use the rules-only preset:
// eslint.config.js
import tjd from 'eslint-plugin-typed-jsdoc';
// Use this if you already have TypeScript parser configured
export default [
// Your existing TypeScript parser config...
tjd.configs['rules-only'],
];Manual Configuration
For full control over parser options:
// eslint.config.js
import tsparser from '@typescript-eslint/parser';
import tjd from 'eslint-plugin-typed-jsdoc';
export default [
{
files: ['src/**/*.js'],
languageOptions: {
parser: tsparser,
parserOptions: {
project: './tsconfig.json',
},
},
plugins: {
tjd,
},
rules: {
'tjd/accurate-jsdoc': ['error', {
ignorePatterns: ['test*', '_*'],
}],
'tjd/no-redundant-jsdoc': 'warn',
},
},
];Eject Config
Generate a standalone config to customize further:
// Generate standalone config
import tjd from 'eslint-plugin-typed-jsdoc';
console.log(tjd.ejectConfig({ preset: 'strict', framework: 'next' }));
// Outputs a complete config you can copy into eslint.config.jsCommon Options
ignorePatterns
Skip functions or variables by name pattern. Available on all rules. Supports three pattern formats:
"helper"- Exact match"test*"- Glob pattern"/^_/"- Regex pattern
rules: {
'tjd/accurate-jsdoc': ['error', {
ignorePatterns: [
'test*', // Skip functions starting with "test"
'*Callback', // Skip functions ending with "Callback"
'/^_/', // Skip private functions (regex)
'describe', // Exact match
]
}],
}Rule-Specific Options
tjd/accurate-jsdoc
inferenceConfidence(default:0.5) - Minimum confidence (0-1) for auto-fixing. Higher values require more certain type inference.
tjd/no-redundant-jsdoc
keepDescriptions(default:true) - Keep JSDoc comments that have descriptions, only remove the type annotation
Next Steps
- Learn about each rule in detail
- View the source code on GitHub