[Fixed] ng lint how to use eslint CLI flags such as –max-warnings=0

Issue

I’ve got an Angular 10 project that uses eslint.

I run my linting with:

ng lint

There are no errors but some warnings. I want ng lint to fail with a non zero exit code when there are only warnings. I’ve tried using the eslint flag –max-warnings=0 as follows:

ng lint --max-warnings=0

but it says:

unknown option ‘–max-warnings’

This SO post suggests –max-warnings is an eslint CLI option only and cannot be configured via an .eslintrc file

How can I force linting to fail when there are only warnings when running ng lint? Many thanks

Solution

--max-warnings 0 try this. The = is not required.

Leave a Reply

(*) Required, Your email will not be published