| 1 |
{ |
| 2 |
// -------------------------------------------------------------------- |
| 3 |
// JSHint Configuration, Strict Edition |
| 4 |
// -------------------------------------------------------------------- |
| 5 |
// |
| 6 |
// This is a options template for [JSHint][1], using [JSHint example][2] |
| 7 |
// and [Ory Band's example][3] as basis and setting config values to |
| 8 |
// be most strict: |
| 9 |
// |
| 10 |
// * set all enforcing options to true |
| 11 |
// * set all relaxing options to false |
| 12 |
// * set all environment options to false, except the browser value |
| 13 |
// * set all JSLint legacy options to false |
| 14 |
// |
| 15 |
// [1]: http://www.jshint.com/ |
| 16 |
// [2]: https://github.com/jshint/node-jshint/blob/master/example/config.json |
| 17 |
// [3]: https://github.com/oryband/dotfiles/blob/master/jshintrc |
| 18 |
// |
| 19 |
// @author http://michael.haschke.biz/ |
| 20 |
// @license http://unlicense.org/ |
| 21 |
|
| 22 |
// == Enforcing Options =============================================== |
| 23 |
// |
| 24 |
// These options tell JSHint to be more strict towards your code. Use |
| 25 |
// them if you want to allow only a safe subset of JavaScript, very |
| 26 |
// useful when your codebase is shared with a big number of developers |
| 27 |
// with different skill levels. |
| 28 |
|
| 29 |
"bitwise" : true, // Prohibit bitwise operators (&, |, ^, etc.). |
| 30 |
"curly" : true, // Require {} for every new block or scope. |
| 31 |
"eqeqeq" : true, // Require triple equals i.e. `===`. |
| 32 |
"forin" : true, // Tolerate `for in` loops without `hasOwnPrototype`. |
| 33 |
"immed" : true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );` |
| 34 |
"latedef" : true, // Prohibit variable use before definition. |
| 35 |
"newcap" : true, // Require capitalization of all constructor functions e.g. `new F()`. |
| 36 |
"noarg" : true, // Prohibit use of `arguments.caller` and `arguments.callee`. |
| 37 |
"noempty" : true, // Prohibit use of empty blocks. |
| 38 |
"nonew" : true, // Prohibit use of constructors for side-effects. |
| 39 |
"plusplus" : true, // Prohibit use of `++` & `--`. |
| 40 |
"regexp" : true, // Prohibit `.` and `[^...]` in regular expressions. |
| 41 |
"undef" : true, // Require all non-global variables be declared before they are used. |
| 42 |
"strict" : false, // Require `use strict` pragma in every file. |
| 43 |
"trailing" : true, // Prohibit trailing whitespaces. |
| 44 |
|
| 45 |
// == Relaxing Options ================================================ |
| 46 |
// |
| 47 |
// These options allow you to suppress certain types of warnings. Use |
| 48 |
// them only if you are absolutely positive that you know what you are |
| 49 |
// doing. |
| 50 |
|
| 51 |
"asi" : false, // Tolerate Automatic Semicolon Insertion (no semicolons). |
| 52 |
"boss" : false, // Tolerate assignments inside if, for & while. Usually conditions & loops are for comparison, not assignments. |
| 53 |
"debug" : false, // Allow debugger statements e.g. browser breakpoints. |
| 54 |
"eqnull" : false, // Tolerate use of `== null`. |
| 55 |
"es5" : false, // Allow EcmaScript 5 syntax. |
| 56 |
"esnext" : false, // Allow ES.next specific features such as `const` and `let`. |
| 57 |
"evil" : false, // Tolerate use of `eval`. |
| 58 |
"expr" : false, // Tolerate `ExpressionStatement` as Programs. |
| 59 |
"funcscope" : false, // Tolerate declarations of variables inside of control structures while accessing them later from the outside. |
| 60 |
"globalstrict" : false, // Allow global "use strict" (also enables 'strict'). |
| 61 |
"iterator" : false, // Allow usage of __iterator__ property. |
| 62 |
"lastsemic" : false, // Tolerat missing semicolons when the it is omitted for the last statement in a one-line block. |
| 63 |
"laxbreak" : false, // Tolerate unsafe line breaks e.g. `return [\n] x` without semicolons. |
| 64 |
"laxcomma" : false, // Suppress warnings about comma-first coding style. |
| 65 |
"loopfunc" : false, // Allow functions to be defined within loops. |
| 66 |
"multistr" : false, // Tolerate multi-line strings. |
| 67 |
"onecase" : false, // Tolerate switches with just one case. |
| 68 |
"proto" : false, // Tolerate __proto__ property. This property is deprecated. |
| 69 |
"regexdash" : false, // Tolerate unescaped last dash i.e. `[-...]`. |
| 70 |
"scripturl" : false, // Tolerate script-targeted URLs. |
| 71 |
"smarttabs" : false, // Tolerate mixed tabs and spaces when the latter are used for alignmnent only. |
| 72 |
"shadow" : false, // Allows re-define variables later in code e.g. `var x=1; x=2;`. |
| 73 |
"sub" : false, // Tolerate all forms of subscript notation besides dot notation e.g. `dict['key']` instead of `dict.key`. |
| 74 |
"supernew" : false, // Tolerate `new function () { ... };` and `new Object;`. |
| 75 |
"validthis" : false, // Tolerate strict violations when the code is running in strict mode and you use this in a non-constructor function. |
| 76 |
|
| 77 |
// == Environments ==================================================== |
| 78 |
// |
| 79 |
// These options pre-define global variables that are exposed by |
| 80 |
// popular JavaScript libraries and runtime environments—such as |
| 81 |
// browser or node.js. |
| 82 |
|
| 83 |
"browser" : false, // Standard browser globals e.g. `window`, `document`. |
| 84 |
"couch" : false, // Enable globals exposed by CouchDB. |
| 85 |
"devel" : false, // Allow development statements e.g. `console.log();`. |
| 86 |
"dojo" : false, // Enable globals exposed by Dojo Toolkit. |
| 87 |
"jquery" : false, // Enable globals exposed by jQuery JavaScript library. |
| 88 |
"mootools" : false, // Enable globals exposed by MooTools JavaScript framework. |
| 89 |
"node" : true, // Enable globals available when code is running inside of the NodeJS runtime environment. |
| 90 |
"nonstandard" : false, // Define non-standard but widely adopted globals such as escape and unescape. |
| 91 |
"prototypejs" : false, // Enable globals exposed by Prototype JavaScript framework. |
| 92 |
"rhino" : false, // Enable globals available when your code is running inside of the Rhino runtime environment. |
| 93 |
"wsh" : false, // Enable globals available when your code is running as a script for the Windows Script Host. |
| 94 |
|
| 95 |
// == JSLint Legacy =================================================== |
| 96 |
// |
| 97 |
// These options are legacy from JSLint. Aside from bug fixes they will |
| 98 |
// not be improved in any way and might be removed at any point. |
| 99 |
|
| 100 |
"nomen" : false, // Prohibit use of initial or trailing underbars in names. |
| 101 |
"onevar" : false, // Allow only one `var` statement per function. |
| 102 |
"passfail" : false, // Stop on first error. |
| 103 |
"white" : false, // Check against strict whitespace and indentation rules. |
| 104 |
|
| 105 |
// == Undocumented Options ============================================ |
| 106 |
// |
| 107 |
// While I've found these options in [example1][2] and [example2][3] |
| 108 |
// they are not described in the [JSHint Options documentation][4]. |
| 109 |
// |
| 110 |
// [4]: http://www.jshint.com/options/ |
| 111 |
|
| 112 |
"maxerr" : 100, // Maximum errors before stopping. |
| 113 |
"predef" : [ // Extra globals. |
| 114 |
//"exampleVar", |
| 115 |
//"anotherCoolGlobal", |
| 116 |
//"iLoveDouglas" |
| 117 |
], |
| 118 |
"indent" : 2, // Specify indentation spacing |
| 119 |
"maxlen" : 100 // The maximum number of characters in a line. |
| 120 |
} |