Skip to content

Commit 9624633

Browse files
committed
Adds .jshintrc files for: grunt (default set), src, tests; Adapts jQuery-UI loading method
1 parent c436ae0 commit 9624633

File tree

4 files changed

+114
-60
lines changed

4 files changed

+114
-60
lines changed

.jshintrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"curly": true,
3+
"eqnull": true,
4+
"eqeqeq": true,
5+
"expr": true,
6+
"latedef": true,
7+
"noarg": true,
8+
"smarttabs": true,
9+
"trailing": true,
10+
"undef": true
11+
}

grunt.js

Lines changed: 20 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*
66
*/
77

8+
/*jshint node: true */
89
/*global config:true, task:true, process:true*/
910
module.exports = function( grunt ) {
1011

@@ -14,8 +15,8 @@ module.exports = function( grunt ) {
1415
function readOptionalJSON( filepath ) {
1516
var data = {};
1617
try {
17-
data = grunt.file.readJSON(filepath);
18-
grunt.log.write( "Reading data from " + filepath + "..." ).ok();
18+
data = grunt.file.readJSON( filepath );
19+
grunt.verbose.write( "Reading " + filepath + "..." ).ok();
1920
} catch(e) {}
2021
return data;
2122
}
@@ -81,73 +82,32 @@ module.exports = function( grunt ) {
8182
min: {
8283
"dist/jquery.min.js": [ "<banner>", "dist/jquery.js" ]
8384
},
85+
8486
lint: {
85-
files: [ "test/unit/**/*.js", "grunt.js", "dist/jquery.js" ]
87+
dist: "dist/jquery.js",
88+
grunt: "grunt.js",
89+
tests: "tests/unit/**/*.js"
8690
},
91+
92+
jshint: (function() {
93+
function jshintrc( path ) {
94+
return readOptionalJSON( (path || "") + ".jshintrc" ) || {};
95+
}
96+
97+
return {
98+
options: jshintrc(),
99+
dist: jshintrc( "src/" ),
100+
tests: jshintrc( "test/" )
101+
};
102+
})(),
103+
87104
qunit: {
88105
files: "test/index.html"
89106
},
90107
watch: {
91108
files: [ "<config:lint.files>", "src/**/*.js" ],
92109
tasks: "dev"
93110
},
94-
jshint: {
95-
options: {
96-
evil: true,
97-
browser: true,
98-
wsh: true,
99-
eqnull: true,
100-
expr: true,
101-
curly: true,
102-
trailing: true,
103-
undef: true,
104-
smarttabs: true,
105-
maxerr: 100
106-
},
107-
globals: {
108-
define: true,
109-
DOMParser: true,
110-
__dirname: true,
111-
jQuery: true,
112-
global: true,
113-
module: true,
114-
exports: true,
115-
require: true,
116-
file: true,
117-
log: true,
118-
console: true,
119-
QUnit: true,
120-
ok: true,
121-
equal: true,
122-
test: true,
123-
asyncTest: true,
124-
notEqual: true,
125-
deepEqual: true,
126-
strictEqual: true,
127-
notStrictEqual: true,
128-
start: true,
129-
stop: true,
130-
expect: true,
131-
raises: true,
132-
testIframe: true,
133-
testIframeWithCallback: true,
134-
createDashboardXML: true,
135-
moduleTeardown: true,
136-
testFoo: true,
137-
foobar: true,
138-
url: true,
139-
t: true,
140-
q: true,
141-
amdDefined: true,
142-
fireNative: true,
143-
hasPHP: true,
144-
isLocal: true,
145-
originaljQuery: true,
146-
"$": true,
147-
"original$": true
148-
149-
}
150-
},
151111
uglify: {}
152112
});
153113

src/.jshintrc

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"options": {
3+
"evil": true,
4+
"browser": true,
5+
"wsh": true,
6+
"eqnull": true,
7+
"expr": true,
8+
"curly": true,
9+
"trailing": true,
10+
"undef": true,
11+
"smarttabs": true,
12+
"maxerr": 100
13+
},
14+
"globals": {
15+
"define": true,
16+
"DOMParser": true,
17+
"__dirname": true,
18+
"jQuery": true,
19+
"global": true,
20+
"module": true,
21+
"exports": true,
22+
"require": true,
23+
"file": true,
24+
"log": true,
25+
"console": true
26+
}
27+
}

test/.jshintrc

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

0 commit comments

Comments
 (0)