jquery/build/jshint-check.js

36 lines
714 B
JavaScript

var jshint = require("./lib/jshint").JSHINT,
src = require("fs").readFileSync("dist/jquery.js", "utf8"),
config = {
evil: true,
undef: false,
browser: true,
wsh: true,
eqnull: true,
expr: true,
curly: true,
trailing: true,
predef: [
"define",
"DOMParser"
],
maxerr: 100
};
if ( jshint( src, config ) ) {
console.log("JSHint check passed.");
} else {
console.log( "JSHint found errors." );
jshint.errors.forEach(function( e ) {
if ( !e ) { return; }
var str = e.evidence ? e.evidence : "";
if ( str ) {
str = str.replace( /\t/g, " " ).trim();
console.log( " [L" + e.line + ":C" + e.character + "] " + e.reason + "\n " + str + "\n");
}
});
}