关闭特定行的eslint规则 [英] Turning off eslint rule for a specific line

查看:629
本文介绍了关闭特定行的eslint规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了关闭JSHint中特定行的linting规则,我们使用以下规则:

In order to turn off linting rule for a particular line in JSHint we use the following rule:

/* jshint ignore:start*/
$scope.someVar = ConstructorFunction();
/* jshint ignore:end */

我一直试图找到相当于以上为eslint。

I have been trying to locate the equivalent of the above for eslint.

推荐答案

您现在可以使用单行语法:

You can use the single line syntax now:

var thing = new Thing(); // eslint-disable-line no-use-before-define
thing.sayHello();

function Thing() {

     this.sayHello = function() { console.log("hello"); };

}

或者如果你不想发表评论与实际代码相同的行,可以禁用下一行:

Or if you don't want to have a comment on the same line with the actual code, it is possible to disable next line:

// eslint-disable-next-line no-use-before-define
var thing = new Thing();

请求的文档链接: http://eslint.org/docs/user-guide/configuring.html#configuring-rules

这篇关于关闭特定行的eslint规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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