Skip to main content

no-duplicate-plugin-pwa-head-tags

Disallow duplicate @docusaurus/plugin-pwa pwaHead object entries.

Targeted pattern scopeโ€‹

This rule targets docusaurus.config.* files and inspects @docusaurus/plugin-pwa option objects, specifically their pwaHead arrays.

What this rule reportsโ€‹

This rule reports duplicate pwaHead object entries that repeat an earlier tag definition with the same property/value signature.

Why this rule existsโ€‹

Duplicate head-tag entries make PWA config harder to audit and can produce redundant metadata/link entries in generated pages.

โŒ Incorrectโ€‹

export default {
plugins: [
[
"@docusaurus/plugin-pwa",
{
pwaHead: [
{
tagName: "link",
rel: "manifest",
href: "/manifest.json",
},
{
tagName: "link",
rel: "manifest",
href: "/manifest.json",
},
],
},
],
],
};

โœ… Correctโ€‹

export default {
plugins: [
[
"@docusaurus/plugin-pwa",
{
pwaHead: [
{
tagName: "link",
rel: "manifest",
href: "/manifest.json",
},
{
tagName: "meta",
name: "theme-color",
content: "#25c2a0",
},
],
},
],
],
};

Behavior and migration notesโ€‹

This rule autofixes by removing duplicate pwaHead object entries after the first occurrence.

When not to use itโ€‹

Do not use this rule if your pwaHead entries are intentionally duplicated for custom runtime mutation behavior.

Rule catalog ID: R053

Further readingโ€‹