-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Labels
Description
When following react/destructuring-assignment, if my prop shares a name with another constant I rename it during the destructure (prop.styles to propStyles below) to avoid the collision, I then start getting warned that styles.posterImage' is missing in props validation etc. for all keys of the styles object.
import styles from '../styles/Video'
// ...
render() {
const { altText, styles: propStyles, posterUrl, videoUrl, subtitleUrl } = this.props
const poster = (
<>
<img
className={css(propStyles, styles.posterImage, this.state.isHovering && styles.zoomed)}
src={posterUrl}
alt={altText}
/>
Expected behavior: styles is not recognized as a prop after destructuring but propStyles is. No false positives on constants that share name with renamed prop's original name on the props object.