1.下载多个相关插件
npm i -D eslint eslint-config-airbnb-base eslint-webpack-plugin eslint-plugin-import
2.webpack.config.js中进行引用,并实例化
const ESLintPlugin = require('eslint-webpack-plugin')
new ESLintPlugin()
3.配置package.json
"eslintConfig": {
"extends": "airbnb-base"
}
//添加扩展库
4.运行webpack进行打包,配置已生效会出现很多js格式错误
ERROR in
D:\Webpack\03-webpackcss\src\index.js
1:24 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
1:24 error Missing semicolon semi
2:1 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
3:28 error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
4:23 error Expected linebreaks to be 'LF' but found 'CRLF