diff --git a/.jshintrc b/.jshintrc index 427199e4ea..15b532fb14 100644 --- a/.jshintrc +++ b/.jshintrc @@ -1,6 +1,9 @@ { - "-W103": true, + "proto": true, "eqnull": true, "expr": true, - "indent": 2 + "indent": 2, + "node": true, + "trailing": true, + "quotmark": "single" } \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index 428e687f29..54577dd5b3 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,6 +1,5 @@ var gulp = require('gulp'), - jshint = require('gulp-jshint'), - mocha = require('gulp-mocha'), + $ = require('gulp-load-plugins')(), path = require('path'); var lib = 'lib/**/*.js', @@ -8,7 +7,7 @@ var lib = 'lib/**/*.js', gulp.task('mocha', function(){ return gulp.src('test/index.js') - .pipe(mocha({ + .pipe($.mocha({ reporter: 'spec', ignoreLeaks: true })); @@ -16,9 +15,9 @@ gulp.task('mocha', function(){ gulp.task('jshint', function(){ return gulp.src(lib) - .pipe(jshint()) - .pipe(jshint.reporter('jshint-stylish')) - .pipe(jshint.reporter('fail')); + .pipe($.jshint()) + .pipe($.jshint.reporter('jshint-stylish')) + .pipe($.jshint.reporter('fail')); }); gulp.task('watch', function(){ diff --git a/lib/plugins/helper/open_graph.js b/lib/plugins/helper/open_graph.js index 58398beba6..e1d3db9ecb 100644 --- a/lib/plugins/helper/open_graph.js +++ b/lib/plugins/helper/open_graph.js @@ -42,7 +42,7 @@ module.exports = function(options){ description = description.substring(0, 200).replace(/^\s+|\s+$/g, '') .replace(/\"/g, '\'') - .replace(/\>/g, "&"); + .replace(/\>/g, '&'); if (!images.length && content){ var $ = cheerio.load(content); diff --git a/lib/util/escape.js b/lib/util/escape.js index b3b9360bb2..96ee987dc4 100644 --- a/lib/util/escape.js +++ b/lib/util/escape.js @@ -91,7 +91,7 @@ exports.yaml = require('hexo-front-matter').escape; */ exports.regex = function(str){ // http://stackoverflow.com/a/6969486 - return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); + return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&'); }; var defaultDiacriticsRemovalap = [ diff --git a/lib/util/file.js b/lib/util/file.js index dfc04fbcf2..2a869cc40c 100644 --- a/lib/util/file.js +++ b/lib/util/file.js @@ -57,9 +57,9 @@ var mkdir = exports.mkdir = function(destination, callback){ */ var writeFile = function(destination, content, callback) { - fs.open(destination, "w", function(err, fd) { + fs.open(destination, 'w', function(err, fd) { if (err) callback(err); - fs.write(fd, content, 0, "utf8", function(err, written, buffer) { + fs.write(fd, content, 0, 'utf8', function(err, written, buffer) { callback(err); }); }); diff --git a/package.json b/package.json index 6028c58dd5..c88a8ea1b9 100644 --- a/package.json +++ b/package.json @@ -56,11 +56,12 @@ "warehouse": "0.2.2" }, "devDependencies": { - "mocha": "^1.20.1", "chai": "^1.9.1", "gulp": "^3.6.2", "gulp-jshint": "^1.5.5", + "gulp-load-plugins": "^0.7.0", "gulp-mocha": "^0.5.1", - "jshint-stylish": "^0.4.0" + "jshint-stylish": "^0.4.0", + "mocha": "^1.20.1" } }