Skip to content

Instantly share code, notes, and snippets.

@Jontyy
Last active December 17, 2015 21:49
Show Gist options
  • Save Jontyy/5677205 to your computer and use it in GitHub Desktop.
Save Jontyy/5677205 to your computer and use it in GitHub Desktop.
Grunt JSHint Options
module.exports = function(grunt) {
"use strict";
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.initConfig({
// JSHint Configuration
// http://www.jshint.com/docs/
//
// All of the options can be placed in a .jshintrc, update options : { jshintrc : ".jshintrc" }
// This has not been done as comments are not valid JSON
jshint: {
files: ['**/*.js'],
options: {
"ignores" : ["node_modules/**/*.js"],
"expr": true, //Allow timeout && clearTimeout(timeout) type code
"browser": true, //Predefine all browser globals
"strict": true, //Strict mode for function scope
"trailing": true, //Prevent trailing whitespace
"undef": true, //Prevent undefined variables
"curly": true, //Force curly braces
"eqeqeq": true, //Force strict comparisons
"immed": true, //Prevent function(){}() -> use (function(){}()) instead
"latedef": true, //Prevent a variable from being used before it is defined
"noarg": true, //Prevent deprecated JS arguments.caller and .calee
"noempty": true, //Prevent empty blocks in your code e.g. if(1 === 1){ /*nothing*/ }
"unused": true, //Prevent unused variables,
"indent": 4,
"predef": ["module", "define"]
}
}
});
grunt.registerTask('default', ['jshint']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment