File tree 1 file changed +11
-0
lines changed
1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 7
7
8
8
'use strict' ;
9
9
10
+ const path = require ( 'path' ) ;
10
11
const chalk = require ( 'chalk' ) ;
11
12
const stripAnsi = require ( 'strip-ansi' ) ;
12
13
const table = require ( 'text-table' ) ;
13
14
15
+ const cwd = process . cwd ( ) ;
16
+
14
17
function isError ( message ) {
15
18
if ( message . fatal || message . severity === 2 ) {
16
19
return true ;
17
20
}
18
21
return false ;
19
22
}
20
23
24
+ function getRelativePath ( filePath ) {
25
+ return path . relative ( cwd , filePath ) ;
26
+ }
27
+
21
28
function formatter ( results ) {
22
29
let output = '\n' ;
23
30
let hasErrors = false ;
@@ -73,6 +80,10 @@ function formatter(results) {
73
80
} ,
74
81
} ) ;
75
82
83
+ // print the filename and relative path
84
+ output += `${ getRelativePath ( result . filePath ) } \n` ;
85
+
86
+ // print the errors
76
87
output += `${ outputTable } \n\n` ;
77
88
} ) ;
78
89
You can’t perform that action at this time.
0 commit comments