Skip to content

Commit 5dd8a90

Browse files
Krinklegibson042
authored andcommitted
Make compatible with jshint, lint test/data. Close jquerygh-1043.
1 parent 26bf8dd commit 5dd8a90

File tree

8 files changed

+111
-118
lines changed

8 files changed

+111
-118
lines changed

.jshintrc

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
{
2-
"options": {
3-
"curly": true,
4-
"eqeqeq": true,
5-
"eqnull": true,
6-
"expr": true,
7-
"latedef": true,
8-
"noarg": true,
9-
"node": true,
10-
"quotmark": "double",
11-
"smarttabs": true,
12-
"trailing": true,
13-
"undef": true,
14-
"unused": true
15-
}
2+
"curly": true,
3+
"eqeqeq": true,
4+
"latedef": true,
5+
"noarg": true,
6+
"noempty": true,
7+
"quotmark": "double",
8+
"undef": true,
9+
"unused": true,
10+
"strict": true,
11+
"trailing": true,
12+
13+
"node": true
1614
}

grunt.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
* Resources
33
*
44
* https://gist.github.com/2489540
5-
*
65
*/
76

87
module.exports = function( grunt ) {
@@ -82,7 +81,8 @@ module.exports = function( grunt ) {
8281
lint: {
8382
dist: "dist/jquery.js",
8483
grunt: "grunt.js",
85-
tests: "test/unit/**/*.js"
84+
// TODO: Once .jshintignore is supported, use that instead.
85+
tests: ["test/data/{test,testinit,testrunner}.js", "test/unit/**/*.js"]
8686
},
8787

8888
jshint: (function() {
@@ -91,9 +91,15 @@ module.exports = function( grunt ) {
9191
}
9292

9393
return {
94-
grunt: jshintrc(),
95-
dist: jshintrc( "src/" ),
96-
tests: jshintrc( "test/" )
94+
grunt: {
95+
options: jshintrc()
96+
},
97+
dist: {
98+
options: jshintrc( "src/" )
99+
},
100+
tests: {
101+
options: jshintrc( "test/" )
102+
}
97103
};
98104
})(),
99105

src/.jshintrc

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,24 @@
11
{
2-
"options": {
3-
"browser": true,
4-
"curly": true,
5-
"eqnull": true,
6-
"evil": true,
7-
"expr": true,
8-
"maxerr": 100,
9-
"newcap": false,
10-
"quotmark": "double",
11-
"regexdash": true,
12-
"strict": true,
13-
"sub": true,
14-
"trailing": true,
15-
"undef": true,
16-
"unused": true,
17-
"wsh": true
18-
},
19-
"globals": {
20-
"define": true,
21-
"DOMParser": true,
22-
"__dirname": true,
23-
"jQuery": true,
24-
"global": true,
25-
"module": true,
26-
"exports": true,
27-
"require": true,
28-
"file": true,
29-
"log": true,
30-
"console": true
31-
}
2+
"curly": true,
3+
"expr": true,
4+
"newcap": false,
5+
"quotmark": "double",
6+
"regexdash": true,
7+
"strict": true,
8+
"trailing": true,
9+
"undef": true,
10+
"unused": true,
11+
"maxerr": 100,
12+
13+
"eqnull": true,
14+
"evil": true,
15+
"sub": true,
16+
17+
"browser": true,
18+
"wsh": true,
19+
20+
"predef": [
21+
"define",
22+
"jQuery"
23+
]
3224
}

test/.jshintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
qunit/
2+
data/badjson.js
3+
data/jquery-1.8.2.ajax_xhr.min.js

test/.jshintrc

Lines changed: 53 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,55 @@
11
{
2-
"options": {
3-
"browser": true,
4-
"curly": true,
5-
"devel": true,
6-
"eqnull": true,
7-
"evil": true,
8-
"expr": true,
9-
"maxerr": 100,
10-
"quotmark": "double",
11-
"smarttabs": true,
12-
"sub": true,
13-
"trailing": true,
14-
"undef": true,
15-
"wsh": true
16-
},
17-
"globals": {
18-
"define": true,
19-
"DOMParser": true,
20-
"__dirname": true,
21-
"jQuery": true,
22-
"global": true,
23-
"module": true,
24-
"exports": true,
25-
"require": true,
26-
"file": true,
27-
"log": true,
28-
"QUnit": true,
29-
"ok": true,
30-
"equal": true,
31-
"test": true,
32-
"asyncTest": true,
33-
"notEqual": true,
34-
"deepEqual": true,
35-
"strictEqual": true,
36-
"notStrictEqual": true,
37-
"start": true,
38-
"stop": true,
39-
"expect": true,
40-
"raises": true,
41-
"ajaxTest": true,
42-
"testIframe": true,
43-
"testIframeWithCallback": true,
44-
"createDashboardXML": true,
45-
"createXMLFragment": true,
46-
"moduleTeardown": true,
47-
"testFoo": true,
48-
"url": true,
49-
"t": true,
50-
"q": true,
51-
"amdDefined": true,
52-
"fireNative": true,
53-
"Globals": true,
54-
"hasPHP": true,
55-
"isLocal": true,
56-
"originaljQuery": true,
57-
"$": true,
58-
"original$": true,
59-
"externalHost": true
60-
}
2+
"curly": true,
3+
"expr": true,
4+
"quotmark": "double",
5+
"trailing": true,
6+
"undef": true,
7+
"maxerr": 100,
8+
9+
"eqnull": true,
10+
"evil": true,
11+
"smarttabs": true,
12+
"sub": true,
13+
14+
"browser": true,
15+
"devel": true,
16+
"wsh": true,
17+
18+
"predef": [
19+
"DOMParser",
20+
"jQuery",
21+
"QUnit",
22+
"module",
23+
"ok",
24+
"equal",
25+
"test",
26+
"asyncTest",
27+
"notEqual",
28+
"deepEqual",
29+
"strictEqual",
30+
"notStrictEqual",
31+
"start",
32+
"stop",
33+
"expect",
34+
"raises",
35+
"ajaxTest",
36+
"testIframe",
37+
"testIframeWithCallback",
38+
"createDashboardXML",
39+
"createXMLFragment",
40+
"moduleTeardown",
41+
"testFoo",
42+
"url",
43+
"t",
44+
"q",
45+
"amdDefined",
46+
"fireNative",
47+
"Globals",
48+
"hasPHP",
49+
"isLocal",
50+
"originaljQuery",
51+
"$",
52+
"original$",
53+
"externalHost"
54+
]
6155
}

test/data/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
var testBar = "bar";
2-
jQuery('#ap').html('bar');
2+
jQuery("#ap").html("bar");
33
ok( true, "test.js executed");

test/data/testinit.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*jshint multistr:true */
1+
/*jshint multistr:true, quotmark:false */
22

33
var amdDefined, fireNative,
44
originaljQuery = this.jQuery || "jQuery",
@@ -207,7 +207,7 @@ function ajaxTest( title, expect, options ) {
207207
}
208208
};
209209
});
210-
};
210+
}
211211

212212
(function () {
213213

test/data/testrunner.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ var Globals = (function() {
232232
// Since this method was called it means some data was
233233
// expected to be found, but since there is nothing, fail early
234234
// (instead of in teardown).
235-
notStrictEqual( expando, undefined, 'Target for expectJqData must have an expando, for else there can be no data to expect.' );
235+
notStrictEqual( expando, undefined, "Target for expectJqData must have an expando, for else there can be no data to expect." );
236236
} else {
237237
if ( expectedDataKeys[expando] ) {
238238
expectedDataKeys[expando].push( key );
@@ -243,9 +243,9 @@ var Globals = (function() {
243243
}
244244
};
245245
QUnit.config.urlConfig.push( {
246-
id: 'jqdata',
247-
label: 'Always check jQuery.data',
248-
tooltip: 'Trigger "QUnit.expectJqData" detection for all tests instead of just the ones that call it'
246+
id: "jqdata",
247+
label: "Always check jQuery.data",
248+
tooltip: "Trigger QUnit.expectJqData detection for all tests instead of just the ones that call it"
249249
} );
250250

251251
/**
@@ -265,14 +265,14 @@ var Globals = (function() {
265265
expectedKeys = expectedDataKeys[i];
266266
actualKeys = jQuery.cache[i] ? keys( jQuery.cache[i] ) : jQuery.cache[i];
267267
if ( !QUnit.equiv( expectedKeys, actualKeys ) ) {
268-
deepEqual( actualKeys, expectedKeys, 'Expected keys exist in jQuery.cache' );
268+
deepEqual( actualKeys, expectedKeys, "Expected keys exist in jQuery.cache" );
269269
}
270270
delete jQuery.cache[i];
271271
delete expectedDataKeys[i];
272272
}
273273
// In case it was removed from cache before (or never there in the first place)
274274
for ( i in expectedDataKeys ) {
275-
deepEqual( expectedDataKeys[i], undefined, 'No unexpected keys were left in jQuery.cache (#' + i + ')' );
275+
deepEqual( expectedDataKeys[i], undefined, "No unexpected keys were left in jQuery.cache (#" + i + ")" );
276276
delete expectedDataKeys[i];
277277
}
278278
}
@@ -359,5 +359,5 @@ QUnit.config.requireExpects = true;
359359
return;
360360
}
361361

362-
document.write("<scr" + "ipt src='http://swarm.jquery.org/js/inject.js?" + (new Date).getTime() + "'></scr" + "ipt>");
362+
document.write("<scr" + "ipt src='http://swarm.jquery.org/js/inject.js?" + (new Date()).getTime() + "'></scr" + "ipt>");
363363
})();

0 commit comments

Comments
 (0)