Eslint-plugin-react: react/boolean-prop-naming rule only applies if PropType.bool is used

Created on 23 Mar 2020  ·  3Comments  ·  Source: yannickcr/eslint-plugin-react

I have:

import PropTypes from 'prop-types';
...
// eslint-disable-next-line react/boolean-prop-naming
open: PropTypes.bool.isRequired,

But if I do

import { bool } from 'prop-types';
...
open: bool.isRequired,

instead then I don't need to ignore the rule & the rule is not applied.

The rule should be applied in the case of a named export of bool from prop-types.

enhancement help wanted

All 3 comments

I added a test for this and it seems to pass? Or maybe there is some other way to reproduce it? 🤷‍♂️ Let me know if you'd like me to create a PR. I didn't see a similar test present.

@ajkovar it'd be great if you sent a PR with that test, so we can close this issue with it :-)

Sure thing. PR created.

Was this page helpful?
0 / 5 - 0 ratings