Socket
Socket
Sign inDemoInstall

@hint/hint-button-type

Package Overview
Dependencies
472
Maintainers
5
Versions
46
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @hint/hint-button-type

Check if button has type attribute set


Version published
Weekly downloads
15K
decreased by-11.8%
Maintainers
5
Created
Weekly downloads
 

Readme

Source

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?

Keywords

FAQs

Last updated on 27 Jun 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc