From 06d8df52c11d97f253af6d798ae3fde2a4a1570d Mon Sep 17 00:00:00 2001 From: yosuke ota Date: Fri, 5 Feb 2021 09:47:04 +0900 Subject: [PATCH] Change vue/html-button-has-type rule - Enable type checking - Format - Exclude from recommended category - Exclude `Button` component from check --- docs/rules/README.md | 2 +- docs/rules/html-button-has-type.md | 17 ++-- lib/configs/recommended.js | 1 - lib/rules/html-button-has-type.js | 84 ++++++++++++---- tests/lib/rules/html-button-has-type.js | 124 +++++++++++++++++------- 5 files changed, 164 insertions(+), 64 deletions(-) diff --git a/docs/rules/README.md b/docs/rules/README.md index 6b9680a97..d00e5478b 100644 --- a/docs/rules/README.md +++ b/docs/rules/README.md @@ -263,7 +263,6 @@ Enforce all the rules in this category, as well as all higher priority rules, wi |:--------|:------------|:---| | [vue/attributes-order](./attributes-order.md) | enforce order of attributes | :wrench: | | [vue/component-tags-order](./component-tags-order.md) | enforce order of component top-level elements | | -| [vue/html-button-has-type](./html-button-has-type.md) | disallow usage of button without an explicit type attribute | | | [vue/no-lone-template](./no-lone-template.md) | disallow unnecessary ``, errors: [ { - message: 'button is a forbidden value for button type attribute.' + message: 'button is a forbidden value for button type attribute.', + line: 2, + column: 30 }, { - message: 'submit is a forbidden value for button type attribute.' + message: 'submit is a forbidden value for button type attribute.', + line: 3, + column: 30 }, { - message: 'reset is a forbidden value for button type attribute.' + message: 'reset is a forbidden value for button type attribute.', + line: 4, + column: 30 } ] }, @@ -135,25 +173,34 @@ ruleTester.run('html-button-has-type', rule, { `, errors: [ { - message: 'reset is a forbidden value for button type attribute.' + message: 'reset is a forbidden value for button type attribute.', + line: 4, + column: 30 }, { - message: 'A value must be set for button type attribute.' + message: 'A value must be set for button type attribute.', + line: 5, + column: 30 }, { - message: 'foo is an invalid value for button type attribute.' + message: 'foo is an invalid value for button type attribute.', + line: 6, + column: 30 } ] }, { filename: 'test.vue', - code: '', + code: + '', errors: [ { - message: 'Missing an explicit type attribute for button.' + message: 'Missing an explicit type attribute for button.', + column: 11 }, { - message: 'Missing an explicit type attribute for button.' + message: 'Missing an explicit type attribute for button.', + column: 39 } ] }, @@ -162,7 +209,18 @@ ruleTester.run('html-button-has-type', rule, { code: ``, errors: [ { - message: 'A value must be set for button type attribute.' + message: 'A value must be set for button type attribute.', + column: 25 + } + ] + }, + { + filename: 'test.vue', + code: ``, + errors: [ + { + message: 'A value must be set for button type attribute.', + column: 19 } ] } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy