Skip to content

Commit 195d603

Browse files
joyeecheungaduh95
authored andcommitted
tools: clarify README linter error message
PR-URL: #59160 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Richard Lau <[email protected]>
1 parent a0d22e9 commit 195d603

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

‎tools/lint-readme-lists.mjs‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ 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\)-$/;
9+
constghHandleLine=/^\*\[(.+)\]\(https:\/\/github\.com\/(.+)\)-$/;
1010
constmemberInfoLine=/^{2}\*\*[^*]+\*\*<<[^@]+@.+\.[a-z]+>>(\(\w+(\/[^)/]+)+\))?(-\[Supportme\]\(.+\))?$/;
1111

1212
constlists={
@@ -59,9 +59,11 @@ for await (const line of readme.readLines()){
5959
);
6060
}
6161

62-
if(!ghHandleLine.test(line)){
63-
thrownewError(`${currentGithubHandle} is not formatted correctly (README.md:${lineNumber})`);
62+
constmatch=line.match(ghHandleLine);
63+
if(!match){
64+
thrownewError(`${line} should match ${ghHandleLine} (README.md:${lineNumber})`);
6465
}
66+
assert.strictEqual(match[1],match[2],`GitHub handle does not match the URL (README.md:${lineNumber})`);
6567

6668
if(
6769
currentList==='TSC voting members'||

0 commit comments

Comments
(0)