tsdoc-require-2/require-package-documentation
Require the @packageDocumentation tag in TSDoc blocks for targeted declarations.
Rule detailsâ
This rule reports declarations that already have TSDoc but are missing @packageDocumentation.
It does not create a TSDoc block. Pair it with tsdoc-require-2/require when you also want to require comments.
Why use itâ
@packageDocumentation helps establish package-level intent and usage context in generated docs.
Optionsâ
This rule supports the same options as tsdoc-require-2/require:
enforceForexportModeincludeNonExported(legacy alias forexportMode: "all")
Flat config example (namespace/module focused):
import tsdocRequire from "eslint-plugin-tsdoc-require-2";
export default [
{
plugins: {
"tsdoc-require-2": tsdocRequire,
},
rules: {
"tsdoc-require-2/require-package-documentation": [
"error",
{
enforceFor: ["namespace"],
},
],
},
},
];
Examplesâ
â Incorrectâ
/**
* Public API surface for this package.
*/
export namespace Api {
export type Id = string;
}
â Correctâ
/**
* Public API surface for this package.
*
* @packageDocumentation
*/
export namespace Api {
export type Id = string;
}
Behavior notesâ
This rule checks tag presence. It does not enforce where package documentation should be physically located.