rwaldron / idiomatic.js

Principles of Writing Consistent, Idiomatic JavaScript
Other
24.67k stars 3.47k forks source link

Alignment #146

Closed hueitan closed 10 years ago

hueitan commented 10 years ago

Will it be better if they are alignment ?

pluma commented 10 years ago

No. Please look at the other tickets that have been filed over this question in the past.

The problem with aligning multi-line vars is that this means you're using 4 spaces in one situation and 2 spaces everywhere else. If you use 4 spaces everywhere instead of the 2 recommended by idiomatic.js, the alignment comes free. If you use anything other than 4 spaces, you don't get alignment.

If the unaligned multiline vars bother you this much and you don't want to use 4 spaces everywhere, just use multiple var statements instead. If your multi-line vars are so long splitting them up would look ugly, that's probably a code smell and indicates you might want to refactor your code to reduce the number of variable declarations in one place.

hueitan commented 10 years ago

Ok thanks for your reply, I get it!