prefer-head-tag-attributes-object
Require top-level headTags entries to place HTML attributes inside an attributes object.
Targeted pattern scopeโ
This rule targets docusaurus.config.* files and inspects the top-level headTags array.
What this rule reportsโ
This rule reports headTags entries that put HTML attribute-like fields at the root of the tag object instead of inside attributes.
Why this rule existsโ
Docusaurus headTags entries are easier to review and more portable when attribute fields live inside a dedicated attributes object.
โ Incorrectโ
export default {
headTags: [
{
tagName: "link",
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 autofixes straightforward static head-tag objects by moving flat attribute properties into attributes.
When not to use itโ
Do not use this rule if your project intentionally relies on a custom transform that expects flat root properties on head-tag objects.
Rule catalog ID: R068