我不确定问题是什么。我不想将emitWarnings = true,因为我希望在夹板错误期间发射失败并在夹板错误后恢复。
如何在修复eslint错误后允许输出继续写入?
我尝试过以下几个选项:
https://github.com/MoOx/eslint-loader#gotchas
有一点需要注意:我正在通过Gulp运行webpack。
Webpack配置:
const webpack = require('webpack');
const path = require('path');
const glob = require('glob');
const PATHS = {
scriptApp: path.join(__dirname, '/Scripts/App'),
script: path.join(__dirname, '/Scripts/')
};
module.exports = {
entry: {
index1: [PATHS.scriptApp + '/index'],
},
devtool: 'eval-source-map',
module: {
preLoaders: [
{ test: /\.js$/, loader: 'eslint', exclude: 'node_modules' },
],
loaders: [
{ test: /\.js$/, loader: 'babel-loader', exclude: 'node_modules' },
{ test: /\.dot$/, loader: "dot-loader" }
]
},
output: {
path: path.join(__dirname, '/scripts/app/build'),
filename: '[name].bundle.js'
},
resolve: {
extensions: ['', '.js', '.dot']
},
'dust-loader-complete': {
wrapperGenerator: function (name) {return "function( context, callback ) { dust.render( '" + name + "', context, callback ); }";}
},
plugins: [
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.PrefetchPlugin('jquery'),
new webpack.PrefetchPlugin('lodash'),
new webpack.ProvidePlugin({
$: 'jquery',
jquery: 'jQuery',
'windows.jQuery': 'jquery',
_: 'lodash',
toastr: 'toastr',
}),
// new webpack.optimize.UglifyJsPlugin
],
debug: true,
eslint: {
formatter: require('eslint-friendly-formatter')
}
};
Gulp设置:
gulp.task('build-webpack', function (callback) {
webpack(webpackConfig, function(err, stats) {
if(err) throw new gutil.PluginError("webpack", err);
gutil.log("[webpack]", stats.toString({
// output options
}));
callback();
});
});
答案 0 :(得分:1)
事实证明这是由于我使用webpack-stream
的gulp配置。当Gulp失败时,gulp观察者忽略了流。我添加了Gulp-Plumber
以防止失败。