2010-03-02 02:51:44 +00:00
|
|
|
load("build/jslint.js");
|
|
|
|
|
|
|
|
var src = readFile("dist/jquery.js");
|
|
|
|
|
2010-09-01 15:48:19 +00:00
|
|
|
JSLINT(src, { evil: true, forin: true, maxerr: 100 });
|
2010-03-02 02:51:44 +00:00
|
|
|
|
|
|
|
// All of the following are known issues that we think are 'ok'
|
|
|
|
// (in contradiction with JSLint) more information here:
|
|
|
|
// http://docs.jquery.com/JQuery_Core_Style_Guidelines
|
|
|
|
var ok = {
|
|
|
|
"Expected an identifier and instead saw 'undefined' (a reserved word).": true,
|
|
|
|
"Use '===' to compare with 'null'.": true,
|
|
|
|
"Use '!==' to compare with 'null'.": true,
|
|
|
|
"Expected an assignment or function call and instead saw an expression.": true,
|
2010-10-17 14:50:17 +00:00
|
|
|
"Expected a 'break' statement before 'case'.": true,
|
|
|
|
"'e' is already defined.": true
|
2010-03-02 02:51:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
var e = JSLINT.errors, found = 0, w;
|
|
|
|
|
|
|
|
for ( var i = 0; i < e.length; i++ ) {
|
|
|
|
w = e[i];
|
|
|
|
|
|
|
|
if ( !ok[ w.reason ] ) {
|
|
|
|
found++;
|
|
|
|
print( "\n" + w.evidence + "\n" );
|
|
|
|
print( " Problem at line " + w.line + " character " + w.character + ": " + w.reason );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( found > 0 ) {
|
|
|
|
print( "\n" + found + " Error(s) found." );
|
|
|
|
|
|
|
|
} else {
|
|
|
|
print( "JSLint check passed." );
|
|
|
|
}
|