tsdoc-require-2/require-namespace
Require the @namespace tag in TSDoc blocks for supported TypeScript declarations.
Rule Detailsâ
This rule reports supported declarations and default exports when a TSDoc block exists but does not contain @namespace. Use enforceFor: ["namespace"] when you only want to target TypeScript namespace and declare module declarations. Pair it with tsdoc-require-2/require when you also want to require the TSDoc block itself.
Optionsâ
This rule accepts the same options as tsdoc-require-2/require:
-
enforceFor: limit which declaration kinds are checked. -
exportMode: choose whether to check exported declarations, non-exported top-level declarations, or both. -
includeNonExported: legacy alias forexportMode: "all".type Options = [{enforceFor?: Array<| "class"| "enum"| "function"| "interface"| "namespace"| "object"| "type"| "variable">;exportMode?: "all" | "exported" | "non-exported";includeNonExported?: boolean;},];Default options:
[{enforceFor: ["class","enum","function","interface","namespace","object","type","variable",],exportMode: "exported",},];
â Incorrectâ
/**
* Namespace for API surface docs.
*/
export namespace ApiDocs {
export type Id = string;
}
â Correctâ
/**
* Namespace for API surface docs.
*
* @namespace
*/
export namespace ApiDocs {
export type Id = string;
}
When Not To Use Itâ
Disable this rule if your documentation convention does not require @namespace on the declarations targeted by your configuration.