如何使用“tslint:recomended"忽略分号 [英] How to ignore semicolons with "tslint:recomended"

查看:43
本文介绍了如何使用“tslint:recomended"忽略分号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我的 tslint 忽略分号.

I want my tslint to ignore semicolons.

我想保留规则 "extends": "tslint:recommended".现在,我只是不能遵循这个规则,这迫使我总是使用分号,或者使用另一个 "semicolon": [true, "never"],这迫使我删除所有分号.我只想无视他们.我可以通过删除 "extends": "tslint:recommended" 来做到这一点,但我想保留这个规则,只是忽略分号.

I would like to keep the rule "extends": "tslint:recommended". Right now, I just can´t follow this rule, which forces me to use semicolon always, or use this other one "semicolon": [true, "never"], which forces me to delete all semicolons. I just want to ignore them. I can do it by deleting the "extends": "tslint:recommended" but I would like to keep this rule and just ignore semicolons.

tslint 文档只是提供了始终保留它们或始终删除它们的选项,但不能忽略它们.

tslint documentation just gives the option to keep them always or delete always, but not ignore them.

有人可以帮我吗?

推荐答案

与之前的回复一样,您可以取消文件或下一行的 tslint.但是如果你想编辑整个目录的规则,检查 tslint.json 文件,这是你所在项目的全局配置.

As in the previous response, you can suppress tslint for a file or the next line. But if you want to edit the rules for your entire directory, check the tslint.json file, this is your global configuration for the project you're on.

您可能会在应用的根文件夹中找到此文件.如果没有,请尝试按 cmd + P (mac) 或 ctrl + P (windows) 并输入 tslint.json.

You could probably find this file in the root folder of your app. If not, try pressing cmd + P (mac) or ctrl + P (windows) and enter tslint.json.

到达后,将此条目添加到规则列表中:

Once you're there, add this entry to the rules list:

{
  ...
  "rules": {
    ...
    "semicolon":false
  }
}

希望有帮助!

这篇关于如何使用“tslint:recomended"忽略分号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