Skip to main content

no-empty-example-tag

Disallow empty @example tags in TypeDoc comments.

Targeted pattern scopeโ€‹

This rule checks TypeDoc comments containing @example block tags.

What this rule reportsโ€‹

This rule reports @example tags that contain no meaningful example content, including empty fenced code blocks.

Why this rule existsโ€‹

An empty example section creates noise in generated docs and suggests incomplete API guidance.

โŒ Incorrectโ€‹

/**
* Add two values.
* @example
*/
export function add(left: number, right: number): number {
return left + right;
}

โœ… Correctโ€‹

/**
* Add two values.
* @example
* add(1, 2);
*/
export function add(left: number, right: number): number {
return left + right;
}

Behavior and migration notesโ€‹

This rule does not autofix because meaningful examples are contextual and must be authored.

ESLint flat config exampleโ€‹

import typedocPlugin from "eslint-plugin-typedoc";

export default [
{
plugins: { typedoc: typedocPlugin },
rules: {
"typedoc/no-empty-example-tag": "error",
},
},
];

When not to use itโ€‹

Disable only if your team intentionally leaves placeholder example tags during staged documentation rollouts.

Package documentationโ€‹

TypeDoc package documentation:

Further readingโ€‹

Rule catalog ID: R022

Adoption resourcesโ€‹

  • Pair with require-example-tag and require-code-fence-language for stronger example quality.