Skip to content

no-unused-prop-types fails on readonly flow types #1388

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

Closed
elicwhite opened this issue Aug 22, 2017 · 5 comments · Fixed by #1390
Closed

no-unused-prop-types fails on readonly flow types #1388

elicwhite opened this issue Aug 22, 2017 · 5 comments · Fixed by #1390

Comments

@elicwhite
Copy link

If your Props type definition is:

type Props = {
  +prop1: ?number,
  +prop2: number,
};

The rule will provide the warnings:

warning  '+' PropType is defined but prop is never used  react/no-unused-prop-types
@ljharb
Copy link
Member

ljharb commented Aug 22, 2017

What version of flow are you using?

@elicwhite
Copy link
Author

elicwhite commented Aug 22, 2017

This error is occurring for us internally at Facebook, we are on latest.

$ flow version
Flow, a static type checker for JavaScript, version 0.53.1

@jseminck
Copy link
Contributor

jseminck commented Aug 22, 2017

Confirmed the bug. Will fix it!

@TheSavior are there any other such syntax that we could test? My fix should tackle all kinds of prefixes, but better save than sorry. I see there is also a - property...

@elicwhite
Copy link
Author

I'm not sure, I'll run this rule through our codebase and flag all of the places that it seems to have false positives. That should give a pretty good signal.

@ljharb
Copy link
Member

ljharb commented Aug 22, 2017

@jseminck there's covariant (+) and contravariant (-), at least

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

3 participants