-
-
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
react/prop-types is missing in props validation on destructured prop types #2343
Comments
Are you saying it crashes? Either way, i'd expect both the spread there to be unnecessary (just |
@ljharb You're right, the spread is unnecessary. It's not crashing, its giving an error and I had to add an eslint-disable to it. I'm fine with it not doing the static check because I understand that limitation, but I think it would be preferred that instead of erroring, it does nothing at all and logs nothing and just ignores it without having to eslint-disable it, like it seemed to do with previous versions prior to this update. |
In this case tho, the linter can't know if your imported shape is correct, or if it's missing properties. The only way to be sure is to force a human to explicitly verify that - which is what the lint error does by forcing you to use an eslint override comment. What you're suggesting isn't a safe default, since it would silently ignore possibly incorrect patterns. |
@ljharb that's fair, and thanks for the explanation. I'm going to close this as a non-issue then. I am still curious though why this didn't error in prior versions? The code has been unchanged since we were probably on ESLint 2.x way back when. Were there updates made to this plugin to change that or do you think its an internal ESLint change that got smarter and started to cause this then? Appreciate the discussion as well. |
|
@golopot perfect, thank you very much. |
I just recently upgraded to the latest version and started to see this. My component has proptypes that include
NotificationPropTypes are:
Offending code:
Its the
notification.id
part that its complaining about (id). Any reason why this would start to error now?The text was updated successfully, but these errors were encountered: