简体   繁体   中英

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

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:

在此处输入图片说明

ng lint --fix=true

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

在此处输入图片说明

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?

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 eg 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 使用此命令我们可以修复 -> ERROR: 22:27 quotemark " 应该是 '一次在 CMD 上运行此命令的此类问题。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM