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
rule proposal: force boolean props to be auxiliary verb's #970
Comments
I'd be happy to help review a PR that adds this. What do you plan to call it? It would also be nice to have an option to enforce the opposite. |
Sounds good! |
Before making a PR, we may want to think about the schema a bit. For example, I can see wanting exceptions - ie, "require auxiliary verbs for boolean props, except for props that have these names", or "forbid auxiliary verbs for boolean props, except for props that have these names". I can also see wanting to include additional PropTypes in this - in other words, if I have a custom propTypes that is in fact a boolean but has additional validation, I might want the same require/forbid behavior. It's very important to think about how this rule can be extended, even if the initial PR doesn't need to contain all those features. |
Good thinking. In its most general sense this rule is suffix conventions for particular prop types - built in or custom. With the suffix being a limited set of words. In the case of auxiliary verbs it would be 'is, can, should...' and so on. |
What schema do you have in mind for allowing the user to specify the propTypes? What about to exempt specific prop names from the rule? |
I think this has been achieved in |
Our code base is looking to enforce the use of auxiliary verb's (eg is, was, should and so on) for boolean props
I was going to write a custom babel plugin for this but I thought it might be a general enough case to put in this repo. I would be happy to write the rule and associated tests.
Cheers
The text was updated successfully, but these errors were encountered: