[Feature Request] Allow lint to fail if only warnings are found
See original GitHub issueHello,
I am using @nrwl/linter:lint
and as per eslint
specification command will not fail if only warnings are detected. There is however a argument:
--max-warnings Int Number of warnings to trigger nonzero exit code - default: -1
WIth this argument I could usually make sure that lint process succedes only if no errors or warnings are found. This is useful because while most errors (like console.logs or undefined vars) are harmless during development I do not wish for those to end up in production code. We usually prevent this by setting --max-warning=0
for our production build checkup
stage.
I know that there is a workaround and we could manually override all rules to error
while doing the production
build but this is time consuming and clunky because we have then 2 configurations that need maintaining.
I would much prefer having an option to set --max-warnings
through @nrwl/linter:lint
command. I think it would also be useful to others.
I am also open in submiting a PR for this feature is this is something we could agree on implementing.
Prerequisites
- I am running the latest version
- I checked the documentation (nx.dev) and found no answer
- I checked to make sure that this issue has not already been filed
- I’m reporting the issue to the correct repository (not related to React, Angular or any dependency)
Expected Behavior
Be able to run something like:
nx affected:lint --max-warning=0
nx affected:lint --strict // or something like this, more like a boolean
Current Behavior
There is no easy way to fail lint stage if only warnings are found.
Context
Latest nx project with stocks.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (3 by maintainers)
@capJavert sorry I didn’t come back to you earlier 🙏. Other things came up and didn’t have a chance to look at it again.
But just gave it a look now and I have a fix locally. Gonna push up a PR that adds a
maxWarnings
to the builder. I’ll discuss it with the team@capJavert merged 🎉. Give it a try and let us know. Again sorry for the delay