From 8cf605d712c413513674ab7ea2a4540737485a99 Mon Sep 17 00:00:00 2001 From: Denis Pushkarev Date: Sat, 5 Jun 2021 11:52:22 +0700 Subject: [PATCH] enable `no-lonely-if` `eslint` rule https://github.com/zloirock/core-js/commit/8acc71b00b2102eb49bc40c04f084b20c670bdf1#commitcomment-51752858 --- .eslintrc.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index 531c27513b1c..8024c68f3176 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -240,6 +240,8 @@ const base = { 'new-cap': ['error', { newIsCap: true, capIsNew: false }], // require parentheses when invoking a constructor with no arguments 'new-parens': 'error', + // disallow `if` as the only statement in an `else` block + 'no-lonely-if': 'error', // disallow mixed spaces and tabs for indentation 'no-mixed-spaces-and-tabs': 'error', // disallow multiple empty lines and only one newline at the end @@ -383,7 +385,7 @@ const base = { 'unicorn/no-console-spaces': 'error', // enforce the use of unicode escapes instead of hexadecimal escapes 'unicorn/no-hex-escape': 'error', - // disallow if as the only statement in an else block + // disallow `if` statements as the only statement in `if` blocks without `else` 'unicorn/no-lonely-if': 'error', // forbid classes that only have static members 'unicorn/no-static-only-class': 'error',