Skip to content

Commit

Permalink
feat(jshint): major jshint improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
meriadec committed Mar 5, 2015
1 parent 5851115 commit 70cc34c
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 29 deletions.
22 changes: 1 addition & 21 deletions app/templates/.jshintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{

"bitwise": true,
"camelcase": true,
"curly": true,
Expand All @@ -18,25 +17,6 @@
"unused": true,
"strict": true,
"maxdepth": 3,
"maxlen": 80,

"globalstrict": true,
"laxcomma": true,

"browser": true,
"node": true,

"globals": {
"console": true,
"process": true,
"angular": true,
"it": true,
"describe": true,
"inject": true,
"expect": true,
"afterEach": true,
"alert": true,
"beforeEach": true<% if (filters.sockets) { %>,
"io" : true<% } %>
}
"laxcomma": true
}
19 changes: 19 additions & 0 deletions app/templates/client/.jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"browser": true,
"globals": {
"angular": true,
"browser": true,
"element": true,
"by": true,
"module": true,
"console": true,
"it": true,
"describe": true,
"inject": true,
"expect": true,
"alert": true,
"afterEach": true,
"beforeEach": true<% if (filters.sockets) { %>,
"io" : true<% } %>
}
}
36 changes: 28 additions & 8 deletions app/templates/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ var bowerFiles = require('main-bower-files');
var runSequence = require('run-sequence');
var sq = require('streamqueue');
var path = require('path');
var async = require('async');
var _ = require('lodash');
var fs = require('fs');
var karma = require('karma').server;
var $ = require('gulp-load-plugins')();
Expand Down Expand Up @@ -128,14 +130,32 @@ gulp.task('watch', ['inject'], function () {
/**
* Control things
*/
gulp.task('control', function () {
return gulp.src([
'client/**/**/*.js',
'server/**/**/*.js',
'!client/bower_components/**'
])
.pipe($.jshint())
.pipe($.jshint.reporter('default'));
gulp.task('control', function (done) {

function getConfig (file) {
return _.merge(
JSON.parse(fs.readFileSync('./.jshintrc', 'utf-8')),
JSON.parse(fs.readFileSync(file, 'utf-8'))
);
}

function control (paths, conf) {
return function (done) {
gulp.src(paths)
.pipe($.jshint(conf))
.pipe($.jshint.reporter('jshint-stylish'))
.on('finish', done);
};
}

var srvConf = getConfig('./server/.jshintrc'),
cliConf = getConfig('./client/.jshintrc');

async.series([
control(['client/**/*.js', '!client/bower_components/**'], cliConf),
control(['server/**/*.js'], srvConf)
], done);

});


Expand Down
2 changes: 2 additions & 0 deletions app/templates/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"gulp-util": "^3.0.2",
"gulp-wait": "^0.0.2",
"gulp-watch": "^4.1.0",
"jshint-stylish": "^1.0.1",
"karma": "^0.12.31",
"karma-jasmine": "^0.3.5",
"karma-ng-html2js-preprocessor": "^0.1.2",
Expand All @@ -37,6 +38,7 @@
"streamqueue": "^0.1.2"
},
"dependencies": {
"async": "^0.9.0",
"body-parser": "^1.11.0",
"chalk": "^1.0.0",<% if (filters.auth) { %>
"composable-middleware": "^0.3.0",<% } %>
Expand Down
9 changes: 9 additions & 0 deletions app/templates/server/.jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"node": true,
"globals": {
"describe": true,
"it": true,
"afterEach": true,
"beforeEach": true
}
}

0 comments on commit 70cc34c

Please sign in to comment.