@@ -148,40 +148,40 @@ const list = new Listr([
148148 renderer : isCI ? 'verbose' : 'default' ,
149149} ) ;
150150
151- list . run ( )
152- . catch ( async error => {
153- if ( error . errors ) {
154- for ( const error2 of error . errors ) {
155- console . error ( '\n' , chalk . red . bold . underline ( error2 . packageName ) , chalk . gray ( '(' + error2 . cliArgs . join ( ' ' ) + ')' ) ) ;
156- console . error ( error2 . message ) ;
157-
158- if ( error2 . stderr ) {
159- console . error ( chalk . gray ( error2 . stderr ) ) ;
160- }
161-
162- if ( error2 . eslintMessage ) {
163- const { file, project, destination} = error2 . eslintJob ;
164- const { line} = error2 . eslintMessage ;
151+ async function logError ( error ) {
152+ if ( error . errors ) {
153+ for ( const error2 of error . errors ) {
154+ console . error ( '\n' , chalk . red . bold . underline ( error2 . packageName ) , chalk . gray ( '(' + error2 . cliArgs . join ( ' ' ) + ')' ) ) ;
155+ console . error ( error2 . message ) ;
156+
157+ if ( error2 . stderr ) {
158+ console . error ( chalk . gray ( error2 . stderr ) ) ;
159+ }
165160
166- if ( project . repository ) {
167- // eslint-disable-next-line no-await-in-loop
168- const branch = await getBranch ( destination ) ;
169- console . error ( chalk . gray ( `${ project . repository } /blob/${ branch } /${ path . relative ( destination , file . filePath ) } #L${ line } ` ) ) ;
170- } else {
171- console . error ( chalk . gray ( `${ path . relative ( destination , file . filePath ) } #L${ line } ` ) ) ;
172- }
161+ if ( error2 . eslintMessage ) {
162+ const { file, project, destination} = error2 . eslintJob ;
163+ const { line} = error2 . eslintMessage ;
173164
174- console . error ( chalk . gray ( JSON . stringify ( error2 . eslintMessage , undefined , 2 ) ) ) ;
165+ if ( project . repository ) {
166+ // eslint-disable-next-line no-await-in-loop
167+ const branch = await getBranch ( destination ) ;
168+ console . error ( chalk . gray ( `${ project . repository } /blob/${ branch } /${ path . relative ( destination , file . filePath ) } #L${ line } ` ) ) ;
169+ } else {
170+ console . error ( chalk . gray ( `${ path . relative ( destination , file . filePath ) } #L${ line } ` ) ) ;
175171 }
172+
173+ console . error ( chalk . gray ( JSON . stringify ( error2 . eslintMessage , undefined , 2 ) ) ) ;
176174 }
177- } else {
178- console . error ( error ) ;
179175 }
180-
181- process . exit ( 1 ) ;
182- } )
183- // Catch errors in last `.catch`
184- . catch ( error => {
176+ } else {
185177 console . error ( error ) ;
186- process . exit ( 1 ) ;
187- } ) ;
178+ }
179+
180+ process . exit ( 1 ) ;
181+ }
182+
183+ try {
184+ await list . run ( ) ;
185+ } catch ( error ) {
186+ await logError ( error ) ;
187+ }
0 commit comments