require-code-fence-language
Require Markdown fenced code blocks inside TypeDoc comments to declare a language.
Targeted pattern scopeโ
This rule scans TypeDoc block comments for Markdown triple-backtick fences and checks opening fences.
What this rule reportsโ
This rule reports opening code fences that omit a language identifier (for example, ``` instead of ```ts).
Why this rule existsโ
Language-less fences reduce syntax highlighting quality and readability in generated docs. Explicit language tags produce more consistent docs output.
โ Incorrectโ
/**
* Render value.
* @example
* ```
* renderValue(1);
* ```
*/
export function renderValue(value: number): string {
return String(value);
}
โ Correctโ
/**
* Render value.
* @example
* ```ts
* renderValue(1);
* ```
*/
export function renderValue(value: number): string {
return String(value);
}
Behavior and migration notesโ
Autofix adds ts as the default language to missing opening fences.
ESLint flat config exampleโ
import typedocPlugin from "eslint-plugin-typedoc";
export default [
{
plugins: { typedoc: typedocPlugin },
rules: {
"typedoc/require-code-fence-language": "error",
},
},
];
When not to use itโ
Disable when your comments intentionally use language-agnostic fences for non-code prose snippets.
Package documentationโ
TypeDoc package documentation:
Further readingโ
Rule catalog ID: R014
Adoption resourcesโ
- Especially useful when teams embed multi-line examples directly in API comments.