-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
no-unused-prop-types false errors #861
Comments
Have a similar problem in a different context, when this.props is destructured it does not detect the property. import React, { Component, PropTypes } from 'react'
export default class MenuSlice extends Component {
static propTypes = {
positions: PropTypes.shape({
IconX: PropTypes.number.isRequired,
}).isRequired
}
renderLabel() {
const { positions } = this.props
const sliceIconTextOptions = {
x: positions.IconX // not detected
// x: this.props.positions.IconX (validates correctly)
}
return (
<div {...sliceIconTextOptions} />
)
}
render() {
return (
<div>
{this.renderLabel()}
</div>
)
}
} |
I just enabled this rule and I am getting a lot of false alarms. |
Same here:
Failing example with deconstructed props:
Working example with non deconstructed props:
|
The Duplicate of #819. Will track further discussion of |
For this code:
I use this plugin to convert the FlowJS types to React Prop Types:
When I run
eslint
I get:I got the same problem for every property of an object when I define it as objects, even if I really use the props
The text was updated successfully, but these errors were encountered: