Skip to content

Instantly share code, notes, and snippets.

@kara-ryli
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kara-ryli/9444195 to your computer and use it in GitHub Desktop.
Save kara-ryli/9444195 to your computer and use it in GitHub Desktop.
grunt-contrib-jshint requires *either* a jshintrc file or other options. I reject that dichotomy.
'use strict';
module.exports = function (grunt) {
var jshintrc = grunt.file.readJSON('.jshintrc');
// super simple shallow copy/merge
function merge(o1, o2) {
var retVal = {}, i;
for (i in o1) {
retVal[i] = o1[i];
}
for (i in o2) {
retVal[i] = o2[i];
}
return retVal;
}
// load grunt tasks
grunt.loadNpmTask('grunt-contrib-jshint');
// Project configuration.
grunt.initConfig({
jshint: {
client: {
src: ['public/js/**/*.js'],
options: merge(jshintrc, {
browser: true,
globals: {
jQuery: false
}
})
},
server: {
src: ['Gruntfile.js', 'lib/**/*.js'],
options: merge(jshintrc, {
node: true
})
},
},
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment