简体   繁体   English

如何在 eslint/tslint 中配置忽略单行语句?

[英]How to config ignore single line statement in eslint/tslint?

I wanna never using non-block statement.我不想使用非阻塞语句。

Like,喜欢,

if (pass)
  continue; // (X)
if (pass) {
  continue; // (O)
}

Is there options for eslint/tslint? eslint/tslint 有选项吗?

If you are using eslint, then the rule is called curly .如果您使用的是 eslint,则该规则称为curly From reading your question, it was not clear whether you want to disable or enable this rule.通过阅读您的问题,尚不清楚您是要禁用还是启用此规则。 To get you started, though, in your .eslintrc.json configuration file, you can disable the rule like this:不过,为了让您开始,在您的.eslintrc.json配置文件中,您可以禁用如下规则:

{
    "rules": {
        "curly": "off"
    }
}

You can read about the other options for curly here: https://eslint.org/docs/rules/curly#options您可以在此处阅读有关curly的其他选项: https://eslint.org/docs/rules/curly#options

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

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