简体   繁体   English

运行 ng lint --fix 绝对没有任何作用

[英]Running ng lint --fix does absolutely nothing

I essentially updated npm and the angular cli ng to their latest versions and created a fresh angular project by running: ng new app-name-here --routing我基本上更新了npm和 angular cli ng到他们的最新版本,并通过运行创建了一个新的 angular 项目: ng new app-name-here --routing

The first thing I wanted to do was to change the indentation of the project from 2 spaces to 4 spaces so I went ahead to the tsconfig.json file and changed:我想做的第一件事是将项目的缩进从 2 个空格更改为 4 个空格,因此我继续查看tsconfig.json文件并更改:

...
"indent": {
    "options": [
         "spaces"
     ]
}
...

to the following as per this .到以下按照这个

...
"indent": {
    "options": [
         "spaces", 4
     ]
}
...

Ran ng lint --fix again and it says all files pass lint.再次运行ng lint --fix ,它说所有文件都通过了 lint。

I was weirded out because the schema specified by the resource I linked to it has the format of an object instead of an array.我很奇怪,因为我链接到它的资源指定的模式具有对象的格式而不是数组。 So I changed to that instead, retried and no luck.所以我改为改为,重试,但没有运气。

How may I lint my angular project with 4 spaces instead of 2?我如何用 4 个空格而不是 2 个空格来整理我的角项目?

Note Just tried changing "spaces" to "tabs" and the linter showed warnings.注意刚刚尝试将“空格”更改为“制表符”,并且 linter 显示警告。 But I just can't get to set the amount of spaces但我就是无法设置空格的数量

I've opened an issue on github to the angular cli project and the response was that this was a bug in the tslint project.在 github 上向 angular cli 项目提出了一个问题,得到的答复是这是tslint项目中的一个错误。

I've changed my configuration so my linter is now eslint and updated the angular scripts accordingly.我已经改变了我的配置,所以我的eslint现在是eslint并相应地更新了 angular 脚本。 Now it just works.现在它只是有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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