Skip to content

Commit

Permalink
Got lint working with Grunt
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesshore committed Sep 24, 2013
1 parent 79de39d commit 6d7d503
Showing 1 changed file with 50 additions and 6 deletions.
56 changes: 50 additions & 6 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
"use strict";

module.exports = function(grunt) {

// Project configuration.
grunt.initConfig({
jshint: {
browser: "src/client/**/*.js"
}
// Project configuration.
grunt.initConfig({
jshint: {
browser: {
options: browserLintOptions(),
files: {
src: "src/client/**/*.js"
}
},
node: {
options: nodeLintOptions(),
files: {
src: ["src/*.js", "src/server/**/*.js", "build/util/**/*.js", "Gruntfile.js"]
}
}
}


// pkg: grunt.file.readJSON('package.json'),
Expand All @@ -17,7 +30,7 @@ module.exports = function(grunt) {
// dest: 'build/<%= pkg.name %>.min.js'
// }
// }
});
});

// // Load the plugin that provides the "uglify" task.
// grunt.loadNpmTasks('grunt-contrib-uglify');
Expand All @@ -31,4 +44,35 @@ module.exports = function(grunt) {
console.log("\n\nOK");
});

function globalLintOptions() {
return {
bitwise: true,
curly: false,
eqeqeq: true,
forin: true,
immed: true,
latedef: false,
newcap: true,
noarg: true,
noempty: true,
nonew: true,
regexp: true,
undef: true,
strict: true,
trailing: true
};
}

function nodeLintOptions() {
var options = globalLintOptions();
options.node = true;
return options;
}

function browserLintOptions() {
var options = globalLintOptions();
options.browser = true;
return options;
}

};

0 comments on commit 6d7d503

Please sign in to comment.