Skip to content

Commit 2701b88

Browse files
committed
Tweak JSHint options.
1 parent 575031d commit 2701b88

File tree

12 files changed

+81
-70
lines changed

12 files changed

+81
-70
lines changed

.jshintrc

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"camelcase": true,
33
"curly": true,
44
"eqeqeq": true,
5+
"es3": true,
56
"forin": true,
67
"immed": true,
78
"indent": 4,
@@ -15,7 +16,6 @@
1516
"undef": true,
1617
"unused": true,
1718
"globals": {
18-
"CSSLint": true,
19-
"YUITest": true
19+
"CSSLint": true
2020
}
21-
}
21+
}

Gruntfile.js

+3
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,9 @@ module.exports = function(grunt) {
166166
src: "demos/*.js"
167167
},
168168
tests: {
169+
options: {
170+
jshintrc: "tests/.jshintrc"
171+
},
169172
src: "tests/**/*.js"
170173
}
171174
},

src/cli/common.js

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* provides environment-specific functionality.
44
*/
55

6+
/* global JSON */
67
/* exported cli */
78

89
function cli(api){

src/worker/Worker.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
/*
22
* Web worker for CSSLint
33
*/
4-
/*global self, JSON*/
4+
5+
/* global self, JSON */
6+
57
//message indicates to start linting
68
self.onmessage = function(event){
79
"use strict";

tasks/changelog.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* jshint node:true */
2+
"use strict";
3+
24
module.exports = function( grunt ) {
3-
"use strict";
45
grunt.registerMultiTask("changelog", "Write the changelog file", function() {
56
var done = this.async();
67
var lastTag;

tasks/test_rhino.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* jshint node:true */
2+
"use strict";
3+
24
module.exports = function( grunt ) {
3-
"use strict";
45
// Run test suite through rhino
56
grunt.registerMultiTask("test_rhino", "Run the test suite through rhino", function() {
67
var done = this.async();

tasks/yuitest.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* jshint evil:true, node:true */
2+
"use strict";
3+
24
module.exports = function( grunt ) {
3-
"use strict";
45
grunt.registerMultiTask("yuitest", "Run the YUITests for the project", function() {
56

67
var YUITest = require("yuitest");

tests/.jshintrc

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends" : "../.jshintrc",
3+
"globals": {
4+
"YUITest": true
5+
}
6+
}

tests/all-rules.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
* to fail due to Java stack overflow. This must be run separate from other tests.
99
*/
1010

11-
/*jshint loopfunc: true */
11+
/* jshint loopfunc:true */
1212

1313
(function(){
1414
"use strict";
1515
var Assert = YUITest.Assert,
16-
suite = new YUITest.TestSuite("General Tests for all Rules"),
17-
rules = CSSLint.getRules(),
18-
len = rules.length,
16+
suite = new YUITest.TestSuite("General Tests for all Rules"),
17+
rules = CSSLint.getRules(),
18+
len = rules.length,
1919
i;
2020

2121
for (i=0; i < len; i++){
@@ -65,3 +65,4 @@
6565
YUITest.TestRunner.add(suite);
6666

6767
})();
68+

tests/cli/assets/apiStub.js

+43-47
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,54 @@
1-
/*jshint node:true*/
1+
/* jshint node:true */
22
"use strict";
3-
var
4-
stub = {
5-
logbook: function (log) {
6-
this.logs.push(log);
7-
},
8-
readLogs: function () {
9-
return this.logs.slice();
10-
},
113

12-
getFullPath: function (path) {
13-
return path;
14-
},
15-
getFiles: function (dir) {
16-
var
17-
filesobj = this.fakedFs[dir],
18-
fileix,
19-
out = [];
20-
for (fileix in filesobj) {
21-
if ( filesobj.hasOwnProperty(fileix) && /\.css$/.test(fileix) ) {
22-
out.push(dir + "/" + fileix);
23-
}
24-
}
25-
return out;
26-
},
27-
readFile: function (path) {
28-
var
29-
spath = path.split("/"),
30-
spathLen = spath.length,
31-
i,
32-
out = this.fakedFs;
4+
var stub = {
5+
logbook: function (log) {
6+
this.logs.push(log);
7+
},
8+
readLogs: function () {
9+
return this.logs.slice();
10+
},
3311

34-
for (i = 0; i < spathLen; i += 1) {
35-
out = out[spath[i]];
12+
getFullPath: function (path) {
13+
return path;
14+
},
15+
getFiles: function (dir) {
16+
var filesobj = this.fakedFs[dir],
17+
fileix,
18+
out = [];
19+
for (fileix in filesobj) {
20+
if (filesobj.hasOwnProperty(fileix) && /\.css$/.test(fileix)) {
21+
out.push(dir + "/" + fileix);
3622
}
23+
}
24+
return out;
25+
},
26+
readFile: function (path) {
27+
var spath = path.split("/"),
28+
spathLen = spath.length,
29+
i,
30+
out = this.fakedFs;
3731

38-
return out;
39-
},
40-
isDirectory: function (checkit) {
41-
var
42-
result = this.fakedFs[checkit];
43-
return typeof result === "object";
44-
},
45-
print: function (msg) {
46-
this.logbook(msg);
47-
},
48-
quit: function (signal) {
49-
this.logbook(signal);
32+
for (i = 0; i < spathLen; i += 1) {
33+
out = out[spath[i]];
5034
}
51-
};
35+
36+
return out;
37+
},
38+
isDirectory: function (checkit) {
39+
var result = this.fakedFs[checkit];
40+
return typeof result === "object";
41+
},
42+
print: function (msg) {
43+
this.logbook(msg);
44+
},
45+
quit: function (signal) {
46+
this.logbook(signal);
47+
}
48+
};
5249

5350
module.exports = function (setup) {
54-
var
55-
api,
51+
var api,
5652
setix;
5753

5854
api = Object.create(stub);

tests/cli/assets/data.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
/*jshint node:true*/
1+
/* jshint node:true */
2+
23
module.exports = {
34
"suites": {
45
"config csslintrc override": {
@@ -53,6 +54,6 @@ module.exports = {
5354
"dir": {
5455
"a.css": ".a {color: red!important;}",
5556
"b.css": "#a {color: red;}"
56-
},
57+
}
5758
}
5859
};

tests/cli/cli-common.js

+8-10
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
/*jshint loopfunc:true, node:true */
1+
/* jshint loopfunc:true, node:true */
2+
23
"use strict";
34
function include(path, sandbox) {
4-
var
5-
vm = require("vm"),
5+
var vm = require("vm"),
66
fs = require("fs"),
77
file;
88

@@ -11,14 +11,13 @@ function include(path, sandbox) {
1111
}
1212

1313

14+
(function() {
1415

15-
(function(){
16-
17-
var Assert = YUITest.Assert,
16+
var Assert = YUITest.Assert,
1817
suite = new YUITest.TestSuite("General Tests for CLI"),
1918
apiStub = require("../tests/cli/assets/apiStub.js"),
20-
data = require("../tests/cli/assets/data.js"),
21-
suites = data.suites,
19+
data = require("../tests/cli/assets/data.js"),
20+
suites = data.suites,
2221
suiteix,
2322
sandbox = {
2423
CSSLint: CSSLint
@@ -35,8 +34,7 @@ function include(path, sandbox) {
3534
name: "Test " + suiteix,
3635

3736
"Outcome logs should match expected": function (){
38-
var
39-
it = suites[suiteix],
37+
var it = suites[suiteix],
4038
expecting = it.expecting,
4139
expectingLen = expecting.length,
4240
outcome,

0 commit comments

Comments
 (0)