【问题标题】:Running ng lint --fix does absolutely nothing运行 ng lint --fix 绝对没有任何作用
【发布时间】:2021-02-07 14:43:02
【问题描述】:

我基本上将 npm 和 angular cli ng 更新到了它们的最新版本,并通过运行创建了一个新的 angular 项目:ng new app-name-here --routing

我想做的第一件事是将项目的缩进从 2 个空格更改为 4 个空格,所以我继续到 tsconfig.json 文件并进行了更改:

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

按照this发送到以下内容。

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

再次运行ng lint --fix,它说所有文件都通过了 lint。

我很奇怪,因为我链接到它的资源指定的架构具有对象而不是数组的格式。所以我改用那个,重试了,没有运气。

如何使用 4 个空格而不是 2 个空格对我的 Angular 项目进行 lint?

注意刚刚尝试将“空格”更改为“制表符”,linter 显示警告。但我就是无法设置空格数

【问题讨论】:

    标签: typescript angular-cli config tslint


    【解决方案1】:

    我有opened an issue on github to the angular cli project,得到的回应是这是tslint 项目中的一个错误。

    我已经更改了我的配置,所以我的 linter 现在是 eslint 并相应地更新了 angular 脚本。现在它可以正常工作了。

    【讨论】:

      猜你喜欢
      • 2019-08-14
      • 2021-02-05
      • 2021-12-17
      • 2015-03-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多