@hint/hint-button-type
TypeScript icon, indicating that this package has built-in type declarations

3.0.23 • Public • Published

Specify button type (button-type)

button-type checks if all buttons have a type attribute set.

Why is this important?

The default type for <button> is submit (not type="button" as one might expect). This can lead to surprising keyboard behavior within a form.

The best way to avoid unexpected surprises is to always explicitly set a type on <button>s.

What does the hint check?

This hint checks whether the type attribute of a <button> is explicitly set.

Examples that trigger the hint

<button></button>

Examples that pass the hint

<button type="submit"></button>
<button type="button"></button>

How to use this hint?

This package is installed automatically by webhint:

npm install hint --save-dev

To use it, activate it via the .hintrc configuration file:

{
    "connector": {...},
    "formatters": [...],
    "parsers": [...],
    "hints": {
        "button-type": "error"
    },
    ...
}

Note: The recommended way of running webhint is as a devDependency of your project.

Further Reading

What can the user read to know more about this subject?

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
3.0.2314,486latest

Version History

VersionDownloads (Last 7 Days)Published
3.0.2314,486
3.0.22423
3.0.2115
3.0.2044
3.0.1912
3.0.1819
3.0.178
3.0.162
3.0.151
3.0.140
3.0.131
3.0.120
3.0.111
3.0.101
3.0.90
3.0.80
3.0.70
3.0.66
3.0.51
3.0.40
3.0.30
3.0.20
3.0.10
3.0.00
2.3.34
2.3.20
2.3.10
2.3.00
2.2.1111
2.2.100
2.2.90
2.2.80
2.2.70
2.2.60
2.2.50
2.2.40
2.2.30
2.2.20
2.2.10
2.2.01
2.1.20
2.1.10
2.1.01
2.0.12
2.0.00
1.0.11
1.0.00

Package Sidebar

Install

npm i @hint/hint-button-type

Homepage

webhint.io/

Weekly Downloads

2,891

Version

3.0.23

License

Apache-2.0

Unpacked Size

20.5 kB

Total Files

13

Last publish

Collaborators

  • leotlee
  • vidorteg
  • oaflynn
  • molant
  • antross