Permalink
Browse files

added 'wsh' option for predefining WSH environment globals

  • Loading branch information...
1 parent 360021b commit 7c219a33fb8ab3f11a9b8f9575913b04edf770de @benblank committed Apr 18, 2011
Showing with 22 additions and 4 deletions.
  1. +2 −2 env/wsh.js
  2. +20 −2 jshint.js
View
@@ -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 = {
View
@@ -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 */
@@ -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
@@ -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
@@ -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;
}

0 comments on commit 7c219a3

Please sign in to comment.