Skip to main content

prefer-package-documentation-tag

Prefer @packageDocumentation over @module in package-level TypeDoc comments.

Targeted pattern scopeโ€‹

This rule checks TypeDoc block comments and rewrites @module tags to the canonical @packageDocumentation form.

What this rule reportsโ€‹

This rule reports @module tags and provides an autofix to replace them with @packageDocumentation.

Why this rule existsโ€‹

TypeDoc supports both forms, but canonicalizing package-level tags improves consistency across repos and generated docs.

โŒ Incorrectโ€‹

/**
* @module
*/
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 is safe and textual: only the tag identifier is changed.

ESLint flat config exampleโ€‹

import typedocPlugin from "eslint-plugin-typedoc";

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

When not to use itโ€‹

Disable if your team intentionally standardizes on @module tags.

Package documentationโ€‹

TypeDoc package documentation:

Further readingโ€‹

Rule catalog ID: R017

Adoption resourcesโ€‹

  • Use with require-package-documentation for complete and canonical package docs.