Skip to content

Instantly share code, notes, and snippets.

@danwellman
Forked from ScheerMT/.jshintrc
Last active March 5, 2018 13:51
Show Gist options
  • Save danwellman/ad3e89c645771e49f9fd452e229a133d to your computer and use it in GitHub Desktop.
Save danwellman/ad3e89c645771e49f9fd452e229a133d to your computer and use it in GitHub Desktop.
JSHint configuration as of v2.9.3 - Strict Settings with some exceptions made. Settings marked as deprecated were *not* included in order to futureproof for newer versions.
{
// --------------------------------------------------------------------
// JSHint Configuration, Strict Edition
// --------------------------------------------------------------------
//
// This is a options template for JSHint[1] setting
// config values to be most strict:
//
// * set all enforcing options to true
// * set all relaxing options to false
// * set all environment options to false, except the browser value
// * set all JSLint legacy options to false
//
// NOTE: Certain exceptions were made for my own use. Understand what each
// deviation from what is described just above means for your project
//
// @author Dan Wellman <[email protected]>
// @license http://unlicense.org/
//
//
// *******************
// NOTE: Modifications have been made to the original script found at:
// https://gist.github.com/ScheerMT/fa6e2f845c67ded9292f
// These modifications remove deprecated options and add new
// ones as of v2.9.3
// *******************
//
//
// == Enforcing Options ===============================================
//
// These options tell JSHint to be more strict towards your code. Use
// them if you want to allow only a safe subset of JavaScript, very
// useful when your codebase is shared with a big number of developers
// with different skill levels.
"bitwise" : true, // Prohibit bitwise operators (&, |, ^, etc.).
"curly" : true, // Require { for every new block or scope.
"eqeqeq" : true, // Require triple equals i.e. `===`.
"esversion" : 6, // Specify the ECMAScript version to which the code must adhere.
"forin" : true, // Tolerate `for in` loops without `hasOwnPrototype`.
"freeze" : true, // Prohibits overwriting prototypes of native objects such as Array, Date and so on.
"funcscope" : false, // This option suppresses warnings about declaring variables inside of control structures while accessing them later from the outside.
"futurehostile" : true, // This option enables warnings about the use of identifiers which are defined in future versions of JavaScript.
"iterator" : false, // This option suppresses warnings about the __iterator__ property. This property is not supported by all browsers so use it carefully.
"latedef" : true, // Prohibit variable use before definition.
"maxcomplexity" : 10, // Lets you control cyclomatic complexity throughout your code
"maxdepth" : 5, // Lets you control how nested do you want your blocks to be
"maxerr" : 20, // Set the maximum amount of warnings JSHint will produce before giving up. Default is 50.
"maxparams" : 4, // Set the max number of formal parameters allowed per function
"maxstatements" : 50, // Set the max number of statements allowed per function:
"noarg" : true, // Prohibit use of `arguments.caller` and `arguments.callee`.
"nocomma" : true, // Prohibits the use of the comma operator.
"nonbsp" : true, // Warns about "non-breaking whitespace" characters.
"nonew" : true, // Prohibit use of constructors for side-effects.
"notypeof" : false, // suppresses warnings about invalid typeof operator values.
"shadow" : false, // suppresses warnings about variable shadowing
"singleGroups" : true, // This option prohibits the use of the grouping operator when it is not strictly required.
"strict" : true, // Require `use strict` pragma in every file.
"undef" : true, // Prohibits the use of explicitly undeclared variables.
"unused" : true, // warns when you define and never use your variables.
"varstmt" : false, // the use of VariableStatements are forbidden
"globals" : { // Specify a white list of global variables that are not formally defined in the source code.
//"example": true, - enable reading and writing to the "example" variable.
//"other": false - trigger JSHint to consider "other" variable as read-only.
},
"predef" : [ // Control which variables JSHint considers to be implicitly defined in the environment.
//"exampleVar",
//"anotherCoolGlobal",
//"iLoveDouglas"
],
// == Relaxing Options ================================================
//
// These options allow you to suppress certain types of warnings. Use
// them only if you are absolutely positive that you know what you are
// doing.
// ====================================================================
"asi" : false, // Tolerate Automatic Semicolon Insertion (no semicolons).
"boss" : false, // Tolerate assignments inside if, for & while. Usually conditions & loops are for comparison, not assignments.
"debug" : false, // Allow debugger statements e.g. browser breakpoints.
"elision" : false, // Tolerate use of ES3 array elision elements (for example, [1, , , 4, , , 7]).
"eqnull" : false, // Tolerate use of `== null`.
"evil" : false, // Tolerate use of `eval`.
"expr" : false, // Tolerate `ExpressionStatement` as Programs.
"lastsemic" : false, // Tolerat missing semicolons when the it is omitted for the last statement in a one-line block.
"loopfunc" : false, // Allow functions to be defined within loops.
"moz" : false, // This options tells JSHint that your code uses Mozilla JavaScript extensions. Unless you develop specifically for the Firefox web browser you don't need this option.
"noyield" : false, // Tolerate generator functions with no yield statement in them.
"plusplus" : true, // Prohibit the use of unary increment and decrement operators.
"proto" : false, // Tolerate __proto__ property. This property is deprecated.
"scripturl" : false, // Tolerate script-targeted URLs.
"supernew" : false, // Tolerate `new function () { ... ;` and `new Object;`.
"validthis" : false, // Tolerate strict violations when the code is running in strict mode and you use this in a non-constructor function.
"withstmt" : true, // suppresses warnings about the use of the with statement.
// == Environments ====================================================
//
// These options pre-define global variables that are exposed by
// popular JavaScript libraries and runtime environments
// ====================================================================
"browser" : true, // Standard browser globals e.g. `window`, `document`.
"browserify" : false, // Enable globals available when using the Browserify tool.
"couch" : false, // Enable globals exposed by CouchDB.
"devel" : false, // Allow development statements e.g. `console.log();`.
"dojo" : false, // Enable globals exposed by Dojo Toolkit.
"jasmine" : false, // Enable globals exposed by the Jasmine unit testing framework.
"jquery" : false, // Enable globals exposed by jQuery JavaScript library.
"mocha" : true, // Mocha testing suite.
"module" : false, // Informs JSHint that the input code describes an ECMAScript 6 module.
"mootools" : false, // Enable globals exposed by MooTools JavaScript framework.
"node" : true, // Enable globals available when code is running inside of the NodeJS runtime environment.
"nonstandard" : false, // Define non-standard but widely adopted globals such as escape and unescape.
"phantom" : false, // Enable globals available when your core is running inside of the PhantomJS runtime environment.
"prototypejs" : false, // Enable globals exposed by Prototype JavaScript framework.
"qunit" : false, // Enable globals exposed by the QUnit unit testing framework.
"rhino" : false, // Enable globals available when your code is running inside of the Rhino runtime environment.
"shelljs" : false, // Enable globals exposed by the ShellJS library.
"typed" : false, // Enable globals for typed array constructors.
"worker" : false, // Enable globals available when your code is running inside of a Web Worker.
"wsh" : false, // Enable globals available when your code is running as a script for the Windows Script Host.
"yui" : false, // Enable globals exposed by the YUI JavaScript framework.
// == Undocumented Options ============================================
//
// While I've found these options in examples,
// they are not described in the [JSHint Options documentation][1].
//
// [1]: http://www.jshint.com/options/
// ====================================================================
"indent" : 4, // Specify indentation spacing.
"onecase" : false // Tolerate switches with just one case.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment