From 28e14f0815c0649aaeddd4dabff7b701b442b30a Mon Sep 17 00:00:00 2001 From: yosuke ota Date: Tue, 19 May 2020 13:44:00 +0900 Subject: [PATCH] Add `vue/prefer-template` rule --- docs/rules/README.md | 1 + docs/rules/prefer-template.md | 23 +++++++++++ lib/index.js | 1 + lib/rules/prefer-template.js | 11 ++++++ tests/lib/rules/prefer-template.js | 63 ++++++++++++++++++++++++++++++ 5 files changed, 99 insertions(+) create mode 100644 docs/rules/prefer-template.md create mode 100644 lib/rules/prefer-template.js create mode 100644 tests/lib/rules/prefer-template.js diff --git a/docs/rules/README.md b/docs/rules/README.md index 83eda5692..dee76cd27 100644 --- a/docs/rules/README.md +++ b/docs/rules/README.md @@ -292,6 +292,7 @@ For example: | [vue/no-unsupported-features](./no-unsupported-features.md) | disallow unsupported Vue.js syntax on the specified version | :wrench: | | [vue/object-curly-spacing](./object-curly-spacing.md) | enforce consistent spacing inside braces | :wrench: | | [vue/padding-line-between-blocks](./padding-line-between-blocks.md) | require or disallow padding lines between blocks | :wrench: | +| [vue/prefer-template](./prefer-template.md) | require template literals instead of string concatenation | :wrench: | | [vue/require-direct-export](./require-direct-export.md) | require the component to be directly exported | | | [vue/require-explicit-emits](./require-explicit-emits.md) | require `emits` option with name triggered by `$emit()` | | | [vue/require-name-property](./require-name-property.md) | require a name property in Vue components | | diff --git a/docs/rules/prefer-template.md b/docs/rules/prefer-template.md new file mode 100644 index 000000000..cbc6d8125 --- /dev/null +++ b/docs/rules/prefer-template.md @@ -0,0 +1,23 @@ +--- +pageClass: rule-details +sidebarDepth: 0 +title: vue/prefer-template +description: require template literals instead of string concatenation +--- +# vue/prefer-template +> require template literals instead of string concatenation + +- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule. + +This rule is the same rule as core [prefer-template] rule but it applies to the expressions in `