tools: lint README lists more strictly

PR-URL: https://github.com/nodejs/node/pull/55625
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
This commit is contained in:
Antoine du Hamel 2024-11-02 15:14:40 +01:00 committed by GitHub
parent 560b2a1677
commit 91bce94010
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 5 deletions

View File

@ -409,7 +409,7 @@ For information about the governance of the Node.js project, see
**Filip Skokan** <<panva.ip@gmail.com>> (he/him)
* [pimterry](https://github.com/pimterry) -
**Tim Perry** <<pimterry@gmail.com>> (he/him)
* [pmarchini](https://github.com/pmarchini)
* [pmarchini](https://github.com/pmarchini) -
**Pietro Marchini** <<pietro.marchini94@gmail.com>> (he/him)
* [Qard](https://github.com/Qard) -
**Stephen Belanger** <<admin@stephenbelanger.com>> (he/him)
@ -515,7 +515,7 @@ For information about the governance of the Node.js project, see
**Hitesh Kanwathirtha** <<digitalinfinity@gmail.com>> (he/him)
* [dmabupt](https://github.com/dmabupt) -
**Xu Meng** <<dmabupt@gmail.com>> (he/him)
* [dnlup](https://github.com/dnlup)
* [dnlup](https://github.com/dnlup) -
**dnlup** <<dnlup.dev@gmail.com>>
* [eljefedelrodeodeljefe](https://github.com/eljefedelrodeodeljefe) -
**Robert Jefe Lindstaedt** <<robert.lindstaedt@gmail.com>>
@ -757,7 +757,7 @@ maintaining the Node.js project.
**Mert Can Altin** <<mertgold60@gmail.com>>
* [preveen-stack](https://github.com/preveen-stack) -
**Preveen Padmanabhan** <<wide4head@gmail.com>> (he/him)
* [RedYetiDev](https://github.com/redyetidev) -
* [RedYetiDev](https://github.com/RedYetiDev) -
**Aviv Keller** <<redyetidev@gmail.com>> (they/them)
* [VoltrexKeyva](https://github.com/VoltrexKeyva) -
**Mohammed Keyvanzadeh** <<mohammadkeyvanzade94@gmail.com>> (he/him)

View File

@ -6,6 +6,9 @@ import assert from 'node:assert';
import { open } from 'node:fs/promises';
import { argv } from 'node:process';
const ghHandleLine = /^\* \[(.+)\]\(https:\/\/github\.com\/\1\) -$/;
const memberInfoLine = /^ {2}\*\*[^*]+\*\* <<[^@]+@.+\.[a-z]+>>( \(\w+(\/[^)/]+)+\))?( - \[Support me\]\(.+\))?$/;
const lists = {
'__proto__': null,
@ -26,12 +29,19 @@ const tscMembers = new Set();
const readme = await open(new URL('../README.md', import.meta.url), 'r');
let currentList = null;
let previousGithubHandleInfoRequired;
let previousGithubHandle;
let lineNumber = 0;
for await (const line of readme.readLines()) {
lineNumber++;
if (line.startsWith('### ')) {
if (previousGithubHandleInfoRequired) {
if (!memberInfoLine.test(line)) {
throw new Error(`${previousGithubHandleInfoRequired} info are not formatted correctly (README.md:${lineNumber})`);
}
previousGithubHandle = previousGithubHandleInfoRequired;
previousGithubHandleInfoRequired = null;
} else if (line.startsWith('### ')) {
currentList = line.slice(4);
previousGithubHandle = null;
} else if (line.startsWith('#### ')) {
@ -49,6 +59,10 @@ for await (const line of readme.readLines()) {
);
}
if (!ghHandleLine.test(line)) {
throw new Error(`${currentGithubHandle} is not formatted correctly (README.md:${lineNumber})`);
}
if (
currentList === 'TSC voting members' ||
currentList === 'TSC regular members'
@ -60,7 +74,7 @@ for await (const line of readme.readLines()) {
if (lists[currentList]) {
(actualMembers[lists[currentList]] ??= new Set()).add(currentGithubHandle);
}
previousGithubHandle = currentGithubHandleLowerCase;
previousGithubHandleInfoRequired = currentGithubHandleLowerCase;
}
}
console.info('Lists are in the alphabetical order.');