From d393c1d3815b72ac572ac6df7d39ab692178e5d7 Mon Sep 17 00:00:00 2001 From: Mingye Wang Date: Thu, 12 Sep 2019 11:58:32 +0800 Subject: [PATCH] fix: drop shell for lint we can node it ourselves; triggered by nodejs/node#29532 --- scripts/lint.js | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/scripts/lint.js b/scripts/lint.js index 207cdcf9aa80..58574f0216a8 100644 --- a/scripts/lint.js +++ b/scripts/lint.js @@ -8,20 +8,30 @@ process.chdir(base) const reportOnly = argv.reportOnly ;(async () => { - !argv.noEslint - ? await spawn('eslint', [ - '--ignore-path', - '.prettierignore', - '--ext', - 'tsx,ts,jsx,js', - ...(argv._.length ? argv._ : ['./src/']), - ...(reportOnly ? [] : ['--cache', '--fix']), - ]) - : null - !argv.noPrettier - ? await spawn('prettier', [ - ...(argv._.length ? argv._ : ['./**/*.{ts,tsx,jsx,js}']), - ...(reportOnly ? ['--check', '--loglevel', 'log'] : ['--write', '--loglevel', 'warn']), - ]) - : null + if (!argv.noEslint) + await spawn( + 'node', + [ + // Guess what happens if you don't do this? + // Path resolution makes a \n, which becomes... + path.join(base, 'node_modules/eslint/bin/eslint.js'), + '--ignore-path', + '.prettierignore', + '--ext', + 'tsx,ts,jsx,js', + ...(argv._.length ? argv._ : ['./src/']), + ...(reportOnly ? [] : ['--cache', '--fix']), + ], + { shell: false }, + ) + if (!argv.noPrettier) + await spawn( + 'node', + [ + path.join(base, 'node_modules/prettier/bin-prettier.js'), + ...(argv._.length ? argv._ : ['./**/*.{ts,tsx,jsx,js}']), + ...(reportOnly ? ['--check', '--loglevel', 'log'] : ['--write', '--loglevel', 'warn']), + ], + { shell: false }, + ) })()