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
// 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-jsdoc error
  • tjd/no-redundant-jsdoc warn

strict

All rules as errors.

Rules included:

  • tjd/accurate-jsdoc error
  • tjd/no-redundant-jsdoc error

rules-only

Just rules, no parser config. Use if you have TypeScript parser already.

Rules included:

  • tjd/accurate-jsdoc error
  • tjd/no-redundant-jsdoc warn

Config Factory

For more control, use the createConfig() factory function:

eslint.config.js
// 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 ignores
  • projectType - Affects file patterns: 'app' | 'library' | 'cli' | 'monorepo' | 'legacy'
  • typescript - Custom tsconfig: { project: "./tsconfig.json" }
  • files - Additional file patterns to include
  • ignores - Additional patterns to ignore
  • rules - Rule severity overrides
  • ignorePatterns - Function names to skip

Framework Presets

Built-in support for popular frameworks:

FrameworkDescription
nextNext.js - ignores .next/, includes JSX
reactReact - ignores build/, includes JSX
vueVue - ignores dist/, .nuxt/, includes .vue files
svelteSvelte - ignores .svelte-kit/, includes .svelte files
emberEmber - ignores dist/, tmp/, includes .gjs files
expressExpress - ignores public/
fastifyFastify - Node.js server setup
nodeGeneric Node.js - .js, .mjs, .cjs files
eslint.config.js
// 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:

TypeDescription
appApplication (default) - standard file patterns
libraryLibrary - stricter rules for public APIs
cliCLI tool - includes bin/ directory
monorepoMonorepo - handles packages/*/
legacyLegacy project - more lenient rules

Existing TypeScript Setup

If you already have @typescript-eslint/parser configured, use the rules-only preset:

eslint.config.js
// 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
// 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.js

Common 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