简体   繁体   中英

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

Hot to properly set options for Eslint plugin using Webpack?

This is my webpack.config.js file:

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

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

And it throws an error:

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

I need to disable no-undef , set max-len to 120 chars and change indent to tab .

I can't find any info in documentation, also I can't apply Eslint doc options to this plugin.

skipBlankLines and ignoreComments are not valid options for eslint-webpack-plugin Reference: Documentation

If you want to disable no-undef , set max-len to 120 chars and change indent to tab

Add this to your .eslintrc file in the rules section.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM