From 558cc92dd6b78d52645ed740c3ea1fad1d085e1c Mon Sep 17 00:00:00 2001 From: Josh Ponelat Date: Wed, 29 Apr 2015 11:29:19 +0200 Subject: [PATCH] add jshint to gulp..lint and dist --- gulpfile.js | 12 +++++++++++- package.json | 12 ++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 11886f57..f6c14df4 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -15,6 +15,7 @@ var connect = require('gulp-connect'); var header = require('gulp-header'); var pkg = require('./package.json'); var order = require('gulp-order'); +var jshint = require('gulp-jshint'); var banner = ['/**', ' * <%= pkg.name %> - <%= pkg.description %>', ' * @version v<%= pkg.version %>', @@ -48,10 +49,19 @@ function templates() { .on('error', log); } +/** + * JShint all *.js files + */ +gulp.task('lint', function () { + return gulp.src('./src/main/javascript/**/*.js') + .pipe(jshint()) + .pipe(jshint.reporter('jshint-stylish')); +}); + /** * Build a distribution */ -gulp.task('dist', ['clean'], function() { +gulp.task('dist', ['clean','lint'], function() { return es.merge( gulp.src([ diff --git a/package.json b/package.json index 9c99f3e2..6c825f68 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,12 @@ { "name": "swagger-ui", "author": "Tony Tam ", - "contributors": [{ - "name": "Mohsen Azimi", - "email": "me@azimi.me" - }], + "contributors": [ + { + "name": "Mohsen Azimi", + "email": "me@azimi.me" + } + ], "description": "Swagger UI is a dependency-free collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API", "version": "2.1.2-M2", "homepage": "http://swagger.io", @@ -35,6 +37,7 @@ "gulp-declare": "^0.3.0", "gulp-handlebars": "^3.0.1", "gulp-header": "^1.2.2", + "gulp-jshint": "^1.10.0", "gulp-less": "^3.0.1", "gulp-order": "^1.1.1", "gulp-rename": "^1.2.0", @@ -42,6 +45,7 @@ "gulp-watch": "^4.1.1", "gulp-wrap": "^0.11.0", "http-server": "git+https://github.com/nodeapps/http-server.git", + "jshint-stylish": "^1.0.1", "less": "^2.4.0", "mocha": "^2.1.0", "selenium-webdriver": "^2.45.0",