首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用webpack的ESLint HTML报表

使用webpack的ESLint HTML报表
EN

Stack Overflow用户
提问于 2016-05-12 16:52:12
回答 1查看 1K关注 0票数 0

如何使用WebPack配置获取ESLint超文本标记语言报告。我目前使用的是eslint-loader。ESLint上的documentation格式化程序不清晰。

webpack.config.js中,我添加了以下内容作为预加载器。

代码语言:javascript
复制
preLoaders: [{
        test: /\.jsx?$/,
        exclude: /(node_modules|bower_components)/,
        loaders: ['eslint-loader'],
    }],

当我运行WebPack时,它可以很好地完成任务,并在控制台中显示错误。我在WebPack中额外添加了

代码语言:javascript
复制
eslint: {
        formatter: require("eslint/lib/formatters/html"),
    },

它在控制台本身抛出HTML输出字符串。我想得到它/另存为HTML文件。任何提示都会很有帮助。

EN

回答 1

Stack Overflow用户

发布于 2016-12-08 08:06:47

您可能还需要在webpack.config.js中指定输出文件,如下所示:

代码语言:javascript
复制
...
module: {
    loaders: [
      {
        test: /\.jsx?$/,
        include: path.join(__dirname, 'src'),
        loader: 'babel',
      },
      {
          test: /\.js$/,
          exclude: /node_modules/,
          loaders: ['babel-loader', 'eslint-loader' ]
      },
      {
        test: /\.css$/,
        loader: 'style-loader!css-loader'
      }
    ]
  },
  output: {
    path: path.join(__dirname, "src"),
    filename: "client.min.js"
  },
  eslint: {
    configFile: './.eslintrc',
    outputReport: {
      filePath: 'eslint_checkstyle_[hash].xml',
      formatter: require('eslint/lib/formatters/checkstyle'),
    }
  },
...
票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37181875

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档