JSHintで特定の行のリンティング・ルールをオフにするには、以下のルールを使用します。
/* jshint ignore:start*/
$scope.someVar = ConstructorFunction();
/* jshint ignore:end */
eslintで上記に相当するものを探してみました。
これで一行の構文が使えるようになりました。
var thing = new Thing(); // eslint-disable-line no-use-before-define
thing.sayHello();
function Thing() {
this.sayHello = function() { console.log("hello"); };
}
また、実際のコードと同じ行にコメントを入れたくない場合は、次の行を無効にすることができます。
// 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
以下のように使用できます。
/*eslint-disable */
//suppress all warnings between comments
alert('foo');
/*eslint-enable */
これはdocsの"configuring rules"の部分に少し埋まっています。
ファイル全体に対する警告を無効にするには、ファイルの先頭にコメントを記述します。
/*eslint eqeqeq:0*/
ESlintは、@goofballLogic'さんのexcellent answerを参照して、1行を無効にするより良い方法に更新されました。
また、有効(オープン)および無効(クローズ)ブロックに指定することで、(すべてではなく)特定のルール/規則を無効にすることができます。
/* eslint-disable no-alert, no-console */
alert('foo');
console.log('bar');
/* eslint-enable no-alert */
via @goofballMagic's link above: http://eslint.org/docs/user-guide/configuring.html#configuring-rules