question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

New Rule: require-button-type

See original GitHub issue

It is very easy to forget type="button" on <button> elements and accidentally create a submit button. I think a rule to enforce the usage of an explicit type attribute on buttons might make sense.

@rwjblue thoughts?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Turbo87commented, Oct 24, 2019

not sure, I think it probably should still set an explicit default value.

0reactions
johanrdcommented, Jul 31, 2020

OK, I understand.

A sensible approach in my case could then be to disable the global require-button-type, and instead add an instruction manually before every relevant form tag:

{{!-- template-lint-enable require-button-type --}}
<form>

…I guess it is a matter of taste whether require-button-type should be true or false in the default config. Since the rule goes beyond its intended scope, I’d lean towards defaulting it to false, but I guess it may also be a good trade-off for most people to just write type="button" on all buttons.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Todo In Ember Template Lint
The new todo feature in the ember-template-lint addon provides a new option to the existing states for linting rules.
Read more >
ember-template-lint - npm
When the ember-template-lint executable is run, we would have a single result indicating that the no-bare-strings rule found an error.
Read more >
ember-template-lint/README.md - UNPKG
This addon is installed by default with new Ember apps, so check your package.json before installing to see if you need to install...
Read more >
indent - HTML ESLint
indent. Enforce consistent indentation. How to use .eslintrc.js module.exports = { rules: ...
Read more >
New Rules - ESLint - Pluggable JavaScript Linter
We prefer that new rules be implemented in plugins. Core Rule Guidelines. In general, ESLint core rules must be: Widely applicable. The rules...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found