Skip to content

react/boolean-prop-naming rule only applies if PropType.bool is used #2602

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
UltraTempest opened this issue Mar 23, 2020 · 3 comments
Closed

Comments

@UltraTempest
Copy link

UltraTempest commented Mar 23, 2020

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.

ajkovar added a commit to ajkovar/eslint-plugin-react that referenced this issue Jul 2, 2020
ajkovar added a commit to ajkovar/eslint-plugin-react that referenced this issue Jul 2, 2020
@ajkovar
Copy link
Contributor

ajkovar commented Jul 2, 2020

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.

@ljharb
Copy link
Member

ljharb commented Jul 5, 2020

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

@ajkovar
Copy link
Contributor

ajkovar commented Jul 6, 2020

Sure thing. PR created.

@ljharb ljharb closed this as completed in c8915b1 Jul 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants