From 5784d89ba8951a78925f394f09dd59134e76accd Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sat, 28 Nov 2015 13:28:28 +0100 Subject: [PATCH] Add Section 18.10 - No spaces inside brackets See #593 --- README.md | 12 ++++++++++++ packages/eslint-config-airbnb/rules/style.js | 6 +++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c722502441..09aeee4d34 100644 --- a/README.md +++ b/README.md @@ -1575,6 +1575,18 @@ Other Style Guides } ``` + - [18.10](#18.10) Do not add spaces inside brackets. + + ```javascript + // bad + const foo = [ 1, 2, 3 ]; + console.log(foo[ 0 ]); + + // good + const foo = [1, 2, 3]; + console.log(foo[0]); + ``` + **[⬆ back to top](#table-of-contents)** ## Commas diff --git a/packages/eslint-config-airbnb/rules/style.js b/packages/eslint-config-airbnb/rules/style.js index 54a9e2fef4..0b6fad09c4 100644 --- a/packages/eslint-config-airbnb/rules/style.js +++ b/packages/eslint-config-airbnb/rules/style.js @@ -1,7 +1,7 @@ module.exports = { 'rules': { // enforce spacing inside array brackets - 'array-bracket-spacing': 0, + 'array-bracket-spacing': [2, 'never'], // enforce one true brace style 'brace-style': [2, '1tbs', {'allowSingleLine': true }], // require camel case names @@ -10,8 +10,8 @@ module.exports = { 'comma-spacing': [2, {'before': false, 'after': true}], // enforce one true comma style 'comma-style': [2, 'last'], - // require or disallow padding inside computed properties - 'computed-property-spacing': 0, + // disallow padding inside computed properties + 'computed-property-spacing': [2, 'never'], // enforces consistent naming when capturing the current execution context 'consistent-this': 0, // enforce newline at the end of file, with no multiple empty lines