Skip to content

Commit 456b023

Browse files
aduh95ruyadorno
authored andcommitted
tools: lint README lists more strictly
PR-URL: #55625 Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
1 parent 0a7f301 commit 456b023

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

README.md

+3-3
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** <<panva.ip@gmail.com>> (he/him)
410410
* [pimterry](https://github.com/pimterry) -
411411
**Tim Perry** <<pimterry@gmail.com>> (he/him)
412-
* [pmarchini](https://github.com/pmarchini)
412+
* [pmarchini](https://github.com/pmarchini) -
413413
**Pietro Marchini** <<pietro.marchini94@gmail.com>> (he/him)
414414
* [Qard](https://github.com/Qard) -
415415
**Stephen Belanger** <<admin@stephenbelanger.com>> (he/him)
@@ -515,7 +515,7 @@ For information about the governance of the Node.js project, see
515515
**Hitesh Kanwathirtha** <<digitalinfinity@gmail.com>> (he/him)
516516
* [dmabupt](https://github.com/dmabupt) -
517517
**Xu Meng** <<dmabupt@gmail.com>> (he/him)
518-
* [dnlup](https://github.com/dnlup)
518+
* [dnlup](https://github.com/dnlup) -
519519
**dnlup** <<dnlup.dev@gmail.com>>
520520
* [eljefedelrodeodeljefe](https://github.com/eljefedelrodeodeljefe) -
521521
**Robert Jefe Lindstaedt** <<robert.lindstaedt@gmail.com>>
@@ -757,7 +757,7 @@ maintaining the Node.js project.
757757
**Mert Can Altin** <<mertgold60@gmail.com>>
758758
* [preveen-stack](https://github.com/preveen-stack) -
759759
**Preveen Padmanabhan** <<wide4head@gmail.com>> (he/him)
760-
* [RedYetiDev](https://github.com/redyetidev) -
760+
* [RedYetiDev](https://github.com/RedYetiDev) -
761761
**Aviv Keller** <<redyetidev@gmail.com>> (they/them)
762762
* [VoltrexKeyva](https://github.com/VoltrexKeyva) -
763763
**Mohammed Keyvanzadeh** <<mohammadkeyvanzade94@gmail.com>> (he/him)

tools/lint-readme-lists.mjs

+16-2
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+
const ghHandleLine = /^\* \[(.+)\]\(https:\/\/github\.com\/\1\) -$/;
10+
const memberInfoLine = /^ {2}\*\*[^*]+\*\* <<[^@]+@.+\.[a-z]+>>( \(\w+(\/[^)/]+)+\))?( - \[Support me\]\(.+\))?$/;
11+
912
const lists = {
1013
'__proto__': null,
1114

@@ -26,12 +29,19 @@ const tscMembers = new Set();
2629
const readme = await open(new URL('../README.md', import.meta.url), 'r');
2730

2831
let currentList = null;
32+
let previousGithubHandleInfoRequired;
2933
let previousGithubHandle;
3034
let lineNumber = 0;
3135

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

62+
if (!ghHandleLine.test(line)) {
63+
throw new Error(`${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]] ??= new Set()).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)