Skip to content

Commit 652f50a

Browse files
committed
Add extra eslint rules
1 parent d178fbf commit 652f50a

File tree

5 files changed

+15
-12
lines changed

5 files changed

+15
-12
lines changed

.eslintrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"rules": {
77
"indent": [2, "tab", { "SwitchCase": 1 }],
88
"brace-style": ["error", "1tbs"],
9+
"quotes": ["error", "double"],
910
"semi": "error",
1011
"no-eval": "error",
1112
"eol-last": "error",
@@ -23,6 +24,8 @@
2324
"no-unused-vars": "error",
2425
"no-dupe-keys": "error",
2526
"valid-typeof": "error",
27+
"object-curly-spacing": ["error", "always"],
28+
"key-spacing": "error",
2629
"space-infix-ops": "error",
2730
"no-negated-in-lhs": "error",
2831
"no-octal": "error",

middleware.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ module.exports = function(compiler, options) {
5656
if(typeof options.log !== "function") options.log = console.log.bind(console);
5757
if(typeof options.warn !== "function") options.warn = console.warn.bind(console);
5858
if(typeof compiler.outputPath === "string" && compiler.outputPath.lastIndexOf("/", 0) !== 0) {
59-
throw new Error('`output.path` needs to be an absolute path or "/".');
59+
throw new Error("`output.path` needs to be an absolute path or `/`.");
6060
}
6161

6262
// store our files in memory
@@ -160,13 +160,13 @@ module.exports = function(compiler, options) {
160160
}
161161

162162
function handleRangeHeaders(content, req, res) {
163-
res.setHeader('Accept-Ranges', 'bytes');
163+
res.setHeader("Accept-Ranges", "bytes");
164164
if(req.headers.range) {
165165
var ranges = parseRange(content.length, req.headers.range);
166166

167167
// unsatisfiable
168168
if(-1 == ranges) {
169-
res.setHeader('Content-Range', 'bytes */' + content.length);
169+
res.setHeader("Content-Range", "bytes */" + content.length);
170170
res.statusCode = 416;
171171
}
172172

@@ -176,8 +176,8 @@ module.exports = function(compiler, options) {
176176
res.statusCode = 206;
177177
var length = content.length;
178178
res.setHeader(
179-
'Content-Range',
180-
'bytes ' + ranges[0].start + '-' + ranges[0].end + '/' + length
179+
"Content-Range",
180+
"bytes " + ranges[0].start + "-" + ranges[0].end + "/" + length
181181
);
182182

183183
content = content.slice(ranges[0].start, ranges[0].end + 1);
@@ -196,7 +196,7 @@ module.exports = function(compiler, options) {
196196
}, req);
197197
}
198198

199-
if(req.method !== 'GET') {
199+
if(req.method !== "GET") {
200200
return goNext();
201201
}
202202

test/API.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ describe("Advanced API", function() {
5151
if(doneCalled) {
5252
done();
5353
} else {
54-
done(new Error('`waitUntilValid` called before bundle was done'));
54+
done(new Error("`waitUntilValid` called before bundle was done"));
5555
}
5656
});
5757
setTimeout(function() {
@@ -83,7 +83,7 @@ describe("Advanced API", function() {
8383
plugins.done(doneStats);
8484
setTimeout(function() {
8585
instance.waitUntilValid(function(stats) {
86-
should(stats).have.keys('hasErrors', 'hasWarnings');
86+
should(stats).have.keys("hasErrors", "hasWarnings");
8787
done();
8888
});
8989
});
@@ -104,7 +104,7 @@ describe("Advanced API", function() {
104104
should.strictEqual(invalidationCount, 1);
105105
done();
106106
} else {
107-
done(new Error('`invalid` called before bundle was done'));
107+
done(new Error("`invalid` called before bundle was done"));
108108
}
109109
});
110110
setTimeout(function() {

test/Reporter.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var fs = require("fs");
44
var path = require("path");
55
require("mocha-sinon");
66

7-
var extendedStats = fs.readFileSync(path.join(__dirname, 'fixtures', 'stats.txt'), 'utf8');
7+
var extendedStats = fs.readFileSync(path.join(__dirname, "fixtures", "stats.txt"), "utf8");
88

99
var simpleStats = {
1010
hasErrors: function() {
@@ -29,7 +29,7 @@ describe("Reporter", function() {
2929
};
3030
beforeEach(function() {
3131
plugins = {};
32-
this.sinon.stub(console, 'log');
32+
this.sinon.stub(console, "log");
3333
});
3434

3535
describe("valid/invalid messages", function() {

test/Server.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe("Server", function() {
1212
var app;
1313

1414
function listenShorthand(done) {
15-
return app.listen(8000, '127.0.0.1', function(err) {
15+
return app.listen(8000, "127.0.0.1", function(err) {
1616
if(err) done(err);
1717
done();
1818
});

0 commit comments

Comments
 (0)