@@ -163,38 +163,34 @@ const eslint = async (command: Command): Promise<stepResponse> => {
163163 stdout : ( data ) => {
164164 outputStr += data . toString ( ) ;
165165 } ,
166- stderr : ( data ) => {
167- outputStr += data . toString ( ) ;
168- } ,
169166 } ,
170167 } ) ;
171168 } catch ( error ) {
172169 error = true ;
173170 setFailed ( `Failed ${ command . label } : ${ error } ` ) ;
174171 }
175172
176- if ( error ) {
173+ const lines = outputStr . split ( "\n" ) ;
174+ const table = lines
175+ . map ( ( line ) => {
176+ const match = line . match ( / ^ ( .* ?) : ( \d + ) : ( \d + ) : ( .* ) $ / ) ;
177+ if ( match ) {
178+ const [ _ , file , line , column , message ] = match ;
179+ return `<tr><td>${ file } </td><td>${ line } </td><td>${ column } </td><td>${ message } </td></tr>` ;
180+ }
181+ return "" ;
182+ } )
183+ . join ( "" ) ;
184+
185+ const problemCount = lines . filter ( ( line ) =>
186+ line . match ( / ^ ( .* ?) : ( \d + ) : ( \d + ) : ( .* ) $ / ) ,
187+ ) . length ;
188+
189+ if ( problemCount > 0 ) {
177190 response . error = true ;
178- // Parse the output to find errors and problems
179- const lines = outputStr . split ( "\n" ) ;
180- const table = lines
181- . map ( ( line ) => {
182- const match = line . match ( / ^ ( .* ?) : ( \d + ) : ( \d + ) : ( .* ) $ / ) ;
183- if ( match ) {
184- const [ _ , file , line , column , message ] = match ;
185- return `<tr><td>${ file } </td><td>${ line } </td><td>${ column } </td><td>${ message } </td></tr>` ;
186- }
187- return "" ;
188- } )
189- . join ( "" ) ;
190-
191- const problemCount = lines . filter ( ( line ) =>
192- line . match ( / ^ ( .* ?) : ( \d + ) : ( \d + ) : ( .* ) $ / ) ,
193- ) . length ;
194- response . output = `<p>${ problemCount } problem${ problemCount !== 1 ? "s" : "" } found</p><details><summary>See Details</summary><table><tr><th>File</th><th>Line</th><th>Column</th><th>Message</th></tr>${ table } </table></details>` ;
195- return response ;
191+ response . output = `<li>${ failedEmoji } - ${ command . label } : ${ problemCount } problem${ problemCount !== 1 ? "s" : "" } found\n<details><summary>See Details</summary><table><tr><th>File</th><th>Line</th><th>Column</th><th>Message</th></tr>${ table } </table></details></li>` ;
196192 } else {
197193 response . output = `<li>${ passedEmoji } - ${ command . label } \n</li>` ;
198- return response ;
199194 }
195+ return response ;
200196} ;
0 commit comments