From 2557a5bca6b66108d27684ae25c6471e899b0cd7 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sat, 28 Nov 2015 13:25:49 +0100 Subject: [PATCH] Add Section 18.9 - No spaces inside parentheses See #593 --- README.md | 23 ++++++++++++++++++++ packages/eslint-config-airbnb/rules/style.js | 4 ++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9f895b9a55..0c0822d024 100644 --- a/README.md +++ b/README.md @@ -1551,6 +1551,29 @@ Other Style Guides } ``` + - [18.9](#18.9) Do not add spaces inside parentheses. + + ```javascript + // bad + function bar( foo ) { + return foo; + } + + // good + function bar(foo) { + return foo; + } + + // bad + if ( foo ) { + console.log(foo); + } + + // good + if (foo) { + console.log(foo); + } + ``` **[⬆ back to top](#table-of-contents)** diff --git a/packages/eslint-config-airbnb/rules/style.js b/packages/eslint-config-airbnb/rules/style.js index c9df867f37..54a9e2fef4 100644 --- a/packages/eslint-config-airbnb/rules/style.js +++ b/packages/eslint-config-airbnb/rules/style.js @@ -96,8 +96,8 @@ module.exports = { 'space-before-blocks': 2, // require or disallow space before function opening parenthesis 'space-before-function-paren': [2, 'never'], - // require or disallow spaces inside parentheses - 'space-in-parens': 0, + // disallow spaces inside parentheses + 'space-in-parens': [2, 'never'], // require spaces around operators 'space-infix-ops': 2, // require a space after return, throw, and case