Skip to main content

require-package-documentation

Require a top-level @packageDocumentation comment in modules that export API.

Targeted pattern scopeโ€‹

This rule checks source files containing module exports (export ..., export default, export *, TypeScript export assignments).

What this rule reportsโ€‹

This rule reports modules that export API but do not include a top-level TypeDoc package/module documentation comment.

Why this rule existsโ€‹

Without package-level docs, generated TypeDoc module pages often lack context about API purpose, usage boundaries, or design intent.

โŒ Incorrectโ€‹

export function parseValue(value: string): number {
return Number.parseInt(value, 10);
}

โœ… Correctโ€‹

/**
* @packageDocumentation
*/

export function parseValue(value: string): number {
return Number.parseInt(value, 10);
}

Behavior and migration notesโ€‹

Autofix inserts a minimal package documentation block at the top of the file.

ESLint flat config exampleโ€‹

import typedocPlugin from "eslint-plugin-typedoc";

export default [
{
plugins: { typedoc: typedocPlugin },
rules: {
"typedoc/require-package-documentation": "error",
},
},
];

When not to use itโ€‹

Disable this rule for private/internal code where module-level docs are intentionally omitted.

Package documentationโ€‹

TypeDoc package documentation:

Further readingโ€‹

Rule catalog ID: R013

Adoption resourcesโ€‹

  • Pair with require-exported-doc-comment for complete module + symbol coverage.