Skip to content
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

Button tags require type. #894

Closed
1 of 4 tasks
shadow7412 opened this issue May 17, 2019 · 1 comment
Closed
1 of 4 tasks

Button tags require type. #894

shadow7412 opened this issue May 17, 2019 · 1 comment

Comments

@shadow7412
Copy link

Please describe what the rule should do:

All <button> tags require the type to be set.
What category should the rule belong to?

  • Enforces code style
  • Warns about a potential error
  • Suggests an alternate way of doing something
  • Other (please specify:)

Provide 2-3 code examples that this rule should warn about:

<button>Test</button>
<button class="btn btn-danger">Delete</button>

Additional context

Forgetting the type attribute on a button defaults it to being a submit type. This is nearly never what is intended, especially in your average one-page application.

type="button" stops the webpage from submitting the form, instead allowing the @click handler to work without the page reloading soon after.

type="submit" can be used explicitly to allow the default behaviour.

SanterreJo pushed a commit to SanterreJo/eslint-plugin-vue that referenced this issue Dec 7, 2019
SanterreJo added a commit to SanterreJo/eslint-plugin-vue that referenced this issue Dec 7, 2019
SanterreJo added a commit to SanterreJo/eslint-plugin-vue that referenced this issue Dec 7, 2019
@mrleblanc101
Copy link

I hope this get merged soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants