no-empty-head-tags
Disallow top-level headTags entries that do not contribute meaningful attributes or inline content.
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 that do not provide useful output, including entries with:
- no
attributesand noinnerHTML - an empty static
attributesobject - empty static
innerHTML
Why this rule existsโ
Empty head-tag entries add noise to configuration and can hide copy/paste mistakes. Removing them keeps the site head configuration easier to review.
โ Incorrectโ
export default {
headTags: [{ tagName: "meta" }],
};
export default {
headTags: [{ tagName: "meta", attributes: {} }],
};
โ Correctโ
export default {
headTags: [
{
tagName: "link",
attributes: { rel: "preconnect", href: "https://github.com" },
},
],
};
Behavior and migration notesโ
This rule autofixes by removing empty headTags entries from static arrays.
When not to use itโ
Do not use this rule if your configuration intentionally includes placeholder head-tag entries for a later transformation step.
Rule catalog ID: R063