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',