Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
381 views
in Technique[技术] by (71.8m points)

javascript - 关闭特定行的eslint规则(Turning off eslint rule for a specific line)

In order to turn off linting rule for a particular line in JSHint we use the following rule:(为了关闭JSHint中特定行的linting规则,我们使用以下规则:)

/* jshint ignore:start*/ $scope.someVar = ConstructorFunction(); /* jshint ignore:end */ I have been trying to locate the equivalent of the above for eslint.(我一直试图找到相当于以上的eslint。)   ask by runtimeZero translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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(); Requested docs link: http://eslint.org/docs/user-guide/configuring.html#configuring-rules(请求的文档链接: http//eslint.org/docs/user-guide/configuring.html#configuring-rules)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...