Skip to content

Commit f724bc6

Browse files
rwaldrontimmywil
authored andcommitted
Reformat jshint errors to be readable; make post-compile.js write directly to jquery.min.js; update required Node version
1 parent 4534db1 commit f724bc6

File tree

4 files changed

+34
-33
lines changed

4 files changed

+34
-33
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ ${JQ_MIN}: ${JQ}
9797
@@if test ! -z ${JS_ENGINE}; then \
9898
echo "Minifying jQuery" ${JQ_MIN}; \
9999
${COMPILER} ${JQ} > ${JQ_MIN}.tmp; \
100-
${POST_COMPILER} ${JQ_MIN}.tmp > ${JQ_MIN}; \
100+
${POST_COMPILER} ${JQ_MIN}.tmp; \
101101
rm -f ${JQ_MIN}.tmp; \
102102
else \
103103
echo "You must have NodeJS installed in order to minify jQuery."; \

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ In the spirit of open source software development, jQuery always encourages comm
1515
What you need to build your own jQuery
1616
--------------------------------------
1717

18-
In order to build jQuery, you need to have GNU make 3.8 or later, Node.js 0.2 or later, and git 1.7 or later.
18+
In order to build jQuery, you need to have GNU make 3.8 or later, Node.js 0.4.12 or later, and git 1.7 or later.
1919
(Earlier versions might work OK, but are not tested.)
2020

2121
Windows users have two options:

build/jshint-check.js

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,36 @@
1-
var JSHINT = require("./lib/jshint").JSHINT,
2-
print = require("sys").print,
3-
src = require("fs").readFileSync("dist/jquery.js", "utf8");
1+
var jshint = require("./lib/jshint").JSHINT,
2+
src = require("fs").readFileSync("dist/jquery.js", "utf8"),
3+
config = {
4+
evil: true,
5+
undef: false,
6+
browser: true,
7+
wsh: true,
8+
eqnull: true,
9+
expr: true,
10+
curly: true,
11+
trailing: true,
12+
predef: [
13+
"define",
14+
"DOMParser"
15+
],
16+
maxerr: 100
17+
};
418

5-
JSHINT(src, {
6-
evil: true,
7-
undef: false,
8-
browser: true,
9-
wsh: true,
10-
eqnull: true,
11-
expr: true,
12-
curly: true,
13-
trailing: true,
14-
predef: [
15-
"define",
16-
"DOMParser"
17-
],
18-
maxerr: 100
19-
});
19+
if ( jshint( src, config ) ) {
20+
console.log("JSHint check passed.");
21+
} else {
2022

21-
var e = JSHINT.errors, found = e.length, i = 0, w;
23+
console.log( "JSHint found errors." );
2224

23-
for ( ; i < e.length; i++ ) {
24-
w = e[i];
25+
jshint.errors.forEach(function( e ) {
26+
if ( !e ) { return; }
2527

26-
print( "\n" + w.evidence + "\n" );
27-
print( " Problem at line " + w.line + " character " + w.character + ": " + w.reason );
28-
}
28+
var str = e.evidence ? e.evidence : "";
2929

30-
if ( found > 0 ) {
31-
print( "\n" + found + " Error(s) found.\n" );
32-
} else {
33-
print( "JSHint check passed.\n" );
30+
if ( str ) {
31+
str = str.replace( /\t/g, " " ).trim();
32+
33+
console.log( " [L" + e.line + ":C" + e.character + "] " + e.reason + "\n " + str + "\n");
34+
}
35+
});
3436
}

build/post-compile.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env node
22

3-
var print = require( "sys" ).print,
4-
fs = require( "fs" ),
3+
var fs = require( "fs" ),
54
src = fs.readFileSync( process.argv[2], "utf8" ),
65
version = fs.readFileSync( "version.txt", "utf8" ),
76
// License Template
@@ -17,4 +16,4 @@ license = license.replace( "@VERSION", version );
1716
// Replace license block with minimal license
1817
src = src.replace( /\/\/.*?\/?\*.+?(?=\n|\r|$)|\/\*[\s\S]*?\/\/[\s\S]*?\*\//, license );
1918

20-
print( src );
19+
fs.writeFileSync( "dist/jquery.min.js", src, "utf8" );

0 commit comments

Comments
 (0)