eslint-plugin-react
eslint-plugin-react copied to clipboard
Skip shape props in flow
Fixes shape type props issue for flow.
I forgot to run the unit test, I'll check and try to update as soon as possible.
There's some test for flow which give error for unused shape prop types. Example:
class Hello extends React.Component {
props: {
name: {
unused: string
}
}
render () {
return <div>Hello {this.props.name.lastname}</div>;
}
}
But in my case, even if I use the prop it gives me error. Here's a example of my component:
type Props = {
position: {
x: number,
y: number
}
};
class Example extends Component {
props: Props
render() {
const { position } = this.props;
return (
<div style={ { left: position.x, top: position.y } }>Hello World</div>
);
}
}
This gives me error position.x prop is defined but never used
. Since currently there's a issue with detecting shape props, should I remove those test cases ? Or just use eslint-disable-line
from my end ?
@Agontuk hi! this PR still needs some tests; any interest in adding some?
@ljharb sorry for the late response, unfortunately I'm not using flow for quite a while. So it's difficult for me to add the required test cases. I hope someone can pick it up and make the required changes.