Skip to content

Commit 98386cf

Browse files
mikesherovdmethvin
authored andcommitted
Fix #10692. JSLint is dead! Long live JSHint!
Still needs this sizzle PR: jquery/sizzle#82
1 parent d6500cc commit 98386cf

File tree

10 files changed

+4323
-5570
lines changed

10 files changed

+4323
-5570
lines changed

Makefile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ DATE=$(shell git log -1 --pretty=format:%ad)
4646

4747
all: update_submodules core
4848

49-
core: jquery min lint size
49+
core: jquery min hint size
5050
@@echo "jQuery build complete."
5151

5252
${DIST_DIR}:
@@ -67,12 +67,14 @@ ${SRC_DIR}/selector.js: ${SIZZLE_DIR}/sizzle.js
6767
@@echo "Building selector code from Sizzle"
6868
@@sed '/EXPOSE/r src/sizzle-jquery.js' ${SIZZLE_DIR}/sizzle.js | grep -v window.Sizzle > ${SRC_DIR}/selector.js
6969

70-
lint: jquery
70+
lint: hint
71+
72+
hint: jquery
7173
@@if test ! -z ${JS_ENGINE}; then \
72-
echo "Checking jQuery against JSLint..."; \
73-
${JS_ENGINE} build/jslint-check.js; \
74+
echo "Checking jQuery against JSHint..."; \
75+
${JS_ENGINE} build/jshint-check.js; \
7476
else \
75-
echo "You must have NodeJS installed in order to test jQuery against JSLint."; \
77+
echo "You must have NodeJS installed in order to test jQuery against JSHint."; \
7678
fi
7779

7880
size: jquery min
@@ -134,4 +136,4 @@ pull_submodules:
134136
pull: pull_submodules
135137
@@git pull ${REMOTE} ${BRANCH}
136138

137-
.PHONY: all jquery lint min clean distclean update_submodules pull_submodules pull core
139+
.PHONY: all jquery lint hint min clean distclean update_submodules pull_submodules pull core

build/jshint-check.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
var JSHINT = require("./lib/jshint").JSHINT,
2+
print = require("sys").print,
3+
src = require("fs").readFileSync("dist/jquery.js", "utf8");
4+
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+
eqeq: true,
14+
trailing: true,
15+
predef: [
16+
"define",
17+
"DOMParser"
18+
],
19+
maxerr: 100
20+
});
21+
22+
var e = JSHINT.errors, found = e.length, i = 0, w;
23+
24+
for ( ; i < e.length; i++ ) {
25+
w = e[i];
26+
27+
print( "\n" + w.evidence + "\n" );
28+
print( " Problem at line " + w.line + " character " + w.character + ": " + w.reason );
29+
}
30+
31+
if ( found > 0 ) {
32+
print( "\n" + found + " Error(s) found.\n" );
33+
} else {
34+
print( "JSHint check passed.\n" );
35+
}

build/jslint-check.js

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)