File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change 6
6
const childProcess = require ( 'child_process' )
7
7
const fs = require ( 'fs' )
8
8
const path = require ( 'path' )
9
+ const supportsColors = require ( 'supports-color' )
10
+
11
+ const hasBasicColorSupport = supportsColors . stdout . hasBasic && supportsColors . stderr . hasBasic
9
12
10
13
function execFile ( command , args ) {
11
14
return new Promise ( resolve => {
@@ -24,6 +27,10 @@ function execFile(command, args) {
24
27
25
28
let eslintOptions = [ '--color' , '--report-unused-disable-directives' , '.' ]
26
29
30
+ if ( hasBasicColorSupport ) {
31
+ eslintOptions = eslintOptions . concat ( [ '--color' ] )
32
+ }
33
+
27
34
const isTypeScriptProject = fs . existsSync ( 'tsconfig.json' )
28
35
29
36
if ( isTypeScriptProject ) {
Original file line number Diff line number Diff line change 50
50
"inquirer" : " >=6.0.0" ,
51
51
"prettier" : " >=1.12.0" ,
52
52
"read-pkg-up" : " >=6.0.0" ,
53
+ "supports-color" : " ^7.1.0" ,
53
54
"svg-element-attributes" : " >=1.2.1"
54
55
},
55
56
"peerDependencies" : {
You can’t perform that action at this time.
0 commit comments