import jshint  from 'gulp-jshint';
import stylish from 'jshint-stylish';
import _isUndefined from 'lodash/lang/isUndefined';

class JshintTask {
	setOptions(options) {
		this.options = options;

		if (_isUndefined(this.options.src)) {
			throw new Error('JshintTask: src is missing from configuration!');
		}

		return this;
	}

	defineTask(gulp) {
		let options = this.options;
		gulp.task(options.taskName, options.taskDeps, () => {
			return gulp.src(options.src)
				.pipe(jshint())
				.pipe(jshint.reporter(stylish))
		});
	}
}

module.exports = JshintTask;

import jshint  from 'gulp-jshint';
import stylish from 'jshint-stylish';
import _isUndefined from 'lodash/lang/isUndefined';

class JshintTask {
	setOptions(options) {
		this.options = options;

		if (_isUndefined(this.options.src)) {
			throw new Error('JshintTask: src is missing from configuration!');
		}

		return this;
	}

	defineTask(gulp) {
		let options = this.options;
		gulp.task(options.taskName, options.taskDeps, () => {
			return gulp.src(options.src)
				.pipe(jshint(options.jsHintOptions))
				.pipe(jshint.reporter(stylish))
		});
	}
}

module.exports = JshintTask;

add jsHintOptions parameter to enable passing of lint options according to JSHint at http://jshint.com/docs/options/