Webpack:如何设置 eslint-webpack-plugin 规则?

Webpack: how to set eslint-webpack-plugin rules?

如何使用 Webpack 为 Eslint plugin 正确设置选项?

这是我的 webpack.config.js 文件:

const path = require('path');
const ESLintPlugin = require('eslint-webpack-plugin');

module.exports = {
   plugins: [new ESLintPlugin({
       "skipBlankLines": true,
       "ignoreComments": true
   })],
}

它抛出一个错误:

ERROR in Invalid Options:
- Unknown options: skipBlankLines, ignoreComments

我需要禁用 no-undef,将 max-len 设置为 120 个字符并将 indent 更改为 tab

我在文档中找不到任何信息,我也无法将 Eslint doc 选项应用于此插件。

skipBlankLinesignoreComments 不是 eslint-webpack-plugin 的有效选项 参考:Documentation

如果要禁用 no-undef,请将 max-len 设置为 120 个字符并将 indent 更改为 tab

将此添加到规则部分的 .eslintrc 文件中。

"rules": {
    "no-undef": "off",
    "max-len": ["error", { "code": 120 }],
    "indent": ["error", "tab"]
    ....
}