Last active
August 29, 2015 13:57
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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