eslint-webpack-plugin

说明:现在eslint已经弃用了eslint-loader,如果要安装来使用的话,会报错,烦死人

大概的报错信息如下:

ERROR in ./src/index.js

Module build failed (from ./node_modules/eslint-loader/dist/cjs.js):

TypeError: Cannot read property 'getFormatter' of undefined

那么我们现在一般使用eslint提供的eslint-webpack-plugin插件对语法进行校验

安装:

npm i eslint-webpack-plugin -D

使用:

javascript 复制代码
const path = require("path");
const ESLintPlugin = require("eslint-webpack-plugin");
module.exports = {
  entry: "./src/index.js",
  output: {
    filename: "js/bundle.js",
    path: path.resolve(__dirname, "./build"),
  },
  mode: "development",
  devtool: "source-map",
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /node_modules$/,
        use: ["babel-loader"],
      },
    ],
  },
  plugins: [new ESLintPlugin()],
};
相关推荐
逃逸线LOF几秒前
CSS之精灵图(雪碧图)Sprites、字体图标
前端·css
欧先生^_^35 分钟前
Node.js 源码概览
node.js
海天胜景1 小时前
jqGrid冻结列错行问题,将冻结表格(悬浮表格)与 正常表格进行高度同步
前端
清风细雨_林木木1 小时前
解决 Tailwind CSS 代码冗余问题
前端·css
三天不学习2 小时前
VueUse/Core:提升Vue开发效率的实用工具库
前端·javascript·vue.js·vueuse
余道各努力,千里自同风2 小时前
CSS实现文本自动平衡text-wrap: balance
前端·css
Yvonne爱编码3 小时前
CSS- 4.3 绝对定位(position: absolute)&学校官网导航栏实例
前端·css·html·html5·hbuilder
繁依Fanyi3 小时前
ImgShrink:摄影暗房里的在线图片压缩工具开发记
开发语言·前端·codebuddy首席试玩官
卓律涤3 小时前
【找工作系列①】【大四毕业】【复习】巩固JavaScript,了解ES6。
开发语言·前端·javascript·笔记·程序人生·职场和发展·es6
Ten peaches4 小时前
Selenium-Java版(环境安装)
java·前端·selenium·自动化