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: validate PropTypes aren't typos #213
Comments
+1, I have the same problem. I also type |
👍 I have done this a lot. The abbreviations are inconsistent. I was presenting on how to write lint rules at my React user group last night, and we live coded a first pass: willklein/scaling-best-practices@901534b Needs more test cases and a few conditions. I'll see if I can get this wrapped up in the next week. |
@willklein have you made any progress on wrapping up this rule? |
Bumping an old issue with a new case: class A extends React.Component {
render() {
return <a href={this.props.href} >{this.props.children}</a>;
}
}
A.PropTypes = {
href: React.PropTypes.string.isRequired,
children: React.PropTypes.node.isRequired,
} This code will be linted by Could this rule find and warn/error on a case where prop types are being set in a component property other than propTypes? |
Rule would check that calls to React.PropTypes.whatever are valid. For instance, I have a bad habit of typing
disabled: PropTypes.bools.isRequired
instead ofdisabled: PropTypes.bool.isRequired
. I've also donedisabled: propTypes.bool.isRequired
anddisabled: propTypes.bool.isRequired()
by accident.The text was updated successfully, but these errors were encountered: