Skip to content

Commit 32d93f7

Browse files
committed
Merge pull request #483 from XhmikosR/indent
Clean up JSHint's rules and enable indent check
2 parents 8371ea9 + 28e78f6 commit 32d93f7

File tree

10 files changed

+47
-46
lines changed

10 files changed

+47
-46
lines changed

.jshintrc

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
{
22
"curly": true,
3+
"eqnull": true,
4+
"forin": true,
35
"immed": true,
6+
"indent": 4,
47
"latedef": true,
58
"newcap": true,
69
"noarg": true,
7-
"sub": true,
8-
"undef": true,
9-
"boss": true,
10-
"eqnull": true,
11-
"forin": true,
1210
"noempty": true,
13-
"rhino": false,
14-
"jquery": true,
11+
"nonbsp": true,
12+
"undef": true,
1513
"globals": {
16-
"CSSLint": true
14+
"CSSLint": true,
15+
"YUITest": true
1716
}
1817
}

src/formatters/checkstyle-xml.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
CSSLint.Util.forEach(messages, function (message, i) {
9595
//ignore rollups for now
9696
if (!message.rollup) {
97-
output.push("<error line=\"" + message.line + "\" column=\"" + message.col + "\" severity=\"" + message.type + "\"" +
97+
output.push("<error line=\"" + message.line + "\" column=\"" + message.col + "\" severity=\"" + message.type + "\"" +
9898
" message=\"" + xmlEscape(message.message) + "\" source=\"" + generateSource(message.rule) +"\"/>");
9999
}
100100
});

tests/all-rules.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
* When run in addition to the other tests, this causes the Rhino CLI test
88
* to fail due to Java stack overflow. This must be run separate from other tests.
99
*/
10+
11+
/*jshint loopfunc: true */
12+
1013
(function(){
11-
/*jshint loopfunc: true */
1214
/*global YUITest, CSSLint*/
1315
var Assert = YUITest.Assert,
1416
suite = new YUITest.TestSuite("General Tests for all Rules"),

tests/formatters/checkstyle-xml.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515

1616
"File with problems should list them": function(){
1717
var result = { messages: [
18-
{ type: "warning", line: 1, col: 1, message: "BOGUS", evidence: "ALSO BOGUS", rule: { name: "A Rule"} },
19-
{ type: "error", line: 2, col: 1, message: "BOGUS", evidence: "ALSO BOGUS", rule: { name: "Some Other Rule"} }
20-
], stats: [] },
18+
{ type: "warning", line: 1, col: 1, message: "BOGUS", evidence: "ALSO BOGUS", rule: { name: "A Rule"} },
19+
{ type: "error", line: 2, col: 1, message: "BOGUS", evidence: "ALSO BOGUS", rule: { name: "Some Other Rule"} }
20+
], stats: [] },
2121
file = "<file name=\"FILE\">",
2222
error1 = "<error line=\"1\" column=\"1\" severity=\"warning\" message=\"BOGUS\" source=\"net.csslint.ARule\"/>",
2323
error2 = "<error line=\"2\" column=\"1\" severity=\"error\" message=\"BOGUS\" source=\"net.csslint.SomeOtherRule\"/>",
@@ -29,9 +29,9 @@
2929
"Formatter should escape special characters": function() {
3030
var specialCharsSting = 'sneaky, "sneaky", <sneaky>, sneak & sneaky',
3131
result = { messages: [
32-
{ type: "warning", line: 1, col: 1, message: specialCharsSting, evidence: "ALSO BOGUS", rule: [] },
33-
{ type: "error", line: 2, col: 1, message: specialCharsSting, evidence: "ALSO BOGUS", rule: [] }
34-
], stats: [] },
32+
{ type: "warning", line: 1, col: 1, message: specialCharsSting, evidence: "ALSO BOGUS", rule: [] },
33+
{ type: "error", line: 2, col: 1, message: specialCharsSting, evidence: "ALSO BOGUS", rule: [] }
34+
], stats: [] },
3535
file = "<file name=\"FILE\">",
3636
error1 = "<error line=\"1\" column=\"1\" severity=\"warning\" message=\"sneaky, &quot;sneaky&quot;, &lt;sneaky&gt;, sneak &amp; sneaky\" source=\"\"/>",
3737
error2 = "<error line=\"2\" column=\"1\" severity=\"error\" message=\"sneaky, &quot;sneaky&quot;, &lt;sneaky&gt;, sneak &amp; sneaky\" source=\"\"/>",

tests/formatters/compact.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020

2121
"File with problems should list them": function() {
2222
var result = { messages: [
23-
{ type: 'error', line: 2, col: 1, message: 'BOGUS ERROR', evidence: 'BOGUS', rule: { id: 'BOGUS_RULE_ID' } },
24-
{ type: 'warning', line: 1, col: 1, message: 'BOGUS WARNING', evidence: 'BOGUS', rule: { id: 'BOGUS_RULE_ID' } }
25-
], stats: [] },
23+
{ type: 'error', line: 2, col: 1, message: 'BOGUS ERROR', evidence: 'BOGUS', rule: { id: 'BOGUS_RULE_ID' } },
24+
{ type: 'warning', line: 1, col: 1, message: 'BOGUS WARNING', evidence: 'BOGUS', rule: { id: 'BOGUS_RULE_ID' } }
25+
], stats: [] },
2626
err = "path/to/FILE: line 2, col 1, Error - BOGUS ERROR (BOGUS_RULE_ID)\n",
2727
warning = "path/to/FILE: line 1, col 1, Warning - BOGUS WARNING (BOGUS_RULE_ID)\n",
2828
expected = err + warning,
@@ -32,9 +32,9 @@
3232

