Skip to content

duplicateProps

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.

This rule should generally always be enabled as duplicate props are almost always a mistake. The only scenario where you might want to disable it is if you’re using advanced JSX transformations that intentionally rely on duplicate props for some specific behavior.

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