blob: f864c6b8c843340be1a2ede8e57508ff88416c5c [file] [log] [blame]
Steven Burrows1c2a9682017-07-14 16:52:46 +01001import gulp from 'gulp';
2import eslint from 'gulp-eslint';
3import gulpIf from 'gulp-if';
4import path from 'path';
5
6const files = [
7 '../../web/gui/src/main/webapp/app/**/*.js'
8];
9
10function isFixed(file) {
11 // Has ESLint fixed the file contents?
12 return file.eslint != null && file.eslint.fixed;
13}
14
15const lint = () => {
16 return gulp.src(files)
17 .pipe(eslint({
18 configFile: path.join(__dirname, 'esconfig.json'),
19 useEslintrc: false,
20 // Automatically fix trivial issues
21 // fix: true,
22 }))
23 .pipe(eslint.format())
24 .pipe(gulpIf(isFixed,
25 gulp.dest('../../web/gui/src/main/webapp/app')
26 ));
27};
28
29const tasks = () => {
30 gulp.task('lint', () => lint());
31};
32
33export default tasks();