no-duplicate-navbar-item-labels
Disallow duplicate static navbar item labels in the same menu array.
Targeted pattern scopeโ
This rule targets docusaurus.config.* files and inspects:
- top-level
themeConfig.navbar.itemsarrays, and - dropdown
itemsarrays for navbar dropdown item objects.
What this rule reportsโ
This rule reports repeated static labels in the same navbar menu array (case-insensitive, whitespace-trimmed comparison).
Why this rule existsโ
Duplicate navbar labels make navigation ambiguous and reduce discoverability. Keeping labels unique per menu array improves UX clarity and reviewability.
โ Incorrectโ
export default {
themeConfig: {
navbar: {
items: [
{ label: "Docs", to: "/docs" },
{ label: "Docs", to: "/rules" },
],
},
},
};
โ Correctโ
export default {
themeConfig: {
navbar: {
items: [
{ label: "Docs", to: "/docs" },
{ label: "Rules", to: "/rules" },
],
},
},
};
Behavior and migration notesโ
This rule reports only. It does not autofix, because renaming labels safely requires content intent.
When not to use itโ
Do not use this rule if your navbar intentionally repeats labels in the same menu array for branding or localization reasons.
Rule catalog ID: R056