Skip to content

Commit

Permalink
Fixed stylisting warnings in JSHint wrappers.
Browse files Browse the repository at this point in the history
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
valueof committed Oct 13, 2012
1 parent c6058c0 commit fc3dcbe
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 21 deletions.
12 changes: 7 additions & 5 deletions src/platforms/jsc.js
Expand Up @@ -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;

Expand Down
2 changes: 2 additions & 0 deletions src/platforms/rhino.js
Expand Up @@ -2,6 +2,8 @@
/*global JSHINT*/

(function (args) {
"use strict";

var filenames = [];
var optstr; // arg1=val1,arg2=val2,...
var predef; // global1=true,global2,global3,...
Expand Down
45 changes: 29 additions & 16 deletions src/platforms/wsh.js
@@ -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");
Expand Down Expand Up @@ -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 = {};
Expand All @@ -138,7 +141,7 @@
}
},

unused: function(unused, lines) {
unused: function (unused, lines) {
lines.push("Unused variables:");

var func, names = {};
Expand Down Expand Up @@ -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") {
Expand All @@ -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");

Expand Down

0 comments on commit fc3dcbe

Please sign in to comment.