Skip to main content

no-duplicate-attr

info

🔧 This rule supports auto-fix with the --fix option.

Warns that attributes were duplicated in one element. Capital letters and lower-case letters are not distinguished.

Names are compared as the DOM compares them. The names of the attributes of an HTML element and of a custom element are compared without regard to ASCII case, and those of an SVG or MathML element that a framework sets through the DOM API (JSX for example), and the props of a component, are compared as written (<Foo fooBar foobar /> is not a duplicate).

There must never be two or more attributes on the same start tag whose names are an ASCII case-insensitive match for each other.

Cite: HTML Living Standard 13.1.2.3 Attributes

❌ Examples of incorrect code for this rule

<div data-attr="value" data-Attr="db"></div>

✅ Examples of correct code for this rule

<div data-attr="value" data-Attr2="db"></div>

Interface​

{
"no-duplicate-attr": boolean
}

Default Severity​

error