Skip to content

Commit

Permalink
Merge remote branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlEkerot committed Aug 13, 2012
2 parents f5ea569 + a1d7a7d commit d211d34
Show file tree
Hide file tree
Showing 9 changed files with 145 additions and 86 deletions.
32 changes: 32 additions & 0 deletions README.markdown → README.md
Expand Up @@ -66,6 +66,38 @@ Core Team members:

Maintainer: Anton Kovalyov

License
-------

JSHint is licensed under the same slightly modified MIT license that JSLint is.
It stops evil-doers everywhere.

JSHint is a derivative work of JSLint:

Copyright (c) 2002 Douglas Crockford (www.JSLint.com)

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom
the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

The Software shall be used for Good, not Evil.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

JSHint was forked from the 2010-12-16 edition of JSLint.

Thank you!
----------

Expand Down
8 changes: 4 additions & 4 deletions env/jsc.js
@@ -1,4 +1,5 @@
/*jshint boss:true, evil:true */
/*jshint boss:true, evil:true, unused:true, undef:true */
/*global load, print, quit, JSHINT */

// usage:
// jsc ${env_home}/jsc.js -- ${file} "$(cat ${file})" "option1:true,option2:false ${env_home}"
Expand All @@ -14,8 +15,7 @@ if (typeof(JSHINT) === 'undefined') {
}

(function(args){
var home = args[3],
name = args[0],
var name = args[0],
input = args[1],
opts = (function(arg){
var opts = {};
Expand Down Expand Up @@ -54,4 +54,4 @@ if (typeof(JSHINT) === 'undefined') {
}

quit();
})(arguments);
})(arguments);
59 changes: 32 additions & 27 deletions env/rhino.js
@@ -1,42 +1,49 @@
/*jshint boss: true, rhino: true */
/*globals JSHINT*/
/*jshint boss: true, rhino: true, unused: true, undef: true, white: true, quotmark: double */
/*global JSHINT*/

(function (args) {
var filenames = [],
optstr, // arg1=val1,arg2=val2,...
predef, // global1=override,global2,global3,...
opts = {},
retval = 0;
var filenames = [];
var optstr; // arg1=val1,arg2=val2,...
var predef; // global1=true,global2,global3,...
var opts = {};
var retval = 0;

args.forEach(function (arg) {
if (arg.indexOf("=") > -1) {
//first time it's the options
if (!optstr) {
// First time it's the options.
optstr = arg;
} else if (!predef) {
} else {
predef = arg;
}
} else {
filenames.push(arg);

return;
}

if (optstr) {
predef = arg;
return;
}

filenames.push(arg);
});

if (filenames.length === 0) {
print('Usage: jshint.js file.js');
print("Usage: jshint.js file.js");
quit(1);
}

if (optstr) {
optstr.split(',').forEach(function (arg) {
var o = arg.split('=');
if (o[0] === 'indent') {
optstr.split(",").forEach(function (arg) {
var o = arg.split("=");
if (o[0] === "indent") {
opts[o[0]] = parseInt(o[1], 10);
} else {
opts[o[0]] = (function (ov) {
switch (ov) {
case 'true':
case "true":
return true;
case 'false':
case "false":
return false;
default:
return ov;
Expand All @@ -48,28 +55,26 @@

if (predef) {
opts.predef = {};
predef.split(',').forEach(function (arg) {
var global = arg.split('=');
opts.predef[global[0]] = (function (override) {
return (override === 'false') ? false : true;
}(global[1]));

predef.split(",").forEach(function (arg) {
var global = arg.split("=");
opts.predef[global[0]] = global[1] === "true" ? true : false;
});
}

filenames.forEach(function (name) {

var input = readFile(name);

if (!input) {
print('jshint: Couldn\'t open file ' + name);
print("jshint: Couldn't open file " + name);
quit(1);
}

if (!JSHINT(input, opts)) {
for (var i = 0, err; err = JSHINT.errors[i]; i += 1) {
print(err.reason + ' (' + name + ':' + err.line + ':' + err.character + ')');
print('> ' + (err.evidence || '').replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1"));
print('');
print(err.reason + " (" + name + ":" + err.line + ":" + err.character + ")");
print("> " + (err.evidence || "").replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1"));
print("");
}
retval = 1;
}
Expand Down
4 changes: 2 additions & 2 deletions env/wsh.js
@@ -1,4 +1,4 @@
/*jshint evil: true, shadow: true, wsh: true */
/*jshint evil: true, shadow: true, wsh: true, undef: true, unused: true */
/*global JSHINT: false */

(function() {
Expand Down Expand Up @@ -237,4 +237,4 @@
}

WScript.Quit(returnValue);
}());
}());

0 comments on commit d211d34

Please sign in to comment.