Jshint: document more enforcing options.
This commit is contained in:
parent
320a3177f4
commit
563a112354
46
jshint.md
46
jshint.md
|
@ -3,8 +3,9 @@ title: Jshint
|
||||||
layout: default
|
layout: default
|
||||||
---
|
---
|
||||||
|
|
||||||
### Relaxing
|
### [Relaxing](http://www.jshint.com/docs/options/#relaxing-options)
|
||||||
|
|
||||||
|
Enable these options to *not* throw errors in these conditions.
|
||||||
|
|
||||||
/* jshint asi: true */
|
/* jshint asi: true */
|
||||||
allow()
|
allow()
|
||||||
|
@ -35,14 +36,40 @@ layout: default
|
||||||
}
|
}
|
||||||
|
|
||||||
/* jshint sub: true */
|
/* jshint sub: true */
|
||||||
process.env['name_here'];
|
process.env['name_here']
|
||||||
|
|
||||||
### Enforcement
|
### [Enforcing](http://www.jshint.com/docs/options/#enforcing-options)
|
||||||
|
|
||||||
/* jshint es3: true */
|
Enable these options to catch more errors.
|
||||||
// legacy IE compatibility
|
|
||||||
a.default = function() { ... };
|
/* jshint curly: true */
|
||||||
array = [ 1, 2, 3, ];
|
while (day) // err: use { }'s
|
||||||
|
shuffle();
|
||||||
|
|
||||||
|
/* jshint eqeqeq: true */
|
||||||
|
if (a == null) // err: use ===
|
||||||
|
|
||||||
|
/* jshint es3: true */ // ...for legacy IE compatibility
|
||||||
|
a.default = function() { ... }; // err: reserved word
|
||||||
|
array = [ 1, 2, 3, ]; // err: extra comma
|
||||||
|
|
||||||
|
/* jshint forin: true */
|
||||||
|
for (key in obj) { ... } // err: check obj.hasOwnProperty(key)
|
||||||
|
|
||||||
|
/* jshint freeze: true */
|
||||||
|
Array.prototype.count = ...; // err: don't modify native prototypes
|
||||||
|
|
||||||
|
/* jshint indent: 4 */
|
||||||
|
if (x) { // err: expected indent of 4, found 2
|
||||||
|
...;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* jshint quotmark: single */
|
||||||
|
/* jshint quotmark: double */
|
||||||
|
alert("hi"); // err: only single allowed
|
||||||
|
|
||||||
|
/* jshint strict: true */
|
||||||
|
function() { ... } // err: need "use strict"
|
||||||
|
|
||||||
/* jshint white: true, indent: 4 */
|
/* jshint white: true, indent: 4 */
|
||||||
/* jshint maxdepth: 2 */
|
/* jshint maxdepth: 2 */
|
||||||
|
@ -56,13 +83,14 @@ layout: default
|
||||||
/* jshint ignore:start */
|
/* jshint ignore:start */
|
||||||
/* jshint ignore:end */
|
/* jshint ignore:end */
|
||||||
|
|
||||||
### Globals
|
### Globals and [Environments](http://www.jshint.com/docs/options/#environments)
|
||||||
|
|
||||||
/* jshint undef: true */
|
/* jshint undef: true */
|
||||||
/* global jQuery */
|
/* global jQuery */
|
||||||
/* global -BAD_LIB */
|
/* global -BAD_LIB */
|
||||||
|
|
||||||
/* jshint browser: true */ window, document, ...
|
/* jshint devel: true */ console, alert, ...
|
||||||
|
/* jshint browser: true */ window, document, location, ...
|
||||||
/* jshint node: true */ module, exports, console, process, ...
|
/* jshint node: true */ module, exports, console, process, ...
|
||||||
/* jshint jquery: true */ jQuery, $
|
/* jshint jquery: true */ jQuery, $
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue