ng lint --fix=true doesn't fix linting errors

Viewed 12758

After creating a new project with "ng new" and after modifying tslint.json to use tabs instead of spaces, running "ng lint --fix=true" doesn't have any effect on .ts files:

enter image description here

ng lint --fix=true

only lists errors, but doesn't fix them. According to the documentation, it should though.

enter image description here

ERROR: 4:1   indent  tab indentation expected
ERROR: 5:1   indent  tab indentation expected
ERROR: 6:1   indent  tab indentation expected
ERROR: 9:1   indent  tab indentation expected

Env: Angular CLI: 10.1.7

Is the command wrong?

2 Answers

Using the command ng lint --fix is correct and should fix the indentation.
I played around with tslint in a new Angular project, and while it did fix e.g. quotemarks, it does not fix the indentation for some reason (even though it should have a fixer).

Maybe it would be an alternative to use prettier for code formatting? It's a very reliable formatting tool, while tslint is deprecated and more of a linter than a formatter.

ng lint --fix using this command we can fix -> ERROR: 22:27 quotemark " should be ' this type of issues at one time running this command on your CMD.

Related