Skip to content

Latest commit

 

History

History
39 lines (24 loc) · 1.38 KB

no-duplicate-attributes.md

File metadata and controls

39 lines (24 loc) · 1.38 KB

no-duplicate-attributes

✅ The extends: 'recommended' property in a configuration file enables this rule.

🔧 The --fix option on the command line can automatically fix some of the problems reported by this rule.

This rule forbids multiple attributes passed to a Component, Helper, or an ElementNode with the same name. According to the HTML attributes Spec:

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

This is also a violation of WCAG 4.1.1 - Parsing (Level A):

In content implemented using markup languages, elements have complete start and end tags, elements are nested according to their specifications, elements do not contain duplicate attributes, and any IDs are unique, except where the specifications allow these features.

Examples

This rule forbids the following:

<EmployeeDetails class="something" class="something" />
{{employee-details name=name age=age name=otherThing}}

This rule allows the following:

<EmployeeDetails class="something" class="something" />
{{employee-details name=name age=age}}

References