-
-
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
False positives for [no-unused-prop-types] when props is assigned to a local variable #2177
Comments
Presumably if you |
Yep, it passes on destructuring props. |
Although I’d strongly recommend that pattern, yours should certainly work if possible. |
@ljharb the optimal solution would be to handle every possible edge case but things can get out of hand very quickly. Like:
var props = this.props
var moreProps = {more: true, ...props}
// ... do something with moreProps In the case presented by this issue what would be the added value of this: customizeNotifications() {
const props = this.props;
return props.notifications.map((notification) => `foo${notification}`);
} vs customizeNotifications() {
return this.props.notifications.map((notification) => `foo${notification}`);
} |
I don't think there's much added value - they should do I think eslint provides a number of utilities to make tracking the source of a variable easier? |
Awesome.
Yeah, you can use |
Eslint complains about
notifications
prop as unused.The text was updated successfully, but these errors were encountered: