Created
September 10, 2015 15:33
-
-
Save ScheerMT/fa6e2f845c67ded9292f to your computer and use it in GitHub Desktop.
JSHint configuration as of v2.8.0 - Strict Settings with some exceptions made. Settings marked as depreciated were *not* included in order to futureproof for newer versions.
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
{ | |
// -------------------------------------------------------------------- | |
// JSHint Configuration, Strict Edition | |
// -------------------------------------------------------------------- | |
// | |
// This is a options template for JSHint[1], using JSHint example[2], | |
// Ory Band's example[3], and haschek's example[4] as basis and 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 | |
// | |
// [1]: http://www.jshint.com/ | |
// [2]: https://github.com/jshint/jshint/blob/master/examples/.jshintrc | |
// [3]: https://github.com/oryband/dotfiles/blob/master/.jshintrc | |
// | |
// @author http://michael.haschke.biz/ | |
// @author Michael Scheer <[email protected]> | |
// @license http://unlicense.org/ | |
// | |
// | |
// ******************* | |
// NOTE: Modifications have been made to the original script found at: | |
// https://gist.github.com/haschek/2595796 | |
// These modifications remove depreciated options and adding new | |
// ones as of v2.8.0 | |
// ******************* | |
// | |
// | |
// == 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. `===`. | |
"es3" : false, // adhere to ECMAScript 3 specification -- Unneeded now and conflicts with promises | |
"es5" : true, // enables syntax first defined in the ECMAScript 5.1 specification. | |
"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. | |
"globals" : true, // | |
"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 | |
// == 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. | |
"eqnull" : false, // Tolerate use of `== null`. | |
"es5" : false, // Allow EcmaScript 5 syntax. | |
"esnext" : true, // Allow ES.next specific features such as `const` and `let`. | |
"evil" : false, // Tolerate use of `eval`. | |
"expr" : false, // Tolerate `ExpressionStatement` as Programs. | |
"funcscope" : false, // Tolerate declarations of variables inside of control structures while accessing them later from the outside. | |
"globalstrict" : false, // Allow global "use strict" (also enables 'strict'). | |
"iterator" : false, // Allow usage of __iterator__ property. | |
"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. | |
"onecase" : false, // Tolerate switches with just one case. | |
"proto" : false, // Tolerate __proto__ property. This property is deprecated. | |
"regexdash" : false, // Tolerate unescaped last dash i.e. `[-...]`. | |
"scripturl" : false, // Tolerate script-targeted URLs. | |
"smarttabs" : false, // Tolerate mixed tabs and spaces when the latter are used for alignmnent only. | |
"shadow" : false, // Allows re-define variables later in code e.g. `var x=1; x=2;`. | |
"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. | |
// == Environments ==================================================== | |
// | |
// These options pre-define global variables that are exposed by | |
// popular JavaScript libraries and runtime environments—such as | |
// browser or node.js. | |
// ==================================================================== | |
"mocha" : true, // Mocha testing suite | |
"browser" : true, // Standard browser globals e.g. `window`, `document`. | |
"couch" : false, // Enable globals exposed by CouchDB. | |
"devel" : false, // Allow development statements e.g. `console.log();`. | |
"dojo" : false, // Enable globals exposed by Dojo Toolkit. | |
"jquery" : false, // Enable globals exposed by jQuery JavaScript library. | |
"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. | |
"prototypejs" : false, // Enable globals exposed by Prototype JavaScript framework. | |
"rhino" : false, // Enable globals available when your code is running inside of the Rhino runtime environment. | |
"wsh" : false, // Enable globals available when your code is running as a script for the Windows Script Host. | |
// == Undocumented Options ============================================ | |
// | |
// While I've found these options in [example1][2] and [example2][3] | |
// they are not described in the [JSHint Options documentation][4]. | |
// | |
// [4]: http://www.jshint.com/options/ | |
// ==================================================================== | |
"predef" : [ // Extra globals. | |
//"exampleVar", | |
//"anotherCoolGlobal", | |
//"iLoveDouglas" | |
], | |
"indent" : 4 // Specify indentation spacing | |
} |
This config defines "es5" to be both true and false, and duplicates "funcscope", "iterator", and "shadow".
I have the exact same error and I can't figure out why.
{ [Error: Error when reading .jshint config:
SyntaxError: Unexpected token /]
message: 'Error when reading .jshint config:\nSyntaxError: Unexpected token /',
showStack: false,
showProperties: true,
plugin: 'gulp-fixmyjs',
__safety: { toString: [Function: bound ] } }
I don't have a config file, I didn't have one before and it was working fine. I don't know where to look to solve this. Error doesn't really show up on google except for here.
This file is JSON, which doesn't support comments. The error is because of the first /
in the file, which is an illegal token.
Try the less informative but de-commented and de-duped, no-deprecated-options for 2.9 => https://gist.github.com/michaelsanford/57d1c624cf7414ebf1a61eb1074bd474
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Any idea?