require-config-link-content
Require Docusaurus theme-config link items to provide visible content via label or html.
Targeted pattern scopeโ
This rule focuses on docusaurus.config.* files and on default link items authored inside:
themeConfig.navbar.itemsthemeConfig.footer.links- nested dropdown/footer item arrays that contain the same default link shape
It expects those link items to provide visible content with either:
labelhtml
What this rule reportsโ
This rule reports Docusaurus theme-config link items that omit both label and html, or resolve those fields to an empty static string.
Why this rule existsโ
Navbar and footer links need visible content so users understand what the link represents.
When a Docusaurus config link item has a destination but no content, the config no longer matches the documented theme link schema and the rendered navigation becomes ambiguous.
โ Incorrectโ
export default {
themeConfig: {
navbar: {
items: [
{
to: "/docs/intro",
},
],
},
},
};
โ Correctโ
export default {
themeConfig: {
navbar: {
items: [
{
label: "Docs",
to: "/docs/intro",
},
],
},
},
};
Behavior and migration notesโ
This rule reports only. It does not autofix.
Choosing the right visible content for a link is a UX and content decision, not a safe automatic rewrite.
Additional examplesโ
โ Correct โ footer HTML pass-through itemโ
export default {
themeConfig: {
footer: {
links: [
{
html: "<strong>Docs</strong>",
},
],
},
},
};
ESLint flat config exampleโ
import docusaurus2 from "eslint-plugin-docusaurus-2";
export default [docusaurus2.configs.recommended];
When not to use itโ
Do not use this rule if your project intentionally permits unlabeled theme-config link items and you do not want linting to enforce the documented Docusaurus navigation schema.
Rule catalog ID: R030