Hello! This is a question not a bug :)
Looking at your examples you always use the following style: if (x) {, functionCall(a, b, c). So, I was wondering why is space-in-parens completely disabled in your eslint config?
Where exactly would you expect to put the spaces in the parens there? Per our current style, there's spaces inside braces ({ }), but there shouldn't be any inside parens (( )) or brackets ([ ]).
I was thinking "space-in-parens": [2, "never"] might reflect better what is written in the styleguide.
Right now I am not getting any linting warnings when adding a space inside parens or brackets.
EDIT: looks like the following would match more closely the written syleguide (unless I am missing something obvious?).
"space-in-parens": [2, "never"],
"array-bracket-spacing": [2, "never"],
"computed-property-spacing": [2, "never"],
"object-curly-spacing": [2, "always"]
Looks like you're right, thanks for elaborating! a PR to apply those settings is welcome.
I created the PR. Closing this issue!
Let's leave the issue open until the PR is merged, which will auto-close the issue :-)
Why use a different rule for objects? Imo "object-curly-spacing": [2, "always"] should be switched to never to follow array-bracket-spacing.
Either its {foo: 'bar'} and ['foo', 'bar'], or it's { foo: 'bar' } and [ 'foo', 'bar' ], but a mix of both is awkward & confusing.
It's an aesthetic rule. Subjectively, it looks weird for objects to not have spaces, and it looks weird for arrays to have spaces.
At by rate, it's the rule we use inside Airbnb. You're free to fork the styleguide to apply any form of consistency you like!
I second it looks weird for objects to not have spaces, and it looks weird for arrays to have spaces.
I think adding spaces to objects makes it less readable because it can be confused with a block (block-spacing rule), specially if it is a inline block.
Also, since arrays don't have spaces, and they are also "objects", it would be more congruent to treat them in the same way.
I understand it is your current style in Airbnb, but perhaps you might consider favour readability and congruence over the "looks weird" reasoning.
"It looks weird" relates to readability, and while arrays are indeed technically objects, conceptually they should only be thought of and worked with as atomic lists. It's OK that they're treated differently.
Overall tho, the thinking is that lists don't need padding, because it's clear what separates each item - but things with key/value pairs need the padding, because it's not necessarily as clear.
Ok I can see your thinking, however objects don't necessarily have more than one item, and with the new assignment shorthand, objects don't necessarily have key/value pairs. If the object has more than a couple of items, they should go in different lines anyways. When scanning code I find more useful to clearly distinguish a block from an object, than to see what separates each item.
Most helpful comment
I think adding spaces to objects makes it less readable because it can be confused with a block (block-spacing rule), specially if it is a inline block.
Also, since arrays don't have spaces, and they are also "objects", it would be more congruent to treat them in the same way.
I understand it is your current style in Airbnb, but perhaps you might consider favour readability and congruence over the "looks weird" reasoning.