eslint-plugin-react: `react/no-unused-prop-types` fails when omitted once
In the following example I’m getting a false positive. Probably because I’ve used omit.
'onMeasure' PropType is defined but prop is never used
react/no-unused-prop-types
<Measure
onMeasure={ (dimensions) => {
this.props.onMeasure(dimensions);
} }
>
<ComposedComponent { ...omit(this.props, 'onMeasure') } { ...this.state }>
{ this.props.children }
</ComposedComponent>
</Measure>
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 20 (11 by maintainers)
There’s no way for any linter to know what you’re dynamically picking - you should instead destructure those out like
const { currentSubmission, addLocation, submissionFieldChange, cancelSubmission } = this.props;, and then it’ll be able to detect it.