Merge pull request #241 from ripple/add-jshintrc

Add jshintrc
This commit is contained in:
wltsmrz
2014-12-23 23:08:52 -08:00
2 changed files with 43 additions and 17 deletions

View File

@@ -151,26 +151,30 @@ gulp.task('bower', ['bower-build', 'bower-build-min', 'bower-build-debug', 'bowe
gulp.task('lint', function() {
gulp.src('src/js/ripple/*.js')
.pipe(jshint())
.pipe(jshint('./jshintrc'))
.pipe(map(function(file, callback) {
if (!file.jshint.success) {
console.log('\nIn', file.path);
file.jshint.results.forEach(function(err) {
if (err && err.error) {
var col1 = err.error.line + ':' + err.error.character;
var col2 = '[' + err.error.reason + ']';
var col3 = '(' + err.error.code + ')';
while (col1.length < 8) {
col1 += ' ';
}
console.log(' ' + [ col1, col2, col3 ].join(' '));
}
});
if (file.jshint.success) {
return callback(null, file);
}
console.log('\n>' + file.path.substring(file.base.length) + '\n');
file.jshint.results.forEach(function(err) {
if (err && err.error) {
var col1 = err.error.line + ':' + err.error.character;
var col2 = err.error.reason;
var col3 = '(' + err.error.code + ')';
while (col1.length < 8) {
col1 = ' ' + col1;
}
col1 += ' |';
console.log([ col1, col2, col3 ].join(' '));
}
});
callback(null, file);
}));
});

22
jshintrc Normal file
View File

@@ -0,0 +1,22 @@
{
"browser": true,
"jquery": true,
"node": true,
"camelcase": false,
"eqeqeq": true,
"eqnull": true,
"latedef": true,
"newcap": true,
"quotmark": "single",
"undef": true,
"unused": true,
"curly": true,
"freeze": true,
"nonbsp": true,
"boss": true,
"laxbreak": true,
"maxparams": 4,
"maxdepth": 3,
"esnext": true,
"-W004": true
}