3333
"Should output relative file paths": function() {
3434
var result = { messages: [
35-
{ type: 'error', line: 2, col: 1, message: 'BOGUS ERROR', evidence: 'BOGUS', rule: { id: 'BOGUS_RULE_ID' } },
36-
{ type: 'warning', line: 1, col: 1, message: 'BOGUS WARNING', evidence: 'BOGUS', rule: { id: 'BOGUS_RULE_ID' } }
37-
], stats: [] },
35+
{ type: 'error', line: 2, col: 1, message: 'BOGUS ERROR', evidence: 'BOGUS', rule: { id: 'BOGUS_RULE_ID' } },
36+
{ type: 'warning', line: 1, col: 1, message: 'BOGUS WARNING', evidence: 'BOGUS', rule: { id: 'BOGUS_RULE_ID' } }
37+
], stats: [] },
3838
err = "path/to/FILE: line 2, col 1, Error - BOGUS ERROR (BOGUS_RULE_ID)\n",
3939
warning = "path/to/FILE: line 1, col 1, Warning - BOGUS WARNING (BOGUS_RULE_ID)\n",
4040
expected = err + warning,

tests/formatters/csslint-xml.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414

1515
"File with problems should list them": function(){
1616
var result = { messages: [
17-
{ type: "warning", line: 1, col: 1, message: "BOGUS", evidence: "ALSO BOGUS", rule: [] },
18-
{ type: "error", line: 2, col: 1, message: "BOGUS", evidence: "ALSO BOGUS", rule: [] }
19-
], stats: [] },
17+
{ type: "warning", line: 1, col: 1, message: "BOGUS", evidence: "ALSO BOGUS", rule: [] },
18+
{ type: "error", line: 2, col: 1, message: "BOGUS", evidence: "ALSO BOGUS", rule: [] }
19+
], stats: [] },
2020
file = "<file name=\"FILE\">",
2121
error1 = "<issue line=\"1\" char=\"1\" severity=\"warning\" reason=\"BOGUS\" evidence=\"ALSO BOGUS\"/>",
2222
error2 = "<issue line=\"2\" char=\"1\" severity=\"error\" reason=\"BOGUS\" evidence=\"ALSO BOGUS\"/>",
@@ -28,9 +28,9 @@
2828
"Formatter should escape double quotes": function() {
2929
var doubleQuotedEvidence = 'sneaky, "sneaky", <sneaky>, sneak & sneaky',
3030
result = { messages: [
31-
{ type: "warning", line: 1, col: 1, message: "BOGUS", evidence: doubleQuotedEvidence, rule: [] },
32-
{ type: "error", line: 2, col: 1, message: "BOGUS", evidence: doubleQuotedEvidence, rule: [] }
33-
], stats: [] },
31+
{ type: "warning", line: 1, col: 1, message: "BOGUS", evidence: doubleQuotedEvidence, rule: [] },
32+
{ type: "error", line: 2, col: 1, message: "BOGUS", evidence: doubleQuotedEvidence, rule: [] }
33+
], stats: [] },
3434
file = "<file name=\"FILE\">",
3535
error1 = "<issue line=\"1\" char=\"1\" severity=\"warning\" reason=\"BOGUS\" evidence=\"sneaky, 'sneaky', &lt;sneaky&gt;, sneak &amp; sneaky\"/>",
3636
error2 = "<issue line=\"2\" char=\"1\" severity=\"error\" reason=\"BOGUS\" evidence=\"sneaky, 'sneaky', &lt;sneaky&gt;, sneak &amp; sneaky\"/>",

tests/formatters/junit-xml.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
"File with problems should list them": function(){
1919

2020
var result = { messages: [
21-
{ type: "warning", line: 1, col: 1, message: "BOGUS", evidence: "ALSO BOGUS", rule: { name: "A Rule"} },
22-
{ type: "error", line: 2, col: 1, message: "BOGUS", evidence: "ALSO BOGUS", rule: { name: "Some Other Rule"} }
23-
], stats: [] },
21+
{ type: "warning", line: 1, col: 1, message: "BOGUS", evidence: "ALSO BOGUS", rule: { name: "A Rule"} },
22+
{ type: "error", line: 2, col: 1, message: "BOGUS", evidence: "ALSO BOGUS", rule: { name: "Some Other Rule"} }
23+
], stats: [] },
2424

2525
file = "<testsuite time=\"0\" tests=\"2\" skipped=\"0\" errors=\"2\" failures=\"0\" package=\"net.csslint\" name=\"FILE\">",
2626
error1 = "<testcase time=\"0\" name=\"net.csslint.ARule\"><error message=\"BOGUS\"><![CDATA[1:1:ALSO BOGUS]]></error></testcase>",
@@ -36,9 +36,9 @@
3636

3737
var specialCharsSting = 'sneaky, "sneaky", <sneaky>',
3838
result = { messages: [
39-
{ type: "warning", line: 1, col: 1, message: specialCharsSting, evidence: "ALSO BOGUS", rule: [] },
40-
{ type: "error", line: 2, col: 1, message: specialCharsSting, evidence: "ALSO BOGUS", rule: [] }
41-
], stats: [] },
39+
{ type: "warning", line: 1, col: 1, message: specialCharsSting, evidence: "ALSO BOGUS", rule: [] },
40+
{ type: "error", line: 2, col: 1, message: specialCharsSting, evidence: "ALSO BOGUS", rule: [] }
41+
], stats: [] },
4242

4343
file = "<testsuite time=\"0\" tests=\"2\" skipped=\"0\" errors=\"2\" failures=\"0\" package=\"net.csslint\" name=\"FILE\">",
4444
error1 = "<testcase time=\"0\" name=\"\"><error message=\"sneaky, 'sneaky', &lt;sneaky&gt;\"><![CDATA[1:1:ALSO BOGUS]]></error></testcase>",

tests/formatters/lint-xml.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515

