Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.2k
doc: add lint rule to enforce trailing commas#45471
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
nodejs-github-bot commented Nov 15, 2022
Review requested:
|
Trott commented Nov 15, 2022 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
This LGTM, but a possibility to consider: We get nits on the docs by people removing trailing commas from time to time. And that's with only having trailing commas in a few places! It's an atypical coding style. I'm fine with turning it on, and in the unlikely event that we end up with an avalanche of confused readers, we can turn it off again (in docs only). |
ljharb commented Nov 15, 2022 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
@Trott fwiw in the wider JS world, i'm pretty confident it's almost universal to enforce trailing commas on any multiline construct, to minimize diff churn |
tniessen commented Nov 15, 2022
I don't know how much the diff churn argument matters for documentation examples. I totally get that those who like trailing commas would want them here and elsewhere for consistency, but looking at documentation of individual functions, for example, I personally don't think it helps readability: import{setTimeout,}from'timers/promises'; |
Trott commented Nov 15, 2022
What makes you say it is "almost universal to enforce trailing commas"? ESLint's The I could go on, but that should really be enough to make it clear that dangling commas are definitely not "almost universal". On the contrary, it's a pretty strong indicator that dangling commas are atypical. |
Trott commented Nov 15, 2022
ljharb commented Nov 15, 2022
The airbnb style guide, and prettier i believe, have required them for many many years, which constitute far more usage than the eslint recommended config - but fair counterpoint, and certainly it’s not worth arguing about it :-) |
This comment was marked as off-topic.
This comment was marked as off-topic.
nodejs-github-bot commented Nov 17, 2022
Landed in c6dabe3 |
PR-URL: #45471 Reviewed-By: Jacob Smith <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Geoffrey Booth <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
PR-URL: nodejs#45471 Reviewed-By: Jacob Smith <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Geoffrey Booth <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
PR-URL: #45471 Reviewed-By: Jacob Smith <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Geoffrey Booth <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
PR-URL: #45471 Reviewed-By: Jacob Smith <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Geoffrey Booth <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
PR-URL: #45471 Reviewed-By: Jacob Smith <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Geoffrey Booth <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
PR-URL: #45471 Reviewed-By: Jacob Smith <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Geoffrey Booth <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>

No description provided.