簡體   English   中英

Webpack:如何設置 eslint-webpack-plugin 規則?

[英]Webpack: how to set eslint-webpack-plugin rules?

熱到使用 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 文檔選項應用於此插件。

skipBlankLinesignoreComments不是eslint-webpack-plugin有效選項參考: 文檔

如果要禁用no-undef ,請將max-len設置為 120 個字符並將indent更改為tab

將此添加到規則部分的.eslintrc文件中。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM