-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
doc: add lint rule to enforce trailing commas #45471
Conversation
Review requested:
|
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). |
@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 |
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'; |
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. |
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.
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.