Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/sxzz/eslint-plugin-vuekit. Modern ESLint plugin for Vue 3 eslint-plugin-vuekit.sxzz.dev
eslint plugin vue
Something went wrong. Try again.
1.8 kB · 67 lines
Markdown
at main
pageClass: rule-details sidebarDepth: 0 title: vue/html-button-has-type description: disallow usage of button without an explicit type attribute since: v7.6.0 #
vue/html-button-has-type #
disallow usage of button without an explicit type attribute
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.
📖 Rule Details #
This rule aims to warn if no type or an invalid type is used on a button type attribute.
<template>
<!-- ✓ GOOD -->
<button type="button">Hello World</button>
<button type="submit">Hello World</button>
<button type="reset">Hello World</button>
<!-- ✗ BAD -->
<button>Hello World</button>
<button type="">Hello World</button>
<button type="foo">Hello World</button>
</template>
🔧 Options #
{
"vue/html-button-has-type": ["error", {
"button": true,
"submit": true,
"reset": true
}]
}
button...<button type="button"></button>true(default) ... allow valuebutton.false... disallow valuebutton.
submit...<button type="submit"></button>true(default) ... allow valuesubmit.false... disallow valuesubmit.
reset...<button type="reset"></button>true(default) ... allow valuereset.false... disallow valuereset.
🚀 Version #
This rule was introduced in eslint-plugin-vue v7.6.0