-
Notifications
You must be signed in to change notification settings - Fork 26.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
why is space-in-parens disabled? #593
Comments
Where exactly would you expect to put the spaces in the parens there? Per our current style, there's spaces inside braces ( |
I was thinking 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?).
|
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 Either its |
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 |
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. |
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?The text was updated successfully, but these errors were encountered: