Skip to content

Commit

Permalink
added 'wsh' option for predefining WSH environment globals
Browse files Browse the repository at this point in the history
  • Loading branch information
benblank committed Apr 18, 2011
1 parent 360021b commit 7c219a3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
4 changes: 2 additions & 2 deletions env/wsh.js
@@ -1,5 +1,5 @@
/*jshint evil: true */
/*global ActiveXObject: false, JSHINT: false, WScript: false */
/*jshint evil: true, wsh: true */
/*global JSHINT: false */

(function() {
var formatters = {
Expand Down
22 changes: 20 additions & 2 deletions jshint.js
Expand Up @@ -208,7 +208,8 @@
slice, sort,spawn, split, stack, status, start, strict, sub, substr, supernew,
shadow, supplant, sum, sync, test, toLowerCase, toString, toUpperCase, toint32,
token, top, type, typeOf, Uint16Array, Uint32Array, Uint8Array, undef,
unused, urls, value, valueOf, var, version, WebSocket, white, window, Worker
unused, urls, value, valueOf, var, version, WebSocket, white, window, Worker,
wsh
*/

/*global exports: false */
Expand Down Expand Up @@ -281,7 +282,8 @@ var JSHINT = (function () {
strict : true, // require the "use strict"; pragma
sub : true, // if all forms of subscript notation are tolerated
supernew : true, // if `new function () { ... };` and `new Object;` should be tolerated
white : true // if strict whitespace rules apply
white : true, // if strict whitespace rules apply
wsh : true // if the Windows Scripting Host environment globals should be predefined
},

// browser contains a set of global names which are commonly provided by a
Expand Down Expand Up @@ -604,6 +606,19 @@ var JSHINT = (function () {
urls,
warnings,

wsh = {
ActiveXObject : true,
Enumerator : true,
GetObject : true,
ScriptEngine : true,
ScriptEngineBuildVersion : true,
ScriptEngineMajorVersion : true,
ScriptEngineMinorVersion : true,
VBArray : true,
WSH : true,
WScript : true
},

// Regular expressions. Some of these are stupidly long.

// unsafe comment or string
Expand Down Expand Up @@ -754,6 +769,9 @@ var JSHINT = (function () {
if (option.mootools)
combine(predefined, mootools);

if (option.wsh)
combine(predefined, wsh);

if (option.globalstrict)
option.strict = true;
}
Expand Down

0 comments on commit 7c219a3

Please sign in to comment.