blob: f864c6b8c843340be1a2ede8e57508ff88416c5c [file] [log] [blame]
import gulp from 'gulp';
import eslint from 'gulp-eslint';
import gulpIf from 'gulp-if';
import path from 'path';
const files = [
'../../web/gui/src/main/webapp/app/**/*.js'
];
function isFixed(file) {
// Has ESLint fixed the file contents?
return file.eslint != null && file.eslint.fixed;
}
const lint = () => {
return gulp.src(files)
.pipe(eslint({
configFile: path.join(__dirname, 'esconfig.json'),
useEslintrc: false,
// Automatically fix trivial issues
// fix: true,
}))
.pipe(eslint.format())
.pipe(gulpIf(isFixed,
gulp.dest('../../web/gui/src/main/webapp/app')
));
};
const tasks = () => {
gulp.task('lint', () => lint());
};
export default tasks();