0

我在一个 Angular 项目上配置了 Eslint以在提交期间检查代码。我在测试我的配置是否有效时犯了一个错误:我设置了规则并在代码中"no-console":"error"留下了一个。console.log()

当提交 ESLint 给我这个错误:

...
✖ eslint --fix:

C:\project\src\app\app.component.ts
  12:5  error  Unexpected console statement  no-console

✖ 1 problem (1 error, 0 warnings)

husky - pre-commit hook exited with code 1 (error)

我的疑问是我看到 2 行用 ✖ 签名。

它们是指相同的错误(console.log)还是其中之一是指 ESLint 配置问题?

谢谢你的帮助,

4

1 回答 1

1

在您的示例中,ESLint 说文件中只有一个问题C:\project\src\app\app.component.ts - 12:5 error Unexpected console statement no-console

关于✖ eslint --fix:- ESLint 只是建议运行命令来自动修复文件。

但是,fix命令只负责格式化,oyu 必须手动删除console.log()调用。

于 2021-09-29T15:41:37.053 回答