Skip to main content

no-empty-sidebar-categories

Disallow sidebar category objects whose items arrays resolve statically to empty arrays.

Targeted pattern scopeโ€‹

This rule targets Docusaurus sidebar files such as sidebars.ts and inspects sidebar category objects.

What this rule reportsโ€‹

This rule reports sidebar category objects whose items arrays resolve statically to [].

Why this rule existsโ€‹

Empty sidebar categories create navigation noise and usually indicate unfinished or copied configuration.

โŒ Incorrectโ€‹

export default {
docsSidebar: [{ type: "category", label: "Docs", items: [] }],
};

โœ… Correctโ€‹

export default {
docsSidebar: [{ type: "category", label: "Docs", items: ["intro"] }],
};

Behavior and migration notesโ€‹

This rule autofixes by removing empty sidebar category objects from static sidebar arrays.

When not to use itโ€‹

Do not use this rule if your sidebars intentionally include placeholder categories for later runtime population.

Rule catalog ID: R073

Further readingโ€‹