JSHintの特定の行のリンティングルールをオフにするには、次のルールを使用します。
/* jshint ignore:start*/
$scope.someVar = ConstructorFunction();
/* jshint ignore:end */私はeslintについて上記と同等のものを見つけようとしています。
JSHintの特定の行のリンティングルールをオフにするには、次のルールを使用します。
/* jshint ignore:start*/
$scope.someVar = ConstructorFunction();
/* jshint ignore:end */私はeslintについて上記と同等のものを見つけようとしています。
回答:
これで、1行の構文を使用できます。
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();リクエストされたドキュメントリンク:http : //eslint.org/docs/user-guide/configuring.html#configuring-rules
//eslint-disable-line、それを行うだけで、特定の行のすべてのルールが無効になっているように見えます。
                    --no-inline-configた、オンPrevent comments from changing config or rules
                    以下を使用できます
/*eslint-disable */
//suppress all warnings between comments
alert('foo');
/*eslint-enable */これは、ドキュメントの「ルールの構成」セクションにわずかに埋め込まれています。
ファイル全体の警告を無効にするには、ファイルの上部にコメントを含めることができます。
/*eslint eqeqeq:0*/ESlintが更新され、1行を無効にするより良い方法が追加されました。@ goofballLogicの優れた回答をご覧ください。
//コメントの構文が機能しないようです…
                    特定のルール(すべてではなく)を、enable(open)およびdisable(close)ブロックで指定して無効にすることもできます。
/* eslint-disable no-alert, no-console */
alert('foo');
console.log('bar');
/* eslint-enable no-alert */上記の@goofballMagicのリンク:http ://eslint.org/docs/user-guide/configuring.html#configuring-rules
Expected exception block, space or tab after '/*' in comment.:)
                    prettierしてeslint自分のコードをフォーマットします。これはインラインコメントを許可しません。多くの/* eslint-disable-next-line ... */ステートメントは読みにくく、コード内で見つけるのが困難です。
                    ESLintの構成から-インラインコメントでルールを無効にする:
/* eslint-disable no-alert, no-console */
/* eslint-disable */
alert('foo');
/* eslint-enable */
/* eslint-disable no-alert, no-console */
alert('foo');
console.log('bar');
/* eslint-enable no-alert, no-console */
/* eslint-disable */
alert('foo');
/* eslint-disable no-alert */
alert('foo');
alert('foo'); // eslint-disable-line
// eslint-disable-next-line
alert('foo');
alert('foo'); // eslint-disable-line no-alert
// eslint-disable-next-line no-alert
alert('foo');
alert('foo'); // eslint-disable-line no-alert, quotes, semi
// eslint-disable-next-line no-alert, quotes, semi
alert('foo');
foo(); // eslint-disable-line example/rule-nameインラインコメントを使用できます:// eslint-disable-next-line rule-name。
// eslint-disable-next-line no-console
console.log('eslint will ignore the no-console on this line of code');ESLint- インラインコメントでルールを無効にする
一般的な行末コメント、の// eslint-disable-line後には何も必要ありません。ESLintで無視するものを指定するためにコードを検索する必要はありません。
クイックデバッグ以外の理由で構文を無視する必要がある場合は、問題が発生します。delint構成を更新しないでください。
プロトコルの違反のために開発環境が気にせずに、サービスをすばやく検査// eslint-disable-lineできるように挿入できることを楽しんconsoleでいます。(私は通常、禁止しconsole、ロギングクラスを使用しますconsole。
または、次の行に複数の無視がある場合は、コンマを使用してルールの文字列を入力します
// eslint-disable-next-line class-methods-use-this, no-unused-vars以下のファイルの残りの1つのルールを無効にするには:
/* eslint no-undef: "off"*/
const uploadData = new FormData();/* eslint-disable no-new */
                    エラーを発生させるファイルをプロジェクトの.eslintignoreファイルに追加できます。すべての.vueファイルと同様に、/ *。vueを追加するだけです。
eslint-disable-next-line: