Skip to content

Commit 7ce7eab

Browse files
committed
tools: lint README lists more strictly
PR-URL: #55625 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Rafael Gonzaga <[email protected]>
1 parent 8d0526f commit 7ce7eab

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

‎README.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ For information about the governance of the Node.js project, see
409409
**Filip Skokan** <<[email protected]>> (he/him)
410410
*[pimterry](https://github.com/pimterry) -
411411
**Tim Perry** <<[email protected]>> (he/him)
412-
*[pmarchini](https://github.com/pmarchini)
412+
*[pmarchini](https://github.com/pmarchini) -
413413
**Pietro Marchini** <<[email protected]>> (he/him)
414414
*[Qard](https://github.com/Qard) -
415415
**Stephen Belanger** <<[email protected]>> (he/him)
@@ -515,7 +515,7 @@ For information about the governance of the Node.js project, see
515515
**Hitesh Kanwathirtha** <<[email protected]>> (he/him)
516516
*[dmabupt](https://github.com/dmabupt) -
517517
**Xu Meng** <<[email protected]>> (he/him)
518-
*[dnlup](https://github.com/dnlup)
518+
*[dnlup](https://github.com/dnlup) -
519519
**dnlup** <<[email protected]>>
520520
*[eljefedelrodeodeljefe](https://github.com/eljefedelrodeodeljefe) -
521521
**Robert Jefe Lindstaedt** <<[email protected]>>
@@ -757,7 +757,7 @@ maintaining the Node.js project.
757757
**Mert Can Altin** <<[email protected]>>
758758
*[preveen-stack](https://github.com/preveen-stack) -
759759
**Preveen Padmanabhan** <<[email protected]>> (he/him)
760-
*[RedYetiDev](https://github.com/redyetidev) -
760+
*[RedYetiDev](https://github.com/RedYetiDev) -
761761
**Aviv Keller** <<[email protected]>> (they/them)
762762
*[VoltrexKeyva](https://github.com/VoltrexKeyva) -
763763
**Mohammed Keyvanzadeh** <<[email protected]>> (he/him)

‎tools/lint-readme-lists.mjs‎

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ import assert from 'node:assert'
66
import{open}from'node:fs/promises';
77
import{argv}from'node:process';
88

9+
constghHandleLine=/^\*\[(.+)\]\(https:\/\/github\.com\/\1\)-$/;
10+
constmemberInfoLine=/^{2}\*\*[^*]+\*\*<<[^@]+@.+\.[a-z]+>>(\(\w+(\/[^)/]+)+\))?(-\[Supportme\]\(.+\))?$/;
11+
912
constlists={
1013
'__proto__': null,
1114

@@ -26,12 +29,19 @@ const tscMembers = new Set();
2629
constreadme=awaitopen(newURL('../README.md',import.meta.url),'r');
2730

2831
letcurrentList=null;
32+
letpreviousGithubHandleInfoRequired;
2933
letpreviousGithubHandle;
3034
letlineNumber=0;
3135

3236
forawait(constlineofreadme.readLines()){
3337
lineNumber++;
34-
if(line.startsWith('### ')){
38+
if(previousGithubHandleInfoRequired){
39+
if(!memberInfoLine.test(line)){
40+
thrownewError(`${previousGithubHandleInfoRequired} info are not formatted correctly (README.md:${lineNumber})`);
41+
}
42+
previousGithubHandle=previousGithubHandleInfoRequired;
43+
previousGithubHandleInfoRequired=null;
44+
}elseif(line.startsWith('### ')){
3545
currentList=line.slice(4);
3646
previousGithubHandle=null;
3747
}elseif(line.startsWith('#### ')){
@@ -49,6 +59,10 @@ for await (const line of readme.readLines()){
4959
);
5060
}
5161

62+
if(!ghHandleLine.test(line)){
63+
thrownewError(`${currentGithubHandle} is not formatted correctly (README.md:${lineNumber})`);
64+
}
65+
5266
if(
5367
currentList==='TSC voting members'||
5468
currentList==='TSC regular members'
@@ -60,7 +74,7 @@ for await (const line of readme.readLines()){
6074
if(lists[currentList]){
6175
(actualMembers[lists[currentList]]??=newSet()).add(currentGithubHandle);
6276
}
63-
previousGithubHandle=currentGithubHandleLowerCase;
77+
previousGithubHandleInfoRequired=currentGithubHandleLowerCase;
6478
}
6579
}
6680
console.info('Lists are in the alphabetical order.');

0 commit comments

Comments
(0)