-
Notifications
You must be signed in to change notification settings - Fork 30k
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
test: add lint rule to enforce trailing commas #45468
Conversation
Only activated on some subfolders to minimize the diff, ideally this rule would be applied gradually to the entire codebase in follow-up commits.
Review requested:
|
Co-authored-by: Rich Trott <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about keeping function calls as they are for now? It is still relatively new that it's allowed to add trailing commas there.
Otherwise LGTM
It's part of ES2017, like e.g. async/await; while it is indeed relatively new, we're using much more modern syntax already (e.g. optional chaining). I think we should keep them on functions, for the same reasons we want them on array and objects. |
😱 I wasn't even aware that ES permits trailing commas in function calls.
I've never been a fan of trailing commas anywhere but this seems particularly odd. Isn't the main justification for trailing commas to reduce diff sizes when elements are added to arrays or object literals? I don't see how that would apply to, e.g., the |
It applies to function with optional parameter and variadic functions, for which we may or may not add/remove parameters in the future. For |
Landed in bd462ad |
Only activated on some subfolders to minimize the diff, ideally this rule would be applied gradually to the entire codebase in follow-up commits. PR-URL: #45468 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jiawen Geng <[email protected]>
Only activated on some subfolders to minimize the diff, ideally this rule would be applied gradually to the entire codebase in follow-up commits. PR-URL: nodejs#45468 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jiawen Geng <[email protected]>
Only activated on some subfolders to minimize the diff, ideally this rule would be applied gradually to the entire codebase in follow-up commits. PR-URL: #45468 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jiawen Geng <[email protected]>
Only activated on some subfolders to minimize the diff, ideally this rule would be applied gradually to the entire codebase in follow-up commits. PR-URL: #45468 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jiawen Geng <[email protected]>
Only activated on some subfolders to minimize the diff, ideally this rule would be applied gradually to the entire codebase in follow-up commits. PR-URL: #45468 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jiawen Geng <[email protected]>
Only activated on some subfolders to minimize the diff, ideally this rule would be applied gradually to the entire codebase in follow-up commits. PR-URL: #45468 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jiawen Geng <[email protected]>
Only activated on some subfolders to minimize the diff, ideally this rule would be applied gradually to the entire codebase in follow-up commits.
There have been previous attempts at imposing trailing commas via a lint rule that failed because the diff it produces it simply to large to be reviewed before git conflicts arise, let's try a more gradual approach and split the effort in separate PRs that apply only on a subset of the codebase at a time.