Make stricter jshint rules, convert tabs to spaces

This commit is contained in:
Jacob Gable 2013-05-13 14:18:20 -05:00
parent 99c13c02c0
commit 6da08eaf3c
5 changed files with 53 additions and 48 deletions

View File

@ -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
}

View File

@ -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;

View File

@ -14,7 +14,7 @@
};
$(document).ready(function() {
$(document).ready(function () {
$('.settings-menu li').on('click', changePage);
});

View File

@ -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) {

View File

@ -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);
});