Skip to content

Commit 0263b2d

Browse files
committed
Lint tweaks.
1 parent d3ee894 commit 0263b2d

23 files changed

+1034
-982
lines changed

scripts/build.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ function buildTests(filename) {
129129
return new Promise(function(resolve, reject) {
130130
var bundle = browserify();
131131
tests.forEach(function(f, i) {
132-
bundle.require(f, { expose: "test"+i });
132+
bundle.require(f, { expose: "test" + i });
133133
});
134134
bundle.exclude("yuitest");
135135
bundle.exclude(path.join(srcDir, "index.js"));
@@ -150,7 +150,7 @@ function buildTests(filename) {
150150
"};",
151151
src
152152
].concat(tests.map(function(f, i) {
153-
return "require('test"+i+"');";
153+
return "require('test" + i + "');";
154154
})).concat([
155155
"})();"
156156
]);

src/css/Colors.js

Lines changed: 182 additions & 182 deletions
Large diffs are not rendered by default.

src/css/Combinator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function Combinator(text, line, col) {
2727
*/
2828
this.type = "unknown";
2929

30-
//pretty simple
30+
// pretty simple
3131
if (/^\s+$/.test(text)) {
3232
this.type = "descendant";
3333
} else if (text === ">") {

src/css/Matcher.js

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Matcher.parse = function(str) {
4646
var result = reader.readMatch(matcher);
4747
if (result === null) {
4848
throw new SyntaxError(
49-
"Expected "+matcher, reader.getLine(), reader.getCol());
49+
"Expected " + matcher, reader.getLine(), reader.getCol());
5050
}
5151
return result;
5252
};
@@ -98,7 +98,7 @@ Matcher.parse = function(str) {
9898
eat(/^\s*,\s*/);
9999
var max = eat(/^\d+/);
100100
eat(/^\s*\}/);
101-
return m.braces(+min, +max);
101+
return m.braces(Number(min), Number(max));
102102
}
103103
return m;
104104
};
@@ -241,7 +241,7 @@ Matcher.many = function(required) {
241241
seen[i] = true;
242242
// Increase matchCount iff this was a required element
243243
// (or if all the elements are optional)
244-
if (tryMatch(matchCount + ((required === false || required[i]) ? 1 : 0))) {
244+
if (tryMatch(matchCount + (required === false || required[i] ? 1 : 0))) {
245245
expression.drop();
246246
return true;
247247
}
@@ -314,19 +314,39 @@ Matcher.oror = function() {
314314
Matcher.prototype = {
315315
constructor: Matcher,
316316
// These are expected to be overridden in every instance.
317-
match: function() { throw new Error("unimplemented"); },
318-
toString: function() { throw new Error("unimplemented"); },
317+
match: function() {
318+
throw new Error("unimplemented");
319+
},
320+
toString: function() {
321+
throw new Error("unimplemented");
322+
},
319323
// This returns a standalone function to do the matching.
320-
func: function() { return this.match.bind(this); },
324+
func: function() {
325+
return this.match.bind(this);
326+
},
321327
// Basic combinators
322-
then: function(m) { return Matcher.seq(this, m); },
323-
or: function(m) { return Matcher.alt(this, m); },
324-
andand: function(m) { return Matcher.many(true, this, m); },
325-
oror: function(m) { return Matcher.many(false, this, m); },
328+
then: function(m) {
329+
return Matcher.seq(this, m);
330+
},
331+
or: function(m) {
332+
return Matcher.alt(this, m);
333+
},
334+
andand: function(m) {
335+
return Matcher.many(true, this, m);
336+
},
337+
oror: function(m) {
338+
return Matcher.many(false, this, m);
339+
},
326340
// Component value multipliers
327-
star: function() { return this.braces(0, Infinity, "*"); },
328-
plus: function() { return this.braces(1, Infinity, "+"); },
329-
question: function() { return this.braces(0, 1, "?"); },
341+
star: function() {
342+
return this.braces(0, Infinity, "*");
343+
},
344+
plus: function() {
345+
return this.braces(1, Infinity, "+");
346+
},
347+
question: function() {
348+
return this.braces(0, 1, "?");
349+
},
330350
hash: function() {
331351
return this.braces(1, Infinity, "#", Matcher.cast(","));
332352
},

src/css/MediaQuery.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var Parser = require("./Parser");
2020
*/
2121
function MediaQuery(modifier, mediaType, features, line, col) {
2222

23-
SyntaxUnit.call(this, (modifier ? modifier + " ": "") + (mediaType ? mediaType : "") + (mediaType && features.length > 0 ? " and " : "") + features.join(" and "), line, col, Parser.MEDIA_QUERY_TYPE);
23+
SyntaxUnit.call(this, (modifier ? modifier + " " : "") + (mediaType ? mediaType : "") + (mediaType && features.length > 0 ? " and " : "") + features.join(" and "), line, col, Parser.MEDIA_QUERY_TYPE);
2424

2525
/**
2626
* The media modifier ("not" or "only")

0 commit comments

Comments
 (0)