question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature Request] Allow lint to fail if only warnings are found

See original GitHub issue

Hello,

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:closed
  • Created 3 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
juristrcommented, May 25, 2020

@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

2reactions
juristrcommented, May 25, 2020

@capJavert merged 🎉. Give it a try and let us know. Again sorry for the delay

Read more comments on GitHub >

github_iconTop Results From Across the Web

Lint and why We Remove It. Lint warnings have a tendency to…
Lint allows us to stop the warnings list from growing even before reducing the list of warnings by setting the baseline warnings state....
Read more >
Errors and Warnings — Verilator 5.005 documentation
Disable the warning using Configuration Files with a lint_off command. This is useful when a script suppresses warnings, and the Verilog source should...
Read more >
cargo-fix - Automatically fix lint warnings reported by rustc
This is useful if cargo fix fails to apply the changes. It will apply the changes and leave the broken code in the...
Read more >
lint-staged - npm
Linter commands work on a subset of all staged files, defined by a glob pattern. lint-staged uses micromatch for matching files with the ......
Read more >
Known issues with Android Studio and Android Gradle Plugin
If you see an alert that System software from developer "Intel Corporation Apps" was blocked from loading, click Allow: For more information and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found