1616
"File with problems should list them": function(){
1717
var result = { messages: [
18-
{ type: "warning", line: 1, col: 1, message: "BOGUS", evidence: "ALSO BOGUS", rule: [] },
19-
{ type: "error", line: 2, col: 1, message: "BOGUS", evidence: "ALSO BOGUS", rule: [] }
20-
], stats: [] },
18+
{ type: "warning", line: 1, col: 1, message: "BOGUS", evidence: "ALSO BOGUS", rule: [] },
19+
{ type: "error", line: 2, col: 1, message: "BOGUS", evidence: "ALSO BOGUS", rule: [] }
20+
], stats: [] },
2121
file = "<file name=\"FILE\">",
2222
error1 = "<issue line=\"1\" char=\"1\" severity=\"warning\" reason=\"BOGUS\" evidence=\"ALSO BOGUS\"/>",
2323
error2 = "<issue line=\"2\" char=\"1\" severity=\"error\" reason=\"BOGUS\" evidence=\"ALSO BOGUS\"/>",
@@ -29,9 +29,9 @@
2929
"Formatter should escape double quotes": function() {
3030
var doubleQuotedEvidence = 'sneaky, "sneaky", <sneaky>, sneak & sneaky',
3131
result = { messages: [
32-
{ type: "warning", line: 1, col: 1, message: "BOGUS", evidence: doubleQuotedEvidence, rule: [] },
33-
{ type: "error", line: 2, col: 1, message: "BOGUS", evidence: doubleQuotedEvidence, rule: [] }
34-
], stats: [] },
32+
{ type: "warning", line: 1, col: 1, message: "BOGUS", evidence: doubleQuotedEvidence, rule: [] },
33+
{ type: "error", line: 2, col: 1, message: "BOGUS", evidence: doubleQuotedEvidence, rule: [] }
34+
], stats: [] },
3535
file = "<file name=\"FILE\">",
3636
error1 = "<issue line=\"1\" char=\"1\" severity=\"warning\" reason=\"BOGUS\" evidence=\"sneaky, 'sneaky', &lt;sneaky&gt;, sneak &amp; sneaky\"/>",
3737
error2 = "<issue line=\"2\" char=\"1\" severity=\"error\" reason=\"BOGUS\" evidence=\"sneaky, 'sneaky', &lt;sneaky&gt;, sneak &amp; sneaky\"/>",

tests/formatters/text.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131

3232
"File with problems should list them": function() {
3333
var result = { messages: [
34-
{ type: 'warning', line: 1, col: 1, message: 'BOGUS', evidence: 'ALSO BOGUS', rule: [] },
35-
{ type: 'error', line: 2, col: 1, message: 'BOGUS', evidence: 'ALSO BOGUS', rule: [] }
36-
], stats: [] },
34+
{ type: 'warning', line: 1, col: 1, message: 'BOGUS', evidence: 'ALSO BOGUS', rule: [] },
35+
{ type: 'error', line: 2, col: 1, message: 'BOGUS', evidence: 'ALSO BOGUS', rule: [] }
36+
], stats: [] },
3737
error1 = "\n1: warning at line 1, col 1\nBOGUS\nALSO BOGUS",
3838
error2 = "\n2: error at line 2, col 1\nBOGUS\nALSO BOGUS",
3939
expected = "\n\ncsslint: There are 2 problems in path/to/FILE.\n\nFILE" + error1 + "\n\nFILE" + error2,

tests/rules/box-model.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@
1919
Assert.areEqual(0, result.messages.length);
2020
},
2121

22-
"Using width:auto with padding should not result in a warning": function(){
22+
"Using width:auto with padding should not result in a warning": function(){
2323
var result = CSSLint.verify(".foo { width: auto; padding: 10px; }", { "box-model": 1 });
2424
Assert.areEqual(0, result.messages.length);
2525
},
2626

27-
"Using width:available with padding should not result in a warning": function(){
27+
"Using width:available with padding should not result in a warning": function(){
2828
var result = CSSLint.verify(".foo { width: available; padding: 10px; }", { "box-model": 1 });
2929
Assert.areEqual(0, result.messages.length);
3030
},
3131

32-
"Using height:auto with padding should not result in a warning": function(){
32+
"Using height:auto with padding should not result in a warning": function(){
3333
var result = CSSLint.verify(".foo { height: auto; padding: 10px; }", { "box-model": 1 });
3434
Assert.areEqual(0, result.messages.length);
3535
},

0 commit comments

Comments
 (0)