react/jsx-key is triggering false positive for props defined as an object properties
See original GitHub issueSometimes it is useful to define a component call as
<Component {...{ key: id, id, shortTitle }} />
instead of
<Component key={id} id={id} shortTitle={shortTitle} />
but in the first case ESLint gets mad about the missing key
prop, triggering the react/jsx-key
rule.
This is the reason why I’m turning this rule off for now. I believe this should be fixed.
Issue Analytics
- State:
- Created 5 years ago
- Comments:16 (9 by maintainers)
Top Results From Across the Web
false positive in prop-types validation - reactjs - Stack Overflow
It accesses props.url and has no propTypes . However, I think this is a bug because the plugin should realize that props are...
Read more >Object.defineProperties() - JavaScript - MDN Web Docs - Mozilla
The Object.defineProperties() method defines new or modifies existing properties directly on an object, returning the object.
Read more >How passing props to component works in React
Master how to pass props (properties) to components in React with this useful beginner's guide, including demo code.
Read more >Data Structures: Objects and Arrays - Eloquent JavaScript
Comparing different objects will return false , even if they have identical properties. There is no “deep” comparison operation built into JavaScript, ...
Read more >3 Ways to Check If an Object Has a Property in JavaScript
hasOwnProperty('realName ') returns false — denoting a missing property. ... The own properties are those defined directly upon the object.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
https://github.com/reactjs/rfcs/pull/107
Can we take a step back here? We have a request for a change to React, which may never happen … and because of that ESLint refuses to even provide the option to mark 100% valid code (today) as valid?
How does this make sense?