'use strict';
var gulp = require('gulp');
var eslint = require('gulp-eslint');
var combiner = require('stream-combiner2');
var filterResults = require('./result-filter');
/**
* @module tasks/eslint/details
*/
/**
* taskFactory
* @param src {Array}
* @param bail {Boolean}
* @returns task {Function}
*/
module.exports = function taskFactory (src, bail) {
return function task () {
var tasks = combiner.obj([
gulp.src(src),
eslint(),
filterResults(),
eslint.format(),
bail ? eslint.failOnError() : eslint.failAfterError()
]);
tasks.on('error', function () {
process.exit(1);
});
return tasks;
};
};