How to trigger fail CI/CD on eslint warning

Viewed 2013

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?

2 Answers

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

eslint '**/*.js' --max-warnings=0

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

Related