Skip to content

Commit a9de086

Browse files
committed
Minor style tweaks.
1 parent 6334170 commit a9de086

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+363
-344
lines changed

Gruntfile.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,18 @@ module.exports = function(grunt) {
3434
"THE SOFTWARE.\n\n" +
3535
"*/\n",
3636
build_dir: "dist",
37-
//Parser lib copy for versions that can't use requirejs
37+
// Parser lib copy for versions that can't use requirejs
3838
parserlib: "node_modules/parserlib/lib/node-parserlib.js",
39-
//clone copy for versions that can't use requirejs
39+
// clone copy for versions that can't use requirejs
4040
clone: "node_modules/clone/clone.js",
41-
//Core CSSLint files used by most versions
41+
// Core CSSLint files used by most versions
4242
csslint_files: [
4343
"src/core/CSSLint.js",
4444
"src/core/*.js",
4545
"src/rules/*.js",
4646
"src/formatters/*.js"
4747
],
48-
//Core fileset used by most versions
48+
// Core fileset used by most versions
4949
core_files: [
5050
"<%= parserlib %>",
5151
"<%= clone %>",
@@ -75,7 +75,7 @@ module.exports = function(grunt) {
7575
"<%= core_files %>"
7676
],
7777
dest: "<%= build_dir %>/csslint.js"
78-
},//Build environment workers
78+
}, // Build environment workers
7979
rhino: {
8080
src: [
8181
"<%= concat.core.dest %>",
@@ -91,8 +91,8 @@ module.exports = function(grunt) {
9191
"var parserlib = require('parserlib');\n",
9292
footer: "\nexports.CSSLint = CSSLint;"
9393
},
94-
src: "<%= csslint_files %>",
95-
dest: "<%= build_dir %>/csslint-node.js"
94+
src: "<%= csslint_files %>",
95+
dest: "<%= build_dir %>/csslint-node.js"
9696
},
9797
node_cli: {
9898
options: {
@@ -114,7 +114,7 @@ module.exports = function(grunt) {
114114
worker: {
115115
options: {
116116
banner: "<%= banner %>" +
117-
//Hack for using the node version of parserlib
117+
// Hack for using the node version of parserlib
118118
"var exports = exports || {};\n"
119119
},
120120
src: [
@@ -207,7 +207,7 @@ module.exports = function(grunt) {
207207
});
208208

209209
// Load any grunt plugins found in package.json.
210-
require("load-grunt-tasks")(grunt, {scope: "devDependencies"});
210+
require("load-grunt-tasks")(grunt, { scope: "devDependencies" });
211211
require("time-grunt")(grunt);
212212

213213
// Load custom tasks

demos/demo.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* jshint browser:true */
2+
23
(function() {
34
"use strict";
45

@@ -20,7 +21,7 @@
2021
document.getElementById("output").innerHTML = "";
2122
results = CSSLint.verify(document.getElementById("input").value);
2223
messages = results.messages;
23-
for (i=0, len=messages.length; i < len; i++) {
24+
for (i = 0, len = messages.length; i < len; i++) {
2425
log(messages[i].message + " (line " + messages[i].line + ", col " + messages[i].col + ")", messages[i].type);
2526
}
2627

src/cli/common.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ function cli(api) {
273273

274274
} else {
275275

276-
//see if it's a directory or a file
276+
// see if it's a directory or a file
277277
if (api.isDirectory(arg)) {
278278
files = files.concat(api.getFiles(arg));
279279
} else {
@@ -326,7 +326,7 @@ function cli(api) {
326326
}
327327
} catch (e) {}
328328
}
329-
args = data.replace(/\s+/g,"").split(/(?=--)/);
329+
args = data.replace(/\s+/g, "").split(/(?=--)/);
330330
options = processArguments(args);
331331
}
332332

@@ -337,7 +337,7 @@ function cli(api) {
337337
// Process command line
338338
//-----------------------------------------------------------------------------
339339

340-
var args = api.args,
340+
var args = api.args,
341341
argCount = args.length,
342342
options,
343343
rcOptions,

src/cli/wsh.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Windows Script Host Command Line Interface
33
*/
44

5-
//TODO: This file needs major cleanup!!!
5+
// TODO: This file needs major cleanup!!!
66

77
/* jshint wsh:true */
88
/* global cli */
@@ -23,7 +23,7 @@ var wshapi = (function() {
2323

2424
if (typeof Object.create !== "function") {
2525
Object.create = function(proto) {
26-
var Foo = function(){};
26+
var Foo = function() {};
2727
Foo.prototype = proto;
2828
return new Foo();
2929
};
@@ -94,10 +94,10 @@ var wshapi = (function() {
9494
};
9595
}
9696

97-
//https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map
97+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map
9898
if (!Array.prototype.map)
9999
{
100-
Array.prototype.map = function(fun /*, thisArg */ ) {
100+
Array.prototype.map = function(fun /*, thisArg */) {
101101

102102
if (this === void 0 || this === null) {
103103
throw new TypeError();

src/core/CSSLint.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ var CSSLint = (function() {
6262
len = rules.length;
6363

6464
while (i < len) {
65-
ruleset[rules[i++].id] = 1; //by default, everything is a warning
65+
ruleset[rules[i++].id] = 1; // by default, everything is a warning
6666
}
6767

6868
return ruleset;
@@ -193,7 +193,7 @@ var CSSLint = (function() {
193193
allowRuleset = {};
194194

195195
if (allowRules) {
196-
allowRules.toLowerCase().split(",").forEach(function(allowRule){
196+
allowRules.toLowerCase().split(",").forEach(function(allowRule) {
197197
allowRuleset[allowRule.trim()] = true;
198198
});
199199
if (Object.keys(allowRuleset).length > 0) {
@@ -206,22 +206,22 @@ var CSSLint = (function() {
206206
ignoreEnd = null;
207207
CSSLint.Util.forEach(lines, function (line, lineno) {
208208
// Keep oldest, "unclosest" ignore:start
209-
if(null === ignoreStart && line.match(/\/\*[ \t]*csslint[ \t]+ignore:start[ \t]*\*\//i)) {
209+
if (null === ignoreStart && line.match(/\/\*[ \t]*csslint[ \t]+ignore:start[ \t]*\*\//i)) {
210210
ignoreStart = lineno;
211211
}
212212

213-
if(line.match(/\/\*[ \t]*csslint[ \t]+ignore:end[ \t]*\*\//i)) {
213+
if (line.match(/\/\*[ \t]*csslint[ \t]+ignore:end[ \t]*\*\//i)) {
214214
ignoreEnd = lineno;
215215
}
216216

217-
if(null !== ignoreStart && null !== ignoreEnd) {
217+
if (null !== ignoreStart && null !== ignoreEnd) {
218218
ignore.push([ignoreStart, ignoreEnd]);
219219
ignoreStart = ignoreEnd = null;
220220
}
221221
});
222222

223223
// Close remaining ignore block, if any
224-
if(null !== ignoreStart) {
224+
if (null !== ignoreStart) {
225225
ignore.push([ignoreStart, lines.length]);
226226
}
227227

@@ -230,14 +230,14 @@ var CSSLint = (function() {
230230
}
231231

232232
if (embeddedRuleset.test(text)) {
233-
//defensively copy so that caller's version does not get modified
233+
// defensively copy so that caller's version does not get modified
234234
ruleset = clone(ruleset);
235235
ruleset = applyEmbeddedRuleset(text, ruleset);
236236
}
237237

238238
reporter = new Reporter(lines, ruleset, allow, ignore);
239239

240-
ruleset.errors = 2; //always report parsing errors as errors
240+
ruleset.errors = 2; // always report parsing errors as errors
241241
for (i in ruleset) {
242242
if (ruleset.hasOwnProperty(i) && ruleset[i]) {
243243
if (rules[i]) {
@@ -247,7 +247,7 @@ var CSSLint = (function() {
247247
}
248248

249249

250-
//capture most horrible error type
250+
// capture most horrible error type
251251
try {
252252
parser.parse(text);
253253
} catch (ex) {
@@ -262,7 +262,7 @@ var CSSLint = (function() {
262262
ignore : reporter.ignore
263263
};
264264

265-
//sort by line numbers, rollups at the bottom
265+
// sort by line numbers, rollups at the bottom
266266
report.messages.sort(function (a, b) {
267267
if (a.rollup && !b.rollup) {
268268
return 1;

src/core/Reporter.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function Reporter(lines, ruleset, allow, ignore) {
4848
* @type Object
4949
*/
5050
this.allow = allow;
51-
if(!this.allow) {
51+
if (!this.allow) {
5252
this.allow = {};
5353
}
5454

@@ -58,14 +58,14 @@ function Reporter(lines, ruleset, allow, ignore) {
5858
* @type [][]
5959
*/
6060
this.ignore = ignore;
61-
if(!this.ignore) {
61+
if (!this.ignore) {
6262
this.ignore = [];
6363
}
6464
}
6565

6666
Reporter.prototype = {
6767

68-
//restore constructor
68+
// restore constructor
6969
constructor: Reporter,
7070

7171
/**
@@ -120,11 +120,11 @@ Reporter.prototype = {
120120

121121
var ignore = false;
122122
CSSLint.Util.forEach(this.ignore, function (range) {
123-
if(range[0] <= line && line <= range[1]) {
123+
if (range[0] <= line && line <= range[1]) {
124124
ignore = true;
125125
}
126126
});
127-
if(ignore) {
127+
if (ignore) {
128128
return;
129129
}
130130

@@ -202,5 +202,5 @@ Reporter.prototype = {
202202
}
203203
};
204204

205-
//expose for testing purposes
205+
// expose for testing purposes
206206
CSSLint._Reporter = Reporter;

src/formatters/checkstyle-xml.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
};
3434

3535
CSSLint.addFormatter({
36-
//format information
36+
// format information
3737
id: "checkstyle-xml",
3838
name: "Checkstyle XML format",
3939

@@ -93,7 +93,7 @@
9393
if (messages.length > 0) {
9494
output.push("<file name=\""+filename+"\">");
9595
CSSLint.Util.forEach(messages, function (message) {
96-
//ignore rollups for now
96+
// ignore rollups for now
9797
if (!message.rollup) {
9898
output.push("<error line=\"" + message.line + "\" column=\"" + message.col + "\" severity=\"" + message.type + "\"" +
9999
" message=\"" + xmlEscape(message.message) + "\" source=\"" + generateSource(message.rule) +"\"/>");

src/formatters/compact.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CSSLint.addFormatter({
2-
//format information
2+
// format information
33
id: "compact",
44
name: "Compact, 'porcelain' format",
55

src/formatters/csslint-xml.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CSSLint.addFormatter({
2-
//format information
2+
// format information
33
id: "csslint-xml",
44
name: "CSSLint XML format",
55

src/formatters/json.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* globals JSON: true */
22

33
CSSLint.addFormatter({
4-
//format information
4+
// format information
55
id: "json",
66
name: "JSON",
77

src/formatters/junit-xml.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CSSLint.addFormatter({
2-
//format information
2+
// format information
33
id: "junit-xml",
44
name: "JUNIT XML format",
55

@@ -81,13 +81,13 @@ CSSLint.addFormatter({
8181
// all issues as errors
8282
var type = message.type === "warning" ? "error" : message.type;
8383

84-
//ignore rollups for now
84+
// ignore rollups for now
8585
if (!message.rollup) {
8686

8787
// build the test case separately, once joined
8888
// we'll add it to a custom array filtered by type
8989
output.push("<testcase time=\"0\" name=\"" + generateSource(message.rule) + "\">");
90-
output.push("<" + type + " message=\"" + escapeSpecialCharacters(message.message) + "\"><![CDATA[" + message.line + ":" + message.col + ":" + escapeSpecialCharacters(message.evidence) + "]]></" + type + ">");
90+
output.push("<" + type + " message=\"" + escapeSpecialCharacters(message.message) + "\"><![CDATA[" + message.line + ":" + message.col + ":" + escapeSpecialCharacters(message.evidence) + "]]></" + type + ">");
9191
output.push("</testcase>");
9292

9393
tests[type] += 1;

src/formatters/lint-xml.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CSSLint.addFormatter({
2-
//format information
2+
// format information
33
id: "lint-xml",
44
name: "Lint XML format",
55

src/formatters/text.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CSSLint.addFormatter({
2-
//format information
2+
// format information
33
id: "text",
44
name: "Plain Text",
55

@@ -42,7 +42,7 @@ CSSLint.addFormatter({
4242
if (messages.length === 1) {
4343
output += "is 1 problem";
4444
} else {
45-
output += "are " + messages.length + " problems";
45+
output += "are " + messages.length + " problems";
4646
}
4747
output += " in " + filename + ".";
4848

src/rules/adjoining-classes.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
CSSLint.addRule({
66

7-
//rule information
7+
// rule information
88
id: "adjoining-classes",
99
name: "Disallow adjoining classes",
1010
desc: "Don't use adjoining classes.",
1111
url: "https://github.com/CSSLint/csslint/wiki/Disallow-adjoining-classes",
1212
browsers: "IE6",
1313

14-
//initialization
14+
// initialization
1515
init: function(parser, reporter) {
1616
"use strict";
1717
var rule = this;

src/rules/box-model.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
*/
44
CSSLint.addRule({
55

6-
//rule information
6+
// rule information
77
id: "box-model",
88
name: "Beware of broken box size",
99
desc: "Don't use width or height when using padding or border.",
1010
url: "https://github.com/CSSLint/csslint/wiki/Beware-of-box-model-size",
1111
browsers: "All",
1212

13-
//initialization
13+
// initialization
1414
init: function(parser, reporter) {
1515
"use strict";
1616
var rule = this,
@@ -46,7 +46,7 @@ CSSLint.addRule({
4646
for (prop in heightProperties) {
4747
if (heightProperties.hasOwnProperty(prop) && properties[prop]) {
4848
value = properties[prop].value;
49-
//special case for padding
49+
// special case for padding
5050
if (!(prop === "padding" && value.parts.length === 2 && value.parts[0].value === 0)) {
5151
reporter.report("Using height with " + prop + " can sometimes make elements larger than you expect.", properties[prop].line, properties[prop].col, rule);
5252
}

0 commit comments

Comments
 (0)