tools: clarify README linter error message

PR-URL: https://github.com/nodejs/node/pull/59160
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Richard Lau <richard.lau@ibm.com>
This commit is contained in:
Joyee Cheung 2025-07-25 17:15:22 +02:00 committed by GitHub
parent ad07ae6ac2
commit 7d6ce7765c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -6,7 +6,7 @@ import assert from 'node:assert';
import { open } from 'node:fs/promises';
import { argv } from 'node:process';
const ghHandleLine = /^\* \[(.+)\]\(https:\/\/github\.com\/\1\) -$/;
const ghHandleLine = /^\* \[(.+)\]\(https:\/\/github\.com\/(.+)\) -$/;
const memberInfoLine = /^ {2}\*\*[^*]+\*\* <<[^@]+@.+\.[a-z]+>>( \(\w+(\/[^)/]+)+\))?( - \[Support me\]\(.+\))?$/;
const lists = {
@ -59,9 +59,11 @@ for await (const line of readme.readLines()) {
);
}
if (!ghHandleLine.test(line)) {
throw new Error(`${currentGithubHandle} is not formatted correctly (README.md:${lineNumber})`);
const match = line.match(ghHandleLine);
if (!match) {
throw new Error(`${line} should match ${ghHandleLine} (README.md:${lineNumber})`);
}
assert.strictEqual(match[1], match[2], `GitHub handle does not match the URL (README.md:${lineNumber})`);
if (
currentList === 'TSC voting members' ||