File tree 5 files changed +5548
-3
lines changed
5 files changed +5548
-3
lines changed Original file line number Diff line number Diff line change @@ -29,11 +29,12 @@ JQ_MIN = ${DIST_DIR}/jquery.min.js
29
29
JQ_VER = ` cat version.txt `
30
30
VER = sed s/@VERSION/${JQ_VER}/
31
31
32
+ RHINO = java -jar ${BUILD_DIR}/js.jar
32
33
MINJAR = java -jar ${BUILD_DIR}/google-compiler-20091218.jar
33
34
34
35
DATE =` git log -1 | grep Date: | sed ' s/[^:]*: *//' `
35
36
36
- all : jquery min
37
+ all : jquery lint min
37
38
@@echo " jQuery build complete."
38
39
39
40
${DIST_DIR} :
49
50
jquery : ${DIST_DIR} selector ${JQ}
50
51
jq : ${DIST_DIR} ${JQ}
51
52
52
- ${JQ} : ${MODULES}
53
+ ${JQ} : selector ${MODULES}
53
54
@@echo " Building" ${JQ}
54
55
55
56
@@mkdir -p ${DIST_DIR}
@@ -58,10 +59,14 @@ ${JQ}: ${MODULES}
58
59
sed 's/Date:./&'"${DATE}"'/' | \
59
60
${VER} > ${JQ};
60
61
61
- selector : init
62
+ selector : ${DIST_DIR} init
62
63
@@echo " Building selector code from Sizzle"
63
64
@@sed ' /EXPOSE/r src/sizzle-jquery.js' src/sizzle/sizzle.js > src/selector.js
64
65
66
+ lint : ${JQ}
67
+ @@echo " Checking jQuery against JSLint..."
68
+ @@${RHINO} build/jslint-check.js
69
+
65
70
min : ${JQ_MIN}
66
71
67
72
${JQ_MIN} : ${JQ}
Original file line number Diff line number Diff line change @@ -36,6 +36,10 @@ Makes: ./dist/jquery.js
36
36
A compressed version of jQuery (made the Closure Compiler).
37
37
Makes: ./dist/jquery.min.js
38
38
39
+ ` make lint `
40
+
41
+ Tests a build of jQuery against JSLint, looking for potential errors or bits of confusing code.
42
+
39
43
` make selector `
40
44
41
45
Builds the selector library for jQuery from Sizzle.
Original file line number Diff line number Diff line change
1
+ load ( "build/jslint.js" ) ;
2
+
3
+ var src = readFile ( "dist/jquery.js" ) ;
4
+
5
+ JSLINT ( src , { evil : true , forin : true } ) ;
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
+
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." ) ;
33
+
34
+ } else {
35
+ print ( "JSLint check passed." ) ;
36
+ }
You can’t perform that action at this time.
0 commit comments