require-exported-doc-comment
Require exported declarations to include a leading TypeDoc comment block.
Targeted pattern scopeโ
This rule targets exported declarations that TypeDoc commonly documents, including:
- exported functions and classes
- exported interfaces, type aliases, enums, and namespaces
- exported variable declarations
What this rule reportsโ
This rule reports exported declarations that do not have an adjacent leading TypeDoc block comment.
Why this rule existsโ
Public exports define your documented API surface. Missing comments on exports produce gaps in generated docs and make API intent harder to understand.
โ Incorrectโ
export function createClient(): void {}
โ Correctโ
/**
* Create the primary API client.
*/
export function createClient(): void {}
Behavior and migration notesโ
The autofix inserts a minimal TODO TypeDoc block so teams can quickly mark undocumented exports and fill details incrementally.
ESLint flat config exampleโ
import typedocPlugin from "eslint-plugin-typedoc";
export default [
{
plugins: { typedoc: typedocPlugin },
rules: {
"typedoc/require-exported-doc-comment": "error",
},
},
];
When not to use itโ
Disable this rule when a package intentionally has no generated API documentation and treats exports as internal-only implementation details.
Package documentationโ
TypeDoc package documentation:
Further readingโ
Rule catalog ID: R003
Adoption resourcesโ
- Start with
typedoc.configs.recommendedand combine autofix with targeted follow-up docs review.