add eslint tasks to gulp, remove .jshintrc

This commit is contained in:
Matteo Pagliazzi
2015-09-25 15:44:45 +02:00
parent b27a12b54d
commit 5ac46716a3
3 changed files with 46 additions and 15 deletions

View File

@@ -1,15 +0,0 @@
{
"globals": {
"confirm": false
},
"browser": true,
"node": true,
"mocha": true,
"esnext": true,
"asi": true,
"boss": true,
"newcap": false
}

View File

@@ -34,6 +34,7 @@
"grunt-karma": "~0.6.2", "grunt-karma": "~0.6.2",
"gulp": "^3.9.0", "gulp": "^3.9.0",
"gulp-clean": "^0.3.1", "gulp-clean": "^0.3.1",
"gulp-eslint": "^1.0.0",
"gulp-grunt": "^0.5.2", "gulp-grunt": "^0.5.2",
"gulp-imagemin": "^2.3.0", "gulp-imagemin": "^2.3.0",
"gulp-nodemon": "^2.0.4", "gulp-nodemon": "^2.0.4",

45
tasks/gulp-eslint.js Normal file
View File

@@ -0,0 +1,45 @@
import gulp from 'gulp';
import eslint from 'gulp-eslint';
import _ from 'lodash';
// TODO remove once we upgrade to lodash 3
const defaultsDeep = _.partialRight(_.merge, _.defaults);
const shared = {
rules: {
indent: [2, 2],
quotes: [2, 'single'],
'linebreak-style': [2, 'unix'],
semi: [2, 'always']
},
extends: 'eslint:recommended',
env: {
es6: true
}
};
gulp.task('lint:client', () => {
// Ignore .coffee files
return gulp.src(['./website/public/js/**/*.js'])
.pipe(eslint(defaultsDeep({
env: {
node: true
}
}, shared)))
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
gulp.task('lint:server', () => {
// Ignore .coffee files
return gulp.src(['./website/src/**/*.js'])
.pipe(eslint(defaultsDeep({
env: {
browser: true
}
}, shared)))
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
gulp.task('lint', ['lint:server', 'lint:client']);