From ca8c008aad9f546e8f2eb2fcc23dedab48062628 Mon Sep 17 00:00:00 2001 From: Marcos Iglesias Date: Wed, 6 Jun 2018 17:19:30 -0700 Subject: [PATCH] Inverts the ESLint rule that forces us to remove padding within curly braces of object literals This rule is an stylistic requirement that forces us to remove the padding between values of an object literal, and that mainly applies when we are destructuring values from an object or in parameter destructuring in the signature of a function. The proposed change is making it the contrary, that means, to force us to add padding with spaces on this cases. The benefits I consider this brings are twofold: First, we improve the readability of our code, being: let { velocity } = parameters; More readable than: let {velocity} = parameters; Second, we are more in sync with what the JavaScript community in general does, as this rule is set up the proposed way in a code styleguide as important as the AirBnB one. Also, a lot of examples out there use the padded version. --- packages/eslint-config-eventbrite-legacy/rules/style.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/eslint-config-eventbrite-legacy/rules/style.js b/packages/eslint-config-eventbrite-legacy/rules/style.js index 1bb606c..a3aa993 100644 --- a/packages/eslint-config-eventbrite-legacy/rules/style.js +++ b/packages/eslint-config-eventbrite-legacy/rules/style.js @@ -104,7 +104,7 @@ module.exports = { // disallow padding within curly braces of object literals // http://eslint.org/docs/rules/object-curly-spacing - 'object-curly-spacing': 'error', + 'object-curly-spacing': ['error', 'always'], // enforce that `var` declarations are declared together // http://eslint.org/docs/rules/one-var