Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm scripts ignore errors

Tags:

I currently have a npm script for running a linter. Obviously there will be some errors being outputted, but the npm script fails rather than just show me errors and move on.

This is terrible especially when I have something else calling the script as it marvellously breaks everything. I can always run npm run lint --force to avoid errors but I don't have that --force luxury all the time (for example, with a git-hook).

How can I setup my script to output errors without causing a mess?

like image 958
Mohamed El Mahallawy Avatar asked May 20 '15 05:05

Mohamed El Mahallawy


2 Answers

Found the answer:

Simply adding: exit 0 to the end of the command did it!

like image 171
Mohamed El Mahallawy Avatar answered Nov 16 '22 14:11

Mohamed El Mahallawy


There are a few other options which are cross platform too:

eslint || true

For this to work on Windows, you'll need to npm install cash-true first

exitzero eslint

You'll need to npm install exitzero first

like image 29
Tim Avatar answered Nov 16 '22 16:11

Tim