-
Notifications
You must be signed in to change notification settings - Fork 5
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
Javascript Object trailing commas #40
Comments
I like them because:
With a properly configured auto-fixing linter, you don't even need to think about it either. |
My thoughts EXACTLY. I remember being like, "you want em to remove the comma, but look how beautiful that diff is??". It's super nice for anything like arrays, dependency injections, module declarations, etc. (Idk why, but I'm thinking specifically of TypeScript scenarios) |
Also: I don't think the JSON standard matters in the context of this conversation. Most of the time, we aren't writing JSON, we're writing JavaScript or TypeScript. If you forget and add a hanging comma in JSON, you're likely to be reminded pretty quickly that they're not allowed. |
As most JS devs might have noticed at one point or another, Javascript allows trailing commas in many instances.
I'd like to get opinions on the topic. I've gotten sent back in Code Review a number of times for this behavior. The arguments against it might be that json doesn't support trailing commas, in which case I would understand why this might be a bad behavior to condone.
The text was updated successfully, but these errors were encountered: