diff --git a/src/run-script.js b/src/run-script.js index cbeab056..f0462573 100755 --- a/src/run-script.js +++ b/src/run-script.js @@ -55,14 +55,8 @@ function getEnv() { function spawnScript() { // get all the arguments of the script and find the position of our script commands const args = process.argv.slice(2) - const scriptIndex = args.findIndex( - x => - x === 'format' || - x === 'lint' || - x === 'pre-commit' || - x === 'test' || - x === 'validate' || - x === 'build', + const scriptIndex = args.findIndex(x => + ['build', 'format', 'lint', 'pre-commit', 'test', 'validate'].includes(x), ) // Extract the node arguments so we can pass them to node later on diff --git a/src/scripts/validate.js b/src/scripts/validate.js index 7d6b5d64..7d67c285 100644 --- a/src/scripts/validate.js +++ b/src/scripts/validate.js @@ -24,10 +24,13 @@ const scripts = useDefaultScripts : ifScript('test', 'npm run test --silent -- --coverage'), typecheck: ifScript('typecheck', 'npm run typecheck --silent'), } - : validateScripts.split(',').reduce((scriptsToRun, name) => { - scriptsToRun[name] = `npm run ${name} --silent` - return scriptsToRun - }, {}) + : validateScripts.split(',').reduce( + (scriptsToRun, name) => ({ + ...scriptsToRun, + [name]: `npm run ${name} --silent`, + }), + {}, + ) const scriptCount = Object.values(scripts).filter(Boolean).length