Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
395 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 Reply

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)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...