Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions tools/lint-readme-lists.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -59,8 +59,12 @@ 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})`);
}
if (match[1] !== match[2]) {
throw new Error(`GitHub handle ${match[1]} does not match the URL ${match[2]} (README.md:${lineNumber})`);
}

if (
Expand Down
Loading