UNPKG

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