-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Handle isRequired for boolean-prop-naming #1701
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For both of the added tests, can you add a duplicate copy that parses with the default parser instead of babel-eslint?
lib/rules/boolean-prop-naming.js
Outdated
const name = node.value.property.name; | ||
if (name === 'isRequired') { | ||
return node.value.object.property.name; | ||
} | ||
return node.value.property.name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can be return name;
now?
@ljharb Absolutely. On it. |
@ljharb Actually, just gave it a shot, and it seems that any test that uses class properties needs that parser. If I remove it, I get |
Would love to see this get in |
@louisscruz indeed; the code examples using class properties would need to be tweaked so as not to use them. |
@ljharb Oh, I see what you're getting at. Will add those. |
@ljharb Added! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@yannickcr Any chance you could publish this so I can get access to this bug fix by default? |
The Problem
There was a bug in boolean-prop-naming where the following would trip the rule:
but the following would not:
The Solution
I added an extra conditional to
getPropKey
to handle this scenario.