如何使用WebPack配置获取ESLint超文本标记语言报告。我目前使用的是eslint-loader。ESLint上的documentation格式化程序不清晰。
在webpack.config.js中,我添加了以下内容作为预加载器。
preLoaders: [{
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
loaders: ['eslint-loader'],
}],当我运行WebPack时,它可以很好地完成任务,并在控制台中显示错误。我在WebPack中额外添加了
eslint: {
formatter: require("eslint/lib/formatters/html"),
},它在控制台本身抛出HTML输出字符串。我想得到它/另存为HTML文件。任何提示都会很有帮助。
发布于 2016-12-08 08:06:47
您可能还需要在webpack.config.js中指定输出文件,如下所示:
...
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'),
}
},
...https://stackoverflow.com/questions/37181875
复制相似问题