no-implicit-button-type
Angular templatesHTMLVue / SvelteVue / Sveltesuspiciousno fixdefault: offhtml/html-validate-recommendedhtml/htmlhint
What it does
Section titled “What it does”Reports a <button> with no type. A Svelte spread ({...props}) may carry the type and is not reported.
Why it matters
Section titled “Why it matters”A button without a type is a submit button, so inside a form a click sends the form, which is rarely meant for a button that opens a menu or toggles a panel.
To fix, add type="button", or type="submit" if it should submit.
Example
Section titled “Example”...<h3>text</h3>...<div role="button"></div><button>Go</button><button type="button">Go</button>...<input type="text" name="b">...Configuration
Section titled “Configuration”angular: lint: rules: no-implicit-button-type: warn # off (default), warn, errorhtml: lint: rules: no-implicit-button-type: warn # off (default), warn, errorsvelte: lint: rules: no-implicit-button-type: warn # off (default), warn, errorvue: lint: rules: no-implicit-button-type: warn # off (default), warn, errorEnabled by the presets: html/html-validate-recommended, html/htmlhint.
Suppress one line with sudsy-disable-next-line no-implicit-button-type in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools. full: Sudsy reports what the upstream rule reports; partial: only part of it, as the last column says.
| Tool | Rule | Match | What differs |
|---|---|---|---|
| angular-eslint | button-has-type |
full | |
| eslint-plugin-svelte | button-has-type |
partial | a missing type only, not an invalid value |
| eslint-plugin-vue | html-button-has-type |
partial | a missing type only, not an invalid value |
| html-eslint | require-button-type |
full | |
| html-validate | no-implicit-button-type |
full | |
| htmlhint | button-type-require |
full |