Permalink
Browse files

Fixed stylisting warnings in JSHint wrappers.

Since I made all files to pass the same JSHint settings some
slipped through the cracks and started failing. How embarassing.
This patch fixes that.
  • Loading branch information...
1 parent c6058c0 commit fc3dcbea715e803ce688cae567945a81fddb6232 @valueof valueof committed Oct 13, 2012
Showing with 38 additions and 21 deletions.
  1. +7 −5 src/platforms/jsc.js
  2. +2 −0 src/platforms/rhino.js
  3. +29 −16 src/platforms/wsh.js
View
@@ -5,19 +5,21 @@
// jsc ${env_home}/jsc.js -- ${file} "$(cat ${file})" "option1:true,option2:false ${env_home}"
var env_home = '';
if (arguments.length > 3) {
- env_home = arguments[3].toString().replace(/\/dist/, '/src/stable/');
+ env_home = arguments[3].toString().replace(/\/dist/, '/src/stable/');
}
load(env_home + "jshint.js");
if (typeof(JSHINT) === 'undefined') {
- print('jshint: Could not load jshint.js, tried "' + env_home + 'jshint.js".');
- quit();
+ print('jshint: Could not load jshint.js, tried "' + env_home + 'jshint.js".');
+ quit();
}
-(function(args){
+(function (args) {
+ "use strict";
+
var name = args[0],
input = args[1],
- opts = (function(arg){
+ opts = (function (arg) {
var opts = {};
var item;
@@ -2,6 +2,8 @@
/*global JSHINT*/
(function (args) {
+ "use strict";
+
var filenames = [];
var optstr; // arg1=val1,arg2=val2,...
var predef; // global1=true,global2,global3,...
View
@@ -1,7 +1,8 @@
-/*jshint evil: true, shadow: true, wsh: true, undef: true, unused: true */
-/*global JSHINT: false */
+/*global JSHINT, WScript, Enumerator */
+
+(function () {
+ "use strict";
-(function() {
function readFile(path, charset) {
try {
var stream = WScript.CreateObject("ADODB.Stream");
@@ -106,21 +107,23 @@
}
var formatters = {
- errors: function(errors, lines) {
+ errors: function (errors, lines) {
for (var i = 0; i < errors.length; i++) {
var error = errors[i];
if (!error) continue;
if (i) lines.push("");
- lines.push("Line " + error.line + " character " + error.character + ": " + error.reason);
+ lines.push("Line " + error.line + " character " +
+ error.character + ": " + error.reason);
- if (error.evidence) lines.push(" " + error.evidence.replace(/^\s*((?:[\S\s]*\S)?)\s*$/, "$1"));
+ if (error.evidence) lines.push(" " +
+ error.evidence.replace(/^\s*((?:[\S\s]*\S)?)\s*$/, "$1"));
}
},
- implieds: function(implieds, lines) {
+ implieds: function (implieds, lines) {
lines.push("Implied globals:");
var globals = {};
@@ -138,7 +141,7 @@
}
},
- unused: function(unused, lines) {
+ unused: function (unused, lines) {
lines.push("Unused variables:");
var func, names = {};
@@ -166,6 +169,7 @@
// load JSHint if the two scripts have not been concatenated
if (typeof JSHINT === "undefined") {
+ /*jshint evil:true */
eval(readFile(scriptPath + "..\\src\\stable\\jshint.js", 'utf-8'));
if (typeof JSHINT === "undefined") {
@@ -181,19 +185,28 @@
var unnamed = WScript.Arguments.Unnamed;
if (unnamed.length !== 1) {
- WScript.StdOut.WriteLine(" usage: cscript " + scriptName + " [options] <script | directory>");
+ WScript.StdOut.WriteLine(" usage: cscript " + scriptName +
+ " [options] <script | directory>");
+
WScript.StdOut.WriteLine("");
- WScript.StdOut.WriteLine("Scans the specified script with JSHint and reports any errors encountered. If");
- WScript.StdOut.WriteLine("the script name is \"-\", it will be read from standard input instead.");
- WScript.StdOut.WriteLine("If a directory is passed, all .js files in that directory and subdirectories");
+ WScript.StdOut.WriteLine("Scans the specified script with JSHint " +
+ "and reports any errors encountered. If");
+ WScript.StdOut.WriteLine("the script name is \"-\", it will be read " +
+ "from standard input instead.");
+ WScript.StdOut.WriteLine("If a directory is passed, all .js files in " +
+ "that directory and subdirectories");
WScript.StdOut.WriteLine("will be scanned.");
WScript.StdOut.WriteLine("");
- WScript.StdOut.WriteLine("JSHint configuration options can be passed in via optional, Windows-style");
+ WScript.StdOut.WriteLine("JSHint configuration options can be passed in " +
+ "via optional, Windows-style");
WScript.StdOut.WriteLine("arguments. For example:");
- WScript.StdOut.WriteLine(" cscript " + scriptName + " /jquery:true myscript.js");
- WScript.StdOut.WriteLine(" cscript " + scriptName + " /global:QUnit:false,_:false,foo:true foo.js");
+ WScript.StdOut.WriteLine(" cscript " + scriptName +
+ " /jquery:true myscript.js");
+ WScript.StdOut.WriteLine(" cscript " + scriptName +
+ " /global:QUnit:false,_:false,foo:true foo.js");
WScript.StdOut.WriteLine("");
- WScript.StdOut.WriteLine("By default, we assume that your file is encoded in UTF-8. You can change that");
+ WScript.StdOut.WriteLine("By default, we assume that your file is encoded " +
+ "in UTF-8. You can change that");
WScript.StdOut.WriteLine("by providing a custom charset option:");
WScript.StdOut.WriteLine(" cscript " + scriptName + " /charset:ascii myscript.js");

0 comments on commit fc3dcbe

Please sign in to comment.