简体   繁体   English

如何避免所有 TSLint 错误

[英]How to avoid all TSLint errors

I have 2 angular projects in my machine.我的机器中有 2 个 angular 项目。
When I doing the first project nothing wrong with me there.当我做第一个项目时,我没有任何问题。 I worked freely(without TSLint errors).我工作自由(没有 TSLint 错误)。 But my second project always shows TSLint errors.但我的第二个项目总是显示 TSLint 错误。 I want the second project to be like the first one.我希望第二个项目像第一个一样。 Is there any way to do this?有没有办法做到这一点?

Angular CLI: 8.3.26
Node: 12.16.3
OS: win32 x64
Angular: 8.2.14

@angular-devkit/architect         0.803.26
@angular-devkit/build-angular     0.803.26
@angular-devkit/build-optimizer   0.803.26
@angular-devkit/build-webpack     0.803.26
@angular-devkit/core              8.3.26
@angular-devkit/schematics        8.3.26
@angular/cli                      8.3.26
@ngtools/webpack                  8.3.26
@schematics/angular               8.3.26
@schematics/update                0.803.26
rxjs                              6.4.0
typescript                        3.5.3
webpack                           4.39.2

This is an image of the First project.这是第一个项目的图像。 Which if works fine.如果工作正常。 Look,5 new lines, but no TSLint errors.看,5 个新行,但没有 TSLint 错误。

这是第一个项目的图像。

This is an image of the second project.这是第二个项目的图像。

这是第一个项目的图像 I want to make the second project work like the first.我想让第二个项目像第一个一样工作。 Is there is any way to do this?有没有办法做到这一点?

I found the answer to my own question.我找到了自己问题的答案。
I am using IntelliJ to code.我正在使用 IntelliJ 进行编码。 In this IDE we can disable TSLint check.在这个 IDE 中,我们可以禁用 TSLint 检查。
Click on the red bulb on the left side and next click the TSLint options.单击左侧的红色灯泡,然后单击 TSLint 选项。
After this dialog box will appear.之后会出现这个对话框。 Uncheck the enable mode.取消选中启用模式。 That's it!而已!

If you are using vs code, and you have tslint extension installed disable it to ignore lint errors.如果您使用的是 vs 代码,并且安装了 tslint 扩展,请禁用它以忽略 lint 错误。 在此处输入图像描述

Alternate options:备选方案:

  • Remove the tslint.json file删除tslint.json文件
  • Remove the dependency on tslint in the package.json file去除package.json文件中对tslint的依赖
  • Uninstall TSLint with npm uninstall tslintnpm 卸载 TSLint 卸载 tslint

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

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