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

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

我一直在尝试为eslint找到与上述内容相同的内容。


当前回答

您可以在项目中添加给.eslitingnore文件带来错误的文件。与所有.vue文件一样,只需添加/*.vue

其他回答

要禁用下一行:

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

或者使用单行语法:

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

查看eslint文档

答复

您可以使用内联注释://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 no-undef: "off"*/
const uploadData = new FormData();

您可以在项目中添加给.eslitingnore文件带来错误的文件。与所有.vue文件一样,只需添加/*.vue

您还可以通过在启用(打开)和禁用(关闭)块中指定特定规则(而不是全部)来禁用特定规则:

/* eslint-disable no-alert, no-console */

alert('foo');
console.log('bar');

/* eslint-enable no-alert */

通过上面@gobballMagic的链接:http://eslint.org/docs/user-guide/configuring.html#configuring-规则