no-empty-navbar-dropdown-items
Disallow navbar dropdown items whose items arrays resolve statically to empty arrays.
Targeted pattern scopeโ
This rule targets docusaurus.config.* files and inspects:
- top-level
themeConfig.navbar.items, and - nested dropdown
itemsarrays.
What this rule reportsโ
This rule reports navbar dropdown objects whose items arrays resolve statically to [].
Why this rule existsโ
Empty dropdowns add clutter to navigation and often indicate unfinished or copied configuration.
โ Incorrectโ
export default {
themeConfig: {
navbar: {
items: [{ type: "dropdown", label: "Docs", items: [] }],
},
},
};
โ Correctโ
export default {
themeConfig: {
navbar: {
items: [
{
type: "dropdown",
label: "Docs",
items: [{ label: "Overview", to: "/docs" }],
},
],
},
},
};
Behavior and migration notesโ
This rule autofixes by removing empty dropdown items from static navbar arrays.
When not to use itโ
Do not use this rule if your navbar intentionally includes placeholder dropdowns for later runtime population.
Rule catalog ID: R072