@@ -6,6 +6,9 @@ import assert from 'node:assert';
6
6
import { open } from 'node:fs/promises' ;
7
7
import { argv } from 'node:process' ;
8
8
9
+ const ghHandleLine = / ^ \* \[ ( .+ ) \] \( h t t p s : \/ \/ g i t h u b \. c o m \/ \1\) - $ / ;
10
+ const memberInfoLine = / ^ { 2 } \* \* [ ^ * ] + \* \* < < [ ^ @ ] + @ .+ \. [ a - z ] + > > ( \( \w + ( \/ [ ^ ) / ] + ) + \) ) ? ( - \[ S u p p o r t m e \] \( .+ \) ) ? $ / ;
11
+
9
12
const lists = {
10
13
'__proto__' : null ,
11
14
@@ -26,12 +29,19 @@ const tscMembers = new Set();
26
29
const readme = await open ( new URL ( '../README.md' , import . meta. url ) , 'r' ) ;
27
30
28
31
let currentList = null ;
32
+ let previousGithubHandleInfoRequired ;
29
33
let previousGithubHandle ;
30
34
let lineNumber = 0 ;
31
35
32
36
for await ( const line of readme . readLines ( ) ) {
33
37
lineNumber ++ ;
34
- if ( line . startsWith ( '### ' ) ) {
38
+ if ( previousGithubHandleInfoRequired ) {
39
+ if ( ! memberInfoLine . test ( line ) ) {
40
+ throw new Error ( `${ previousGithubHandleInfoRequired } info are not formatted correctly (README.md:${ lineNumber } )` ) ;
41
+ }
42
+ previousGithubHandle = previousGithubHandleInfoRequired ;
43
+ previousGithubHandleInfoRequired = null ;
44
+ } else if ( line . startsWith ( '### ' ) ) {
35
45
currentList = line . slice ( 4 ) ;
36
46
previousGithubHandle = null ;
37
47
} else if ( line . startsWith ( '#### ' ) ) {
@@ -49,6 +59,10 @@ for await (const line of readme.readLines()) {
49
59
) ;
50
60
}
51
61
62
+ if ( ! ghHandleLine . test ( line ) ) {
63
+ throw new Error ( `${ currentGithubHandle } is not formatted correctly (README.md:${ lineNumber } )` ) ;
64
+ }
65
+
52
66
if (
53
67
currentList === 'TSC voting members' ||
54
68
currentList === 'TSC regular members'
@@ -60,7 +74,7 @@ for await (const line of readme.readLines()) {
60
74
if ( lists [ currentList ] ) {
61
75
( actualMembers [ lists [ currentList ] ] ??= new Set ( ) ) . add ( currentGithubHandle ) ;
62
76
}
63
- previousGithubHandle = currentGithubHandleLowerCase ;
77
+ previousGithubHandleInfoRequired = currentGithubHandleLowerCase ;
64
78
}
65
79
}
66
80
console . info ( 'Lists are in the alphabetical order.' ) ;
0 commit comments