require-head-tag-tag-name
Require top-level headTags entries to declare a non-empty tagName.
Targeted pattern scopeโ
This rule targets docusaurus.config.* files and inspects the top-level headTags array.
What this rule reportsโ
This rule reports headTags object entries whose tagName is missing or statically empty.
Why this rule existsโ
headTags entries are only useful when Docusaurus knows which HTML tag to emit. Requiring an explicit tagName makes head configuration clearer and less error-prone.
โ Incorrectโ
export default {
headTags: [
{
attributes: { rel: "preconnect", href: "https://github.com" },
},
],
};
โ Correctโ
export default {
headTags: [
{
tagName: "link",
attributes: { rel: "preconnect", href: "https://github.com" },
},
],
};
Behavior and migration notesโ
This rule reports and provides suggestions to set tagName based on static clues:
linkwhenattributes.relorattributes.hrefis presentmetawhen common metadata attributes are presentscriptwheninnerHTMLis present
When no clear clue exists, it still offers generic meta / link / script suggestions.
When not to use itโ
Do not use this rule if your project intentionally injects incomplete head-tag descriptors for later transformation.
Rule catalog ID: R062