简体   繁体   English

如何在tslint中使用npm警告?

[英]How to use npm warnings in tslint?

I am new using tslint, in the past I used eslint for javascript files and now I want to use tslint as my typescript linting tool. 我是使用tslint的新手,过去我使用eslint处理javascript文件,现在我想将tslint用作我的打字稿掉毛工具。

The thing is that using eslint I was able to specify that some of my errors where specifyed as NPM warnings, in this case the console logging. 事情是,使用eslint,我可以指定某些错误,这些错误指定为NPM警告,在本例中为控制台日志记录。

**使用tsling的控制台错误**

As you can see my "warnings" are throwing an npm ERR, is there a way to tell that it should be npm WARN ??? 如您所见,我的“警告”正在抛出npm ERR,有没有办法告诉它应该是npm WARN?

To change the severity of the rule an object must be used as the rule setting. 要更改规则的严重性,必须将一个对象用作规则设置。

{
  // ...
  "rules": {
    "no-console": {
      "options": [true, "log"],
      "severity": "warning"
    }
  }
}

You may also wish to follow this link to the documentation . 您可能还希望遵循此链接到文档

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

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