Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upStrong arguments for dangling commas #907
Comments
dcousens
added
the
ecosystem impact
label
Jun 1, 2017
This comment has been minimized.
This comment has been minimized.
|
And I thought the argument was about the semicolons... I think those arguments are just for comfort. I mean, your code doesn't break if you have or if you not. Although, personally, I doesn't seem right to have a comma at the end of a listing. It personally appears as an error, like when something deleted the last item of the object/array and forgot to remove it |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
hmmm, thought i had searched through the closed issues as well. apparently i had not. or did it miserably. i still stand fast by the point this is a real productivity booster (or hassle reducer, depending on how you want to see it). just like semi-colon omission, it is one of those things you just never want to ditch once you have taken the plunge. |
This comment has been minimized.
This comment has been minimized.
|
I appreciate the arguments for dangling commas but I think they are very confusing to beginners. A dangling comma arguably looks like an error -- did the programmer intend to add another item to the list? One thing I can suggest that alleviates points 3-4 in your list is to run |
feross
added
the
question
label
Jun 21, 2017
This comment has been minimized.
This comment has been minimized.
tunnckoCore
commented
Aug 4, 2017
•
|
Yea, i'm agree too. Fix is an option, really, i always use fix on save, so i never think for such things, but i have preferences to enable it for "where is allowed in es5", because really, it will be ugly to force including commas in the function arguments (i'm agree to require comma there, but only if there are multiline arguments). |
This comment has been minimized.
This comment has been minimized.
mmieluch
commented
Aug 14, 2017
|
Just my three cents. I myself am a big proponent of enforcing dangling commas in multiline arrays, objects and arguments lists, and all of my co-workers agree with me on this. I find it very convenient not having to go to the previous line just to remove a coma. Also - and I realise this is purely aesthetic and personal - it gives code this nice symmetry. But that may be just my OCD :) I agree with @SirRade that this rule would enforce better code. The only browsers that would be incompatible with this would be IE8 and below, as stated on the ESLint rule page:
Anyway, if there was any vote on this, I'd give a big +1 in a heartbeat. This is mainly the reason we don't use standard |
This comment has been minimized.
This comment has been minimized.
|
As per #907 (comment), this topic has been widely discussed already, and there's little chance of this happening now, if ever. Thanks everyone for chiming in! |
This comment has been minimized.
This comment has been minimized.
|
@SirRade Any form of discrimination against for race, religion, or otherwise isn't welcome in the StandardJS project. Using a known white supremacist symbol as an avatar (knowingly, or otherwise) will not be tolerated. Locking this thread, because as per #907 (comment) the topic in this thread has been exhausted, and further discussion only adds noise. |
lohfu commentedJun 1, 2017
•
edited
Hi,
I chose standard to avoid bikeshedding, and decided to force myself to use it for a few weeks before even considering changing a rule. Most rules are aesthetic anyway and easy to learn to live with. However, there is one rule that after a few weeks still seems very counter productive; namely forcing the omission of dangling commas.
The (strong and, in my opinion, objective) cases for using dangling commas are:
Is there any possibility of a rule being reconsidered? I don't really see this as bikeshedding as it actually has strong benefits.
EDIT: Added 4th point & made it make sense