Craig Smitham
Craig Smitham

Reputation: 3963

"ng lint" quiet option?

How can I run ng lint without showing warnings? TSLint CLI provides a --quiet flag, but there doesn't appear to be one for Angular or a way to pass through CLI flags. I still want warnings in my tsconfig so they show up in the editor, but sometimes I only want a list of errors.

Upvotes: 13

Views: 8577

Answers (3)

R. Hoek
R. Hoek

Reputation: 1106

Just run ng lint --quiet and only 'error' messages will be shown.

Upvotes: 17

9motom6
9motom6

Reputation: 66

Widnows solution:

You can use findstr which Searches for patterns of text. The parameter /v prints only lines that don't contain a match.

https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/findstr

ng lint [PROJECT NAME] | findstr /v "WARNING: .*"

You can omit [Project Name] if you want to run everything in the directory

ng lint | findstr /v "WARNING: .*"

Upvotes: 3

DeborahK
DeborahK

Reputation: 60568

I'm not sure this is what you are asking, but if you add this line:

"defaultSeverity": "warning",

To your tslint.json file, you will get warnings instead of errors when you run ng lint.

My tslint.json file looks like this:

{
  "defaultSeverity": "warning",
  "rulesDirectory": [
    "node_modules/codelyzer"
  ],
  "rules": {
    ...

Upvotes: 0

Related Questions