-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Add a rule enforcing explicit "type" attributes for buttons #1525
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
I'm open to renaming it BTW, maybe |
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 should also validate that the type is one of submit
, button
, or reset
.
Also, it would be ideal to configure each separately, since Airbnb would always forbid using reset
, which is horrific for UX.
Can this perhaps not just apply to jsx, and also apply to React.createElement
?
As for the name, |
Are there some examples of rules that check both JSX and |
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, this LGTM!
I'll give this a day, and then merge if there's no objections. |
By default,
button
elements havetype="submit"
, which usually isn't what you actually want. This rule enforces the button type to be explicitSee also: https://github.com/evcohen/eslint-plugin-jsx-a11y/issues/186#issuecomment-283727911