GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — doc: add lint rule to enforce trailing commas by aduh95 · Pull Request #45471 · nodejs/node

Conversation

@aduh95

@aduh95 aduh95 commented Nov 15, 2022

Copy link
Copy Markdown
Contributor

No description provided.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
aduh95 added 2 commits November 15, 2022 14:11
@aduh95
doc: add lint rule to enforce trailing commas
f40656d
@aduh95
fixup! doc: add lint rule to enforce trailing commas
5d42c52
@nodejs-github-bot

nodejs-github-bot commented Nov 15, 2022

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/http
  • @nodejs/http2
  • @nodejs/modules
  • @nodejs/net
  • @nodejs/node-api
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot nodejs-github-bot added the doc Issues and PRs related to Node.js documentation. label Nov 15, 2022
JakobJingleheimer
JakobJingleheimer approved these changes Nov 15, 2022
View reviewed changes
@Trott

Trott commented Nov 15, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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).

aduh95 and tniessen reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Trott
Trott approved these changes Nov 15, 2022
View reviewed changes
@aduh95 aduh95 added author ready PRs with CI started, the required approvals, and no outstanding review comments. commit-queue PRs queued for automated landing through the Commit Queue. labels Nov 15, 2022
@ljharb

ljharb commented Nov 15, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

@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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

anonrig
anonrig approved these changes Nov 15, 2022
View reviewed changes
@tniessen

tniessen commented Nov 15, 2022

Copy link
Copy Markdown
Member

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';
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

GeoffreyBooth
GeoffreyBooth approved these changes Nov 15, 2022
View reviewed changes
@Trott

Trott commented Nov 15, 2022

Copy link
Copy Markdown
Member

@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

What makes you say it is "almost universal to enforce trailing commas"?

ESLint's comma-dangle rule is enabled as part of their "recommended" rules. It defaults to prohibiting all dangling commas.

The standard package prohibits all dangling commas.

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.

tniessen reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Trott

Trott commented Nov 15, 2022

Copy link
Copy Markdown
Member

MDN uses trailing commas in docs, so that's good enough for me.

image

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ljharb

ljharb commented Nov 15, 2022

Copy link
Copy Markdown
Member

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 :-)

Trott reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Trott

This comment was marked as off-topic.

Sign in to view
trivikr
trivikr approved these changes Nov 17, 2022
View reviewed changes
@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Nov 17, 2022
@nodejs-github-bot
nodejs-github-bot merged commit c6dabe3 into nodejs:main Nov 17, 2022
@nodejs-github-bot

nodejs-github-bot commented Nov 17, 2022

Copy link
Copy Markdown
Collaborator

Landed in c6dabe3

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@aduh95
aduh95 deleted the trailing-commas-doc branch November 17, 2022 14:14
ruyadorno pushed a commit that referenced this pull request Nov 21, 2022
@aduh95 @ruyadorno
doc: add lint rule to enforce trailing commas
1812a89
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]>
@ruyadorno ruyadorno mentioned this pull request Nov 24, 2022
v19.2.0 proposal #45615
Merged
@aduh95 aduh95 mentioned this pull request Dec 16, 2022
tools: enforce use of trailing commas in tools/ #45889
Merged
@danielleadams danielleadams mentioned this pull request Dec 30, 2022
v18.13.0 release proposal #46025
Merged
danielleadams pushed a commit that referenced this pull request Dec 30, 2022
@aduh95 @danielleadams
doc: add lint rule to enforce trailing commas
1e0e71a
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]>
danielleadams pushed a commit that referenced this pull request Jan 3, 2023
@aduh95 @danielleadams
doc: add lint rule to enforce trailing commas
009adc7
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@GeoffreyBooth GeoffreyBooth GeoffreyBooth approved these changes
@Trott Trott Trott approved these changes
@anonrig anonrig anonrig approved these changes
@JakobJingleheimer JakobJingleheimer JakobJingleheimer approved these changes
@trivikr trivikr trivikr approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. doc Issues and PRs related to Node.js documentation.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

9 participants

@aduh95 @nodejs-github-bot @Trott @ljharb @tniessen @GeoffreyBooth @anonrig @JakobJingleheimer @trivikr
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.