From e6332123775a4286e121bc9871246cc979221203 Mon Sep 17 00:00:00 2001 From: Yosuke Ota Date: Wed, 20 May 2020 18:25:17 +0900 Subject: [PATCH] Add `vue/comma-spacing` rule (#1140) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ⭐️New: Add `vue/comma-spacing` rule * use skipDynamicArguments --- docs/rules/README.md | 1 + docs/rules/comma-spacing.md | 23 +++ lib/configs/no-layout-rules.js | 1 + lib/index.js | 1 + lib/rules/comma-spacing.js | 12 ++ lib/utils/index.js | 72 +++++++- tests/lib/rules/comma-spacing.js | 283 +++++++++++++++++++++++++++++++ 7 files changed, 389 insertions(+), 4 deletions(-) create mode 100644 docs/rules/comma-spacing.md create mode 100644 lib/rules/comma-spacing.js create mode 100644 tests/lib/rules/comma-spacing.js diff --git a/docs/rules/README.md b/docs/rules/README.md index b89debd60..46652d4e6 100644 --- a/docs/rules/README.md +++ b/docs/rules/README.md @@ -271,6 +271,7 @@ For example: | [vue/brace-style](./brace-style.md) | enforce consistent brace style for blocks | :wrench: | | [vue/camelcase](./camelcase.md) | enforce camelcase naming convention | | | [vue/comma-dangle](./comma-dangle.md) | require or disallow trailing commas | :wrench: | +| [vue/comma-spacing](./comma-spacing.md) | enforce consistent spacing before and after commas | :wrench: | | [vue/component-name-in-template-casing](./component-name-in-template-casing.md) | enforce specific casing for the component naming style in template | :wrench: | | [vue/dot-location](./dot-location.md) | enforce consistent newlines before and after dots | :wrench: | | [vue/eqeqeq](./eqeqeq.md) | require the use of `===` and `!==` | :wrench: | diff --git a/docs/rules/comma-spacing.md b/docs/rules/comma-spacing.md new file mode 100644 index 000000000..d596ee4ea --- /dev/null +++ b/docs/rules/comma-spacing.md @@ -0,0 +1,23 @@ +--- +pageClass: rule-details +sidebarDepth: 0 +title: vue/comma-spacing +description: enforce consistent spacing before and after commas +--- +# vue/comma-spacing +> enforce consistent spacing before and after commas + +- :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 [comma-spacing] rule but it applies to the expressions in `