Repository: nodejs/node
Pull request: tools: lint README lists more strictly

Having small variations can be hard to spot for human reviewers, and can affect the tooling in a way that's not always obvious.
<!--
Before submitting a pull request, please read:

- the CONTRIBUTING guide at https://github.com/nodejs/node/blob/HEAD/CONTRIBUTING.md
- the commit message formatting guidelines at
  https://github.com/nodejs/node/blob/HEAD/doc/contributing/pull-requests.md#commit-message-guidelines

For code changes:
1. Include tests for any bug fixes or new features.
2. Update documentation if relevant.
3. Ensure that `make -j4 test` (UNIX), or `vcbuild test` (Windows) passes.

If you believe this PR should be highlighted in the Node.js CHANGELOG
please add the `notable-change` label.

Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.
-->


Changed files:
filename: README.md
patch: @@ -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)

filename: tools/lint-readme-lists.mjs
patch: @@ -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.');