require-navbar-doc-sidebar-item-sidebar-id
Require sidebarId for Docusaurus navbar items with type: "docSidebar".
Targeted pattern scopeβ
This rule focuses on docusaurus.config.* files and on navbar items authored inside:
themeConfig.navbar.items- nested navbar dropdown
items
It targets navbar items that declare:
type: "docSidebar"
and expects them to also declare:
sidebarId
What this rule reportsβ
This rule reports Docusaurus navbar doc-sidebar items that omit sidebarId or resolve it to an empty static string.
Why this rule existsβ
Docusaurus type: "docSidebar" navbar items link to the first document of a specific sidebar.
When sidebarId is missing, the item no longer matches the documented navbar doc-sidebar contract and the config stops expressing which sidebar should be linked.
β Incorrectβ
export default {
themeConfig: {
navbar: {
items: [
{
type: "docSidebar",
label: "API",
},
],
},
},
};
β Correctβ
export default {
themeConfig: {
navbar: {
items: [
{
type: "docSidebar",
label: "API",
sidebarId: "api",
},
],
},
},
};
Behavior and migration notesβ
This rule reports only. It does not autofix.
Choosing the correct sidebarId depends on the repositoryβs sidebar layout and cannot be inferred safely from syntax alone.
When not to use itβ
Do not use this rule if your project intentionally permits incomplete navbar doc-sidebar placeholders and you do not want linting to enforce the documented Docusaurus navbar item contract.
Rule catalog ID: R035