Add gulp task for JavaScript files linting

This commit is contained in:
Dmitriy Simushev 2016-05-30 13:15:50 +00:00
parent fcdc1021af
commit 2e629df611
3 changed files with 39 additions and 2 deletions

26
src/.eslintrc Normal file
View File

@ -0,0 +1,26 @@
{
"extends": "eslint:recommended",
"rules": {
"indent": ["error", 4, {"SwitchCase": 1}],
"no-trailing-spaces": "error",
"semi": ["error", "always"],
"guard-for-in": "error"
},
"globals": {
"Mibew": true,
"MibewAPI": true,
"MibewAPIInteraction": true,
"MibewAPIChatInteraction": true,
"MibewAPIUsersInteraction": true,
"MibewAPIExecutionContext": true,
"Handlebars": true,
"_": true,
"Backbone": true,
"jQuery": true,
"vex": true,
"validator": true
},
"env":{
"browser": true
}
}

View File

@ -24,7 +24,8 @@ var fs = require('fs'),
chmod = require('gulp-chmod'),
xgettext = require('gulp-xgettext'),
concatPo = require('gulp-concat-po'),
rename = require('gulp-rename');
rename = require('gulp-rename'),
eslint = require('gulp-eslint');
// Set global configs.
var config = {
@ -83,6 +84,14 @@ gulp.task('phpcs', ['composer-install-dev'], function() {
.pipe(phpcs.reporter('fail'));
});
// Checks all JavaScript Source files with ESLint.
gulp.task('eslint', function() {
return gulp.src(config.jsPath + '/source/**/*.js')
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
// Get and install PHP Composer
gulp.task('get-composer', function(callback) {
// Check if Composer already in place

View File

@ -23,6 +23,8 @@
"lodash": "~3.9.3",
"strftime": "~0.9.2",
"del": "~1.2.0",
"event-stream": "~3.3.1"
"event-stream": "~3.3.1",
"eslint": "~2.11.0",
"gulp-eslint": "~2.0.0"
}
}