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()],
};
相关推荐
Csvn7 小时前
Monorepo
前端
Csvn7 小时前
流水线
前端
Csvn8 小时前
微前端架构
前端
Linux-lucky9 小时前
45-Linux学习之旅之防火墙与WEB加固
linux·前端·网络·学习·ubuntu
风骏时光牛马11 小时前
生成一个移动端标题,只需要一个标题,不需要其他的任何文本。
前端
IT_陈寒12 小时前
Redis雪崩把我坑惨了,这是5年经验的教训
前端·人工智能·后端
SameX12 小时前
HarmonyOS ArkUI List 的侧滑删除 用 ListItem 的 swipeAction + endIcon 的做法
前端
usdoc文档预览14 小时前
USDOC系列之PPT文件在线编辑-VUE前端实现在线浏览器在线编辑PPT文档
前端·vue.js·编辑器·office365·ppt在线编辑·office文件在线编辑·文件在线编辑
用户27050777252414 小时前
Agent 调工具卡住?3 种超时与取消策略实测对比
前端
LuHang15 小时前
我一行代码没写,把领导派的活做成了公司内部系统😭
前端