2011-12-15 15:11:24 +00:00
|
|
|
|
var jshint = require("./lib/jshint").JSHINT,
|
|
|
|
|
src = require("fs").readFileSync("dist/jquery.js", "utf8"),
|
|
|
|
|
config = {
|
|
|
|
|
evil: true,
|
|
|
|
|
browser: true,
|
|
|
|
|
wsh: true,
|
|
|
|
|
eqnull: true,
|
|
|
|
|
expr: true,
|
|
|
|
|
curly: true,
|
|
|
|
|
trailing: true,
|
2012-01-20 02:47:23 +00:00
|
|
|
|
undef: true,
|
|
|
|
|
smarttabs: true,
|
2011-12-15 15:11:24 +00:00
|
|
|
|
predef: [
|
|
|
|
|
"define",
|
2012-04-06 01:51:27 +00:00
|
|
|
|
"DOMParser",
|
|
|
|
|
"WebKitPoint"
|
2011-12-15 15:11:24 +00:00
|
|
|
|
],
|
|
|
|
|
maxerr: 100
|
|
|
|
|
};
|
2011-12-09 01:42:47 +00:00
|
|
|
|
|
2011-12-15 15:11:24 +00:00
|
|
|
|
if ( jshint( src, config ) ) {
|
|
|
|
|
console.log("JSHint check passed.");
|
|
|
|
|
} else {
|
2011-12-09 01:42:47 +00:00
|
|
|
|
|
2011-12-15 15:11:24 +00:00
|
|
|
|
console.log( "JSHint found errors." );
|
2011-12-09 01:42:47 +00:00
|
|
|
|
|
2011-12-15 15:11:24 +00:00
|
|
|
|
jshint.errors.forEach(function( e ) {
|
|
|
|
|
if ( !e ) { return; }
|
2011-12-09 01:42:47 +00:00
|
|
|
|
|
2011-12-29 16:36:41 +00:00
|
|
|
|
var str = e.evidence ? e.evidence : "",
|
|
|
|
|
character = e.character === true ? "EOL" : "C" + e.character;
|
2011-12-09 01:42:47 +00:00
|
|
|
|
|
2011-12-15 15:11:24 +00:00
|
|
|
|
if ( str ) {
|
|
|
|
|
str = str.replace( /\t/g, " " ).trim();
|
2011-12-29 16:36:41 +00:00
|
|
|
|
console.log( " [L" + e.line + ":" + character + "] " + e.reason + "\n " + str + "\n");
|
2011-12-15 15:11:24 +00:00
|
|
|
|
}
|
|
|
|
|
});
|
2011-12-09 01:42:47 +00:00
|
|
|
|
}
|