@@ -45,7 +45,8 @@ const execToArray = (content, regexp) => {
45
45
const schema = [
46
46
{
47
47
title : "license comment" ,
48
- regexp : / \/ \* \n \s * M I T L i c e n s e h t t p : \/ \/ w w w \. o p e n s o u r c e \. o r g \/ l i c e n s e s \/ m i t - l i c e n s e \. p h p \n \s * (?: ( A u t h o r s ? .+ ) \n ) ? \s * \* \/ \n / g,
48
+ regexp :
49
+ / \/ \* \n \s * M I T L i c e n s e h t t p : \/ \/ w w w \. o p e n s o u r c e \. o r g \/ l i c e n s e s \/ m i t - l i c e n s e \. p h p \n \s * (?: ( A u t h o r s ? .+ ) \n ) ? \s * \* \/ \n / g,
49
50
updateMessage : "update the license comment" ,
50
51
update ( content , author ) {
51
52
return (
@@ -82,12 +83,13 @@ const schema = [
82
83
} ,
83
84
{
84
85
title : "imports" ,
85
- regexp : / ( c o n s t ( \{ \s + \w + (?: : \s + \w + ) ? ( , \s + \w + (?: : \s + \w + ) ? ) * \s + \} | \w + ) = ( \/ \* \* @ t y p e \{ T O D O \} \* \/ \s \( ) ? r e q u i r e \( " [ ^ " ] + " \) \) ? ( \. \w + ) * ; \n ) + \n / g,
86
+ regexp :
87
+ / ( c o n s t ( \{ \s + \w + (?: : \s + \w + ) ? ( , \s + \w + (?: : \s + \w + ) ? ) * \s + \} | \w + ) = ( \/ \* \* @ t y p e \{ T O D O \} \* \/ \s \( ) ? r e q u i r e \( " [ ^ " ] + " \) \) ? ( \. \w + ) * ; \n ) + \n / g,
86
88
updateMessage : "sort imports alphabetically" ,
87
89
update ( content ) {
88
90
const items = execToArray (
89
91
content ,
90
- / c o n s t (?: \{ \s + \w + (?: : \s + \w + ) ? (?: , \s + \w + (?: : \s + \w + ) ? ) * \s + \} | \w + ) = (?: \/ \* \* @ t y p e \{ T O D O \} \* \/ \s \( ) ? r e q u i r e \( " ( [ ^ " ] + ) " \) \) ? ( (?: \. \w + ) * ) ; \n / g
92
+ / c o n s t (?: \{ \s + \w + (?: : \s + \w + ) ? (?: , \s + \w + (?: : \s + \w + ) ? ) * \s + \} | \w + ) = (?: \/ \* \* @ t y p e \{ T O D O \} \* \/ \s \( ) ? r e q u i r e \( " ( [ ^ " ] + ) " \) \) ? ( (?: \. \w + ) * ) ; \n / g,
91
93
) ;
92
94
items . sort ( sortImport ) ;
93
95
return items . map ( ( item ) => item . content ) . join ( "" ) + "\n" ;
@@ -97,12 +99,13 @@ const schema = [
97
99
} ,
98
100
{
99
101
title : "type imports" ,
100
- regexp : / ( \/ \* \* (?: @ t e m p l a t e \w + ) * @ t y p e d e f \{ (?: t y p e o f ) ? i m p o r t \( " [ ^ " ] + " \) ( \. \w + ) * (?: < (?: (?: \w \. ) * \w + , ) * (?: \w \. ) * \w + > ) ? \} \w + (?: < (?: (?: \w \. ) * \w + , ) * (?: \w \. ) * \w + > ) ? \* \/ \n ) + \n / g,
102
+ regexp :
103
+ / ( \/ \* \* (?: @ t e m p l a t e \w + ) * @ t y p e d e f \{ (?: t y p e o f ) ? i m p o r t \( " [ ^ " ] + " \) ( \. \w + ) * (?: < (?: (?: \w \. ) * \w + , ) * (?: \w \. ) * \w + > ) ? \} \w + (?: < (?: (?: \w \. ) * \w + , ) * (?: \w \. ) * \w + > ) ? \* \/ \n ) + \n / g,
101
104
updateMessage : "sort type imports alphabetically" ,
102
105
update ( content ) {
103
106
const items = execToArray (
104
107
content ,
105
- / \/ \* \* (?: @ t e m p l a t e \w + ) * @ t y p e d e f \{ (?: t y p e o f ) ? i m p o r t \( " ( [ ^ " ] + ) " \) ( (?: \. \w + ) * (?: < (?: (?: \w \. ) * \w + , ) * (?: \w \. ) * \w + > ) ? ) \} \w + (?: < (?: (?: \w \. ) * \w + , ) * (?: \w \. ) * \w + > ) ? \* \/ \n / g
108
+ / \/ \* \* (?: @ t e m p l a t e \w + ) * @ t y p e d e f \{ (?: t y p e o f ) ? i m p o r t \( " ( [ ^ " ] + ) " \) ( (?: \. \w + ) * (?: < (?: (?: \w \. ) * \w + , ) * (?: \w \. ) * \w + > ) ? ) \} \w + (?: < (?: (?: \w \. ) * \w + , ) * (?: \w \. ) * \w + > ) ? \* \/ \n / g,
106
109
) ;
107
110
items . sort ( sortImport ) ;
108
111
return items . map ( ( item ) => item . content ) . join ( "" ) + "\n" ;
@@ -139,7 +142,7 @@ for (const filePath of allFiles) {
139
142
}
140
143
if ( match . index !== pos ) {
141
144
console . log (
142
- `${ filePath } : Unexpected code at ${ pos } -${ match . index } , expected ${ current . title } `
145
+ `${ filePath } : Unexpected code at ${ pos } -${ match . index } , expected ${ current . title } ` ,
143
146
) ;
144
147
process . exitCode = 1 ;
145
148
pos = match . index ;
@@ -181,12 +184,12 @@ for (const filePath of allFiles) {
181
184
}
182
185
183
186
const matches = content . match (
184
- / m a k e S e r i a l i z a b l e \( \s * [ ^ , ] + , \s * " w e b p a c k \/ l i b \/ [ ^ " ] + " \s * (?: , [ ^ ) ] + ) ? \) / g
187
+ / m a k e S e r i a l i z a b l e \( \s * [ ^ , ] + , \s * " w e b p a c k \/ l i b \/ [ ^ " ] + " \s * (?: , [ ^ ) ] + ) ? \) / g,
185
188
) ;
186
189
if ( matches ) {
187
190
for ( const match of matches ) {
188
191
const str = / m a k e S e r i a l i z a b l e \( \s * [ ^ , ] + , \s * " w e b p a c k \/ l i b \/ ( [ ^ " ] + ) " / . exec (
189
- match
192
+ match ,
190
193
) [ 1 ] ;
191
194
allSerializables . add ( str ) ;
192
195
}
@@ -195,13 +198,13 @@ for (const filePath of allFiles) {
195
198
196
199
// Check if internalSerializables.js includes all serializables in webpack
197
200
for ( const internalSerializables of allFiles . filter ( ( file ) =>
198
- file . includes ( "internalSerializables" )
201
+ file . includes ( "internalSerializables" ) ,
199
202
) ) {
200
203
const content = fs . readFileSync ( internalSerializables ) ;
201
204
for ( const serializable of allSerializables ) {
202
205
if ( ! content . includes ( `"../${ serializable } "` ) ) {
203
206
console . log (
204
- `${ internalSerializables } : must include static require to ../${ serializable } `
207
+ `${ internalSerializables } : must include static require to ../${ serializable } ` ,
205
208
) ;
206
209
process . exitCode = 1 ;
207
210
}
0 commit comments