diff --git a/.jshintrc b/.jshintrc index 7083b1ad46..96b507fb98 100644 --- a/.jshintrc +++ b/.jshintrc @@ -1,5 +1,10 @@ { - "node": true, - "browser": true, - "undef": true + "node": true, + "browser": true, + "indent": 4, + "trailing": true, + "eqeqeq": true, + "undef": true, + "nomen": true, + "white": true } \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js index c194f452e3..a1affdd06d 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,47 +1,47 @@ -var configureGrunt = function(grunt) { +var configureGrunt = function (grunt) { - var cfg = { - // JSHint all the things! - jshint2: { - options: { - jshintrc: ".jshintrc" - }, - all: [ - // Lint files in the root, including Gruntfile.js - "*.js", - // Lint core files, but not libs - ["core/**/*.js", "!**/assets/lib/**/*.js"] - ] - }, + var cfg = { + // JSHint all the things! + jshint2: { + options: { + jshintrc: ".jshintrc" + }, + all: [ + // Lint files in the root, including Gruntfile.js + "*.js", + // Lint core files, but not libs + ["core/**/*.js", "!**/assets/lib/**/*.js"] + ] + }, - // Unit test all the things! - nodeunit: { - all: ['core/test/ghost/**/test-*.js'] - }, + // Unit test all the things! + nodeunit: { + all: ['core/test/ghost/**/test-*.js'] + }, - // Compile all the SASS! - compass: { - options: { - config: "config.rb" - }, - // No need for config, but separated for future options - admin: {} - } - }; + // Compile all the SASS! + compass: { + options: { + config: "config.rb" + }, + // No need for config, but separated for future options + admin: {} + } + }; - grunt.initConfig(cfg); + grunt.initConfig(cfg); - grunt.loadNpmTasks("grunt-jshint2"); - grunt.loadNpmTasks("grunt-contrib-nodeunit"); - grunt.loadNpmTasks("grunt-contrib-compass"); + grunt.loadNpmTasks("grunt-jshint2"); + grunt.loadNpmTasks("grunt-contrib-nodeunit"); + grunt.loadNpmTasks("grunt-contrib-compass"); - // Prepare the project for development - // TODO: Git submodule init/update (https://github.com/jaubourg/grunt-update-submodules)? - grunt.registerTask("init", ["compass:admin"]); + // Prepare the project for development + // TODO: Git submodule init/update (https://github.com/jaubourg/grunt-update-submodules)? + grunt.registerTask("init", ["compass:admin"]); - // Run tests and lint code - grunt.registerTask("validate", ["jshint2:all", "nodeunit:all"]); + // Run tests and lint code + grunt.registerTask("validate", ["jshint2:all", "nodeunit:all"]); }; module.exports = configureGrunt; \ No newline at end of file diff --git a/core/admin/assets/js/settings.js b/core/admin/assets/js/settings.js index 8f458d93e4..014cefb87a 100644 --- a/core/admin/assets/js/settings.js +++ b/core/admin/assets/js/settings.js @@ -14,7 +14,7 @@ }; - $(document).ready(function() { + $(document).ready(function () { $('.settings-menu li').on('click', changePage); }); diff --git a/core/admin/assets/js/tagui.js b/core/admin/assets/js/tagui.js index fa3e3ca867..51a933141d 100644 --- a/core/admin/assets/js/tagui.js +++ b/core/admin/assets/js/tagui.js @@ -99,7 +99,7 @@ } } else if (e.keyCode === keys.ESC) { suggestions.hide(); - } else if ((e.keyCode === keys.ENTER || e.keyCode === keys.COMMA)&& searchTerm) { + } else if ((e.keyCode === keys.ENTER || e.keyCode === keys.COMMA) && searchTerm) { // Submit tag using enter or comma key e.preventDefault(); if (suggestions.is(":visible") && suggestions.children(".selected").length !== 0) { diff --git a/core/shared/models/dataProvider.juggling.js b/core/shared/models/dataProvider.juggling.js index e5a147c5da..318ce90a3b 100644 --- a/core/shared/models/dataProvider.juggling.js +++ b/core/shared/models/dataProvider.juggling.js @@ -40,8 +40,8 @@ var posts = JSON.parse(data), post; - _.each(posts, function (_post) { - post = new schema.models.Post(_post); + _.each(posts, function (postData) { + post = new schema.models.Post(postData); post.preCreate(function () { post.save(function (error, data) { @@ -112,8 +112,8 @@ * @param post * @param callback */ - DataProvider.prototype.posts.add = function (_post, callback) { - var post = new schema.models.Post(_post); + DataProvider.prototype.posts.add = function (postData, callback) { + var post = new schema.models.Post(postData); post.preCreate(function () { post.save(callback); @@ -125,9 +125,9 @@ * @param post * @param callback */ - DataProvider.prototype.posts.edit = function (_post, callback) { - schema.models.Post.findOne({where: {id: _post.id}}, function (error, post) { - post = _.extend(post, _post); + DataProvider.prototype.posts.edit = function (postData, callback) { + schema.models.Post.findOne({where: {id: postData.id}}, function (error, post) { + post = _.extend(post, postData); schema.models.Post.updateOrCreate(post, callback); });