Eslint-plugin-react: no-unused-prop-types fails on readonly flow types

Created on 22 Aug 2017  路  5Comments  路  Source: yannickcr/eslint-plugin-react

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
bug flow help wanted

Most helpful comment

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...

All 5 comments

What version of flow are you using?

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

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...

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.

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

Was this page helpful?
0 / 5 - 0 ratings