Skip to content

A platform for community discussion. Free, open, simple.

DEV: Fix and enable the 'require-button-type' lint

Kane Yorkc670a3401380
diff --git a/.template-lintrc.js b/.template-lintrc.js
index 1150803258f..b0a14bbf223 100644
--- a/.template-lintrc.js
+++ b/.template-lintrc.js
@@ -43,8 +43,8 @@ module.exports = {
"no-unnecessary-concat": true,
"no-unnecessary-component-helper": true,
"no-unused-block-params": true,
- quotes: "double",
- "require-button-type": false,
+ "quotes": "double",
+ "require-button-type": true,
"require-iframe-title": true,
"require-valid-alt-text": false,
"self-closing-void-elements": true,
diff --git a/app/assets/javascripts/admin/templates/customize-themes-show.hbs b/app/assets/javascripts/admin/templates/customize-themes-show.hbs
index c391701c15a..186cd9b3580 100644
--- a/app/assets/javascripts/admin/templates/customize-themes-show.hbs
+++ b/app/assets/javascripts/admin/templates/customize-themes-show.hbs
@@ -15,7 +15,7 @@
{{#each model.errors as |error|}}
<div class="alert alert-error">
- <button class="close" data-dismiss="alert">×</button>
+ <button type="button" class="close" data-dismiss="alert" aria-label={{i18n "modal.dismiss_error"}}>×</button>
{{error}}
</div>
{{/each}}
diff --git a/app/assets/javascripts/discourse/templates/components/d-modal.hbs b/app/assets/javascripts/discourse/templates/components/d-modal.hbs
index f9e2c830ddf..1a81e466d22 100644
--- a/app/assets/javascripts/discourse/templates/components/d-modal.hbs
+++ b/app/assets/javascripts/discourse/templates/components/d-modal.hbs
@@ -33,7 +33,7 @@
{{#each errors as |error|}}
<div class="alert alert-error">
- <button class="close" data-dismiss="alert" aria-label={{i18n "modal.dismiss_error"}}>×</button>
+ <button type="button" class="close" data-dismiss="alert" aria-label={{i18n "modal.dismiss_error"}}>×</button>
{{error}}
</div>
{{/each}}
diff --git a/app/assets/javascripts/discourse/templates/components/google-search.hbs b/app/assets/javascripts/discourse/templates/components/google-search.hbs
index ce28f58662c..cbe90dcbce1 100644
--- a/app/assets/javascripts/discourse/templates/components/google-search.hbs
+++ b/app/assets/javascripts/discourse/templates/components/google-search.hbs
@@ -2,6 +2,6 @@
<form action="//google.com/search" id="google-search">
<input type="text" name="q" value={{searchTerm}}>
<input name="as_sitesearch" value={{siteUrl}} type="hidden">
- <button class="btn btn-primary">{{i18n "search.search_google_button"}}</button>
+ <button class="btn btn-primary" type="submit">{{i18n "search.search_google_button"}}</button>
</form>
</div>
diff --git a/app/assets/javascripts/discourse/templates/components/login-buttons.hbs b/app/assets/javascripts/discourse/templates/components/login-buttons.hbs
index 85ba0d68701..c81a7745eaa 100644
--- a/app/assets/javascripts/discourse/templates/components/login-buttons.hbs
+++ b/app/assets/javascripts/discourse/templates/components/login-buttons.hbs
@@ -1,5 +1,5 @@
{{#each buttons as |b|}}
- <button class="btn btn-social {{b.name}}" {{action externalLogin b}}>
+ <button type="button" class="btn btn-social {{b.name}}" {{action externalLogin b}}>
{{#if b.isGoogle}}
<svg class="fa d-icon d-icon-custom-google-oauth2 svg-icon" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 48 48"><defs><path id="a" d="M44.5 20H24v8.5h11.8C34.7 33.9 30.1 37 24 37c-7.2 0-13-5.8-13-13s5.8-13 13-13c3.1 0 5.9 1.1 8.1 2.9l6.4-6.4C34.6 4.1 29.6 2 24 2 11.8 2 2 11.8 2 24s9.8 22 22 22c11 0 21-8 21-22 0-1.3-.2-2.7-.5-4z"/></defs><clipPath id="b"><use xlink:href="#a" overflow="visible"/></clipPath><path clip-path="url(#b)" fill="#FBBC05" d="M0 37V11l17 13z"/><path clip-path="url(#b)" fill="#EA4335" d="M0 11l17 13 7-6.1L48 14V0H0z"/><path clip-path="url(#b)" fill="#34A853" d="M0 37l30-23 7.9 1L48 0v48H0z"/><path clip-path="url(#b)" fill="#4285F4" d="M48 48L17 24l-4-3 35-10z"/></svg>
{{else if b.icon}}
diff --git a/app/assets/javascripts/discourse/templates/components/topic-timer-info.hbs b/app/assets/javascripts/discourse/templates/components/topic-timer-info.hbs
index 7741113b5de..8a546ab7913 100644
--- a/app/assets/javascripts/discourse/templates/components/topic-timer-info.hbs
+++ b/app/assets/javascripts/discourse/templates/components/topic-timer-info.hbs
@@ -4,7 +4,7 @@
{{clockIcon}} {{notice}}
</span>
{{#if showTrashCan}}
- <button class="btn topic-timer-remove no-text" title={{trashCanTitle}}>
+ <button type="button" class="btn topic-timer-remove no-text" title={{trashCanTitle}}>
{{trashCanIcon}}
</button>
{{/if}}
diff --git a/app/assets/javascripts/wizard/templates/components/invite-list-user.hbs b/app/assets/javascripts/wizard/templates/components/invite-list-user.hbs
index 15c822bcf15..790586fa8de 100644
--- a/app/assets/javascripts/wizard/templates/components/invite-list-user.hbs
+++ b/app/assets/javascripts/wizard/templates/components/invite-list-user.hbs
@@ -1,6 +1,6 @@
<span class="email">{{user.email}}</span>
<span class="role">{{roleName}}</span>
-<button class="wizard-btn small danger remove-user" {{action removeUser user}}>
+<button type="button" class="wizard-btn small danger remove-user" {{action removeUser user}}>
{{d-icon "times"}}
</button>
diff --git a/app/assets/javascripts/wizard/templates/components/invite-list.hbs b/app/assets/javascripts/wizard/templates/components/invite-list.hbs
index 1c6f7806844..5c829fb9dc2 100644
--- a/app/assets/javascripts/wizard/templates/components/invite-list.hbs
+++ b/app/assets/javascripts/wizard/templates/components/invite-list.hbs
@@ -19,7 +19,7 @@
onChange=(action (mut inviteRole))
}}
- <button class="wizard-btn small add-user" {{action "addUser"}}>
+ <button type="button" class="wizard-btn small add-user" {{action "addUser"}}>
{{d-icon "plus"}}{{i18n "wizard.invites.add_user"}}
</button>
</div>
diff --git a/app/assets/javascripts/wizard/templates/components/wizard-step.hbs b/app/assets/javascripts/wizard/templates/components/wizard-step.hbs
index 1f0b84a8574..01650e3ca0b 100644
--- a/app/assets/javascripts/wizard/templates/components/wizard-step.hbs
+++ b/app/assets/javascripts/wizard/templates/components/wizard-step.hbs
@@ -35,7 +35,7 @@
{{/if}}
{{#if showFinishButton}}
- <button {{action "exitEarly"}} disabled={{saving}} tabindex="10" class="wizard-btn finish">
+ <button {{action "exitEarly"}} disabled={{saving}} tabindex="10" type="button" class="wizard-btn finish">
{{i18n "wizard.finish"}}
</button>
{{/if}}
@@ -45,14 +45,14 @@
{{/if}}
{{#if showNextButton}}
- <button {{action "nextStep"}} disabled={{saving}} tabindex="10" class="wizard-btn next primary">
+ <button {{action "nextStep"}} disabled={{saving}} tabindex="10" type="button" class="wizard-btn next primary">
{{i18n "wizard.next"}}
{{d-icon "chevron-right"}}
</button>
{{/if}}
{{#if showDoneButton}}
- <button {{action "quit"}} disabled={{saving}} tabindex="10" class="wizard-btn done">
+ <button {{action "quit"}} disabled={{saving}} tabindex="10" type="button" class="wizard-btn done">
{{i18n "wizard.done"}}
</button>
{{/if}}