Webpack:如何设置eslint Webpack插件规则



使用Webpack为Eslint插件正确设置选项很热门?

这是我的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的有效选项参考:文档

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

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

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

最新更新