From 7b291b883503362aec0ba2641adba85848737fc7 Mon Sep 17 00:00:00 2001 From: ota Date: Fri, 1 Feb 2019 21:36:40 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=E2=AD=90=EF=B8=8FNew:=20Add=20`vue/keyword?= =?UTF-8?q?-spacing`=20rule?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/rules/README.md | 1 + docs/rules/keyword-spacing.md | 23 +++++ lib/configs/no-layout-rules.js | 1 + lib/index.js | 1 + lib/rules/keyword-spacing.js | 9 ++ tests/lib/rules/keyword-spacing.js | 142 +++++++++++++++++++++++++++++ 6 files changed, 177 insertions(+) create mode 100644 docs/rules/keyword-spacing.md create mode 100644 lib/rules/keyword-spacing.js create mode 100644 tests/lib/rules/keyword-spacing.js diff --git a/docs/rules/README.md b/docs/rules/README.md index 82baedd01..95fdb7104 100644 --- a/docs/rules/README.md +++ b/docs/rules/README.md @@ -149,6 +149,7 @@ For example: | [vue/dot-location](./dot-location.md) | enforce consistent newlines before and after dots | :wrench: | | [vue/eqeqeq](./eqeqeq.md) | require the use of `===` and `!==` | :wrench: | | [vue/key-spacing](./key-spacing.md) | enforce consistent spacing between keys and values in object literal properties | :wrench: | +| [vue/keyword-spacing](./keyword-spacing.md) | enforce consistent spacing before and after keywords | :wrench: | | [vue/match-component-file-name](./match-component-file-name.md) | require component name property to match its file name | | | [vue/no-boolean-default](./no-boolean-default.md) | disallow boolean defaults | :wrench: | | [vue/no-empty-pattern](./no-empty-pattern.md) | disallow empty destructuring patterns | | diff --git a/docs/rules/keyword-spacing.md b/docs/rules/keyword-spacing.md new file mode 100644 index 000000000..f053a90b3 --- /dev/null +++ b/docs/rules/keyword-spacing.md @@ -0,0 +1,23 @@ +--- +pageClass: rule-details +sidebarDepth: 0 +title: vue/keyword-spacing +description: enforce consistent spacing before and after keywords +--- +# vue/keyword-spacing +> enforce consistent spacing before and after keywords + +- :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 [keyword-spacing] rule but it applies to the expressions in ``, options: [{ before: false, after: false }] - } + }, + `` ], invalid: [ { @@ -137,6 +140,21 @@ tester.run('keyword-spacing', rule, { line: 7 } ] + }, + { + code: + ``, + output: + ``, + errors: [ + { + message: 'Expected space(s) after "return".', + line: 2 + }] } ] })