Skip to content

propDuplicates

Disallow duplicate props in JSX elements.

✅ This rule is included in the jsx logical preset.

When a JSX element has multiple props with the same name, only the last occurrence takes effect. This can lead to unexpected behavior and makes the code harder to understand and maintain. Duplicate props are typically the result of copy-paste errors or merge conflicts that were not properly resolved.

<div id="first" id="second">
Content
</div>
<button className="btn" onClick={handleClick} className="btn-primary">
Click me
</button>
<input type="text" name="field" type="email" />

This rule is not configurable.

If your codebase uses code generation that relies on uncommon JavaScript semantics such as duplicate prop names, this rule might not be for you.

Made with ❤️‍🔥 in Boston by Josh Goldberg and contributors.