From 86d22b6cb7001cbcc4966a827d1123d5f38e0c66 Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Wed, 30 Dec 2020 23:34:49 +0100 Subject: [PATCH 1/5] Add `vue/no-constant-condition` rule --- docs/rules/README.md | 1 + docs/rules/no-constant-condition.md | 29 ++++++ lib/index.js | 1 + lib/rules/no-constant-condition.js | 27 ++++++ tests/lib/rules/no-constant-condition.js | 111 +++++++++++++++++++++++ 5 files changed, 169 insertions(+) create mode 100644 docs/rules/no-constant-condition.md create mode 100644 lib/rules/no-constant-condition.js create mode 100644 tests/lib/rules/no-constant-condition.js diff --git a/docs/rules/README.md b/docs/rules/README.md index 5f848467b..9e4fc1115 100644 --- a/docs/rules/README.md +++ b/docs/rules/README.md @@ -347,6 +347,7 @@ The following rules extend the rules provided by ESLint itself and apply them to | [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/max-len](./max-len.md) | enforce a maximum line length | | +| [vue/no-constant-condition](./no-constant-condition.md) | disallow constant expressions in conditions | | | [vue/no-empty-pattern](./no-empty-pattern.md) | disallow empty destructuring patterns | | | [vue/no-extra-parens](./no-extra-parens.md) | disallow unnecessary parentheses | :wrench: | | [vue/no-irregular-whitespace](./no-irregular-whitespace.md) | disallow irregular whitespace | | diff --git a/docs/rules/no-constant-condition.md b/docs/rules/no-constant-condition.md new file mode 100644 index 000000000..54f6df9d0 --- /dev/null +++ b/docs/rules/no-constant-condition.md @@ -0,0 +1,29 @@ +--- +pageClass: rule-details +sidebarDepth: 0 +title: vue/no-constant-condition +description: disallow constant expressions in conditions +since: v7.5.0 +--- +# vue/no-constant-condition + +> disallow constant expressions in conditions + +This rule is the same rule as core [no-constant-condition] rule but it applies to the expressions in `