Tagging the 1.5rc1 release.
[jquery.git] / build / jslint-check.js
1 var JSLINT = require("./lib/jslint").JSLINT,
2         print = require("sys").print,
3         src = require("fs").readFileSync("dist/jquery.js", "utf8");
4
5 JSLINT(src, { evil: true, forin: true, maxerr: 100 });
6
7 // All of the following are known issues that we think are 'ok'
8 // (in contradiction with JSLint) more information here:
9 // http://docs.jquery.com/JQuery_Core_Style_Guidelines
10 var ok = {
11         "Expected an identifier and instead saw 'undefined' (a reserved word).": true,
12         "Use '===' to compare with 'null'.": true,
13         "Use '!==' to compare with 'null'.": true,
14         "Expected an assignment or function call and instead saw an expression.": true,
15         "Expected a 'break' statement before 'case'.": true,
16         "'e' is already defined.": true
17 };
18
19 var e = JSLINT.errors, found = 0, w;
20
21 for ( var i = 0; i < e.length; i++ ) {
22         w = e[i];
23
24         if ( !ok[ w.reason ] ) {
25                 found++;
26                 print( "\n" + w.evidence + "\n" );
27                 print( "    Problem at line " + w.line + " character " + w.character + ": " + w.reason );
28         }
29 }
30
31 if ( found > 0 ) {
32         print( "\n" + found + " Error(s) found.\n" );
33
34 } else {
35         print( "JSLint check passed.\n" );
36 }