tools: always use a trailing comma in arrays#20703
tools: always use a trailing comma in arrays#20703BridgeAR wants to merge 1 commit intonodejs:masterfrom
Conversation
This makes sure all arrays in /lib end with a comma to prevent future churn. Other options are set as before to minimize the change.
|
Btw: I personally do not care how this is done but I think we should all agree on one way and enforce that so it does not come up in reviews. |
|
@vsemozhetbyt thanks for pointing these out. @nodejs/collaborators I think we shouldd all agree on one way instead of having such comments in reviews. Therefore I suggest a simple vote and hope we can move forward into that direction afterwards: 🎉 No trailing comma at all Be aware that moving to always trailing commas would mean that we have to slowly migrate quite a lot of code. The other way around means little code has to be changed. |
|
@BridgeAR I used 👎 for neither suggestion. I know I once suggested enforcing the If we really want the comma dangle rule, here's my suggestion:
|
|
Hmmm...it looks like they either no longer had (or never had?) |
mcollina
left a comment
There was a problem hiding this comment.
I am -1. We already had to work hard in backporting several PRs due to change of linting. We do not need more as a community.
tniessen
left a comment
There was a problem hiding this comment.
Not a fan of dangling commas, ref #19131 (comment)
I asked in the eslint gitter and while a new option would of course need to be discussed, there was no immediate "no, we don't do consistent-within-a-file" so my original suggestion (implement 'consistent' in eslint and then use that in the nodejs code base) is a potentially viable way to go. |
|
I opened an issue in eslint. I am going to close this now as it is clear that this is not something where we want to go to. Using trailing commas seems like something most people do not want in general as well, so please do not ask for such in reviews. |
|
The one time I wouldn't object to churn and people vote it down... Dangling commas reduce the size of the diff when lines are added. It makes code review a bit easier and is helpful with I'm of the opinion that once eslint adds an option that lets us migrate on a file-by-file basis, we should. |
|
I'm definitely 👍 on having a file-by-file rule. |
This makes sure all arrays in /lib end with a comma to prevent
future churn. Other options are set as before to minimize the
change.
Something like this just came up in a review and I guess it is indeed a good idea
to slowly migrate to a code base that has trailing commas.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes