Skip to content

Commit

Permalink
Adding Gulp, JShint and JSBeautifier
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Gilles committed Jul 14, 2015
1 parent bc32587 commit 9ca282e
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 1 deletion.
22 changes: 22 additions & 0 deletions .jsbeautifyrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"indent_size": 4,
"indent_char": " ",
"eol": "\n",
"indent_level": 0,
"indent_with_tabs": false,
"preserve_newlines": true,
"max_preserve_newlines": 10,
"jslint_happy": false,
"space_after_anon_function": false,
"brace_style": "collapse",
"keep_array_indentation": false,
"keep_function_indentation": false,
"space_before_conditional": true,
"break_chained_methods": false,
"eval_code": false,
"unescape_strings": false,
"wrap_line_length": 0,
"wrap_attributes": "auto",
"wrap_attributes_indent_size": 4,
"end_with_newline": false
}
25 changes: 25 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
var gulp = require('gulp');
var jshint = require('gulp-jshint');
var stylish = require('jshint-stylish');
var prettify = require('gulp-jsbeautifier');



/**
* Jshint
*/
gulp.task('jshint', function() {
return gulp.src(['./api/**/*.js', './assets/js/app/**/*.js', './test/**/*.js', '!./api/hooks'])
.pipe(jshint())
.pipe(jshint.reporter(stylish));
});


/**
* Beautify JS code
*/
gulp.task('format-js', function() {
gulp.src(['./api/**/*.js', '!./api/hooks' ])
.pipe(prettify({config: '.jsbeautifyrc', mode: 'VERIFY_AND_WRITE'}))
.pipe(gulp.dest('./api'));
});
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,11 @@
"url": "git://github.com/root/gladys.git"
},
"author": "Pierre-Gilles Leymarie",
"license": "Creative Commons 3.0 France"
"license": "Creative Commons 3.0 France",
"devDependencies": {
"gulp": "^3.9.0",
"gulp-jsbeautifier": "^1.0.1",
"gulp-jshint": "^1.11.2",
"jshint-stylish": "^2.0.1"
}
}

0 comments on commit 9ca282e

Please sign in to comment.