Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to trigger fail CI/CD on eslint warning

Tags:

eslint

gitlab

I would like to trigger fail CI/CD gitlab job on eslint warnings.

Eslint will fail on error, but in CI/CD I would like to fail on warnings too.

How can I do it?

like image 839
nirebam368 Avatar asked Jan 25 '23 17:01

nirebam368


2 Answers

You can fail eslint on any warnings by adding the --max-warnings=0 flag. For example:

eslint '**/*.js' --max-warnings=0
like image 194
Brady Dowling Avatar answered Jan 27 '23 06:01

Brady Dowling


You could use eslint-plugin-only-error to convert all your warnings to errors

like image 25
David Bradshaw Avatar answered Jan 27 '23 07:01

David Bradshaw