Skip to content

no-implicit-button-type

Reports a <button> with no type. A Svelte spread ({...props}) may carry the type and is not reported.

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.

Reported
...
<h3>text</h3>
...
<div role="button"></div>
<button>Go</button>
<button type="button">Go</button>
...
<input type="text" name="b">
...
angular:
lint:
rules:
no-implicit-button-type: warn # off (default), warn, error
html:
lint:
rules:
no-implicit-button-type: warn # off (default), warn, error
svelte:
lint:
rules:
no-implicit-button-type: warn # off (default), warn, error
vue:
lint:
rules:
no-implicit-button-type: warn # off (default), warn, error

Enabled 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.

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