Skip to content

Commit 19ffb5c

Browse files
lib: fix eslint styles
PR-URL: #1539 Fixes: #1253 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com> Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
1 parent f9dd34d commit 19ffb5c

22 files changed

+45
-39
lines changed

lib/_debugger.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Protocol.prototype.execute = function(d) {
101101
if (len - this.bodyStartByteIndex < this.contentLength) {
102102
break;
103103
}
104-
// pass thru
104+
// falls through
105105
case 'body':
106106
var resRawByteLength = Buffer.byteLength(res.raw, 'utf8');
107107

@@ -125,7 +125,6 @@ Protocol.prototype.execute = function(d) {
125125

126126
default:
127127
throw new Error('Unknown state');
128-
break;
129128
}
130129
};
131130

@@ -262,7 +261,7 @@ Client.prototype.req = function(req, cb) {
262261

263262
Client.prototype.reqVersion = function(cb) {
264263
cb = cb || function() {};
265-
this.req({ command: 'version' } , function(err, body, res) {
264+
this.req({ command: 'version' }, function(err, body, res) {
266265
if (err) return cb(err);
267266
cb(null, res.body.body.V8Version, res.body.running);
268267
});
@@ -398,7 +397,7 @@ Client.prototype.reqFrameEval = function(expression, frame, cb) {
398397
// reqBacktrace(cb)
399398
// TODO: from, to, bottom
400399
Client.prototype.reqBacktrace = function(cb) {
401-
this.req({ command: 'backtrace', arguments: { inlineRefs: true } } , cb);
400+
this.req({ command: 'backtrace', arguments: { inlineRefs: true } }, cb);
402401
};
403402

404403

@@ -432,7 +431,7 @@ Client.prototype.reqScripts = function(cb) {
432431
var self = this;
433432
cb = cb || function() {};
434433

435-
this.req({ command: 'scripts' } , function(err, res) {
434+
this.req({ command: 'scripts' }, function(err, res) {
436435
if (err) return cb(err);
437436

438437
for (var i = 0; i < res.length; i++) {

lib/_http_incoming.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,10 @@ IncomingMessage.prototype._addHeaderLine = function(field, value, dest) {
137137
}
138138
break;
139139

140+
/* eslint-disable max-len */
140141
// list is taken from:
141142
// https://mxr.mozilla.org/mozilla/source/netwerk/protocol/http/src/nsHttpHeaderArray.cpp
143+
/* eslint-enable max-len */
142144
case 'content-type':
143145
case 'content-length':
144146
case 'user-agent':
@@ -158,9 +160,9 @@ IncomingMessage.prototype._addHeaderLine = function(field, value, dest) {
158160

159161
default:
160162
// make comma-separated list
161-
if (dest[field] !== undefined)
163+
if (dest[field] !== undefined) {
162164
dest[field] += ', ' + value;
163-
else {
165+
} else {
164166
dest[field] = value;
165167
}
166168
}

lib/_http_outgoing.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,9 @@ OutgoingMessage.prototype.setTimeout = function(msecs, callback) {
8585
this.once('socket', function(socket) {
8686
socket.setTimeout(msecs);
8787
});
88-
} else
88+
} else {
8989
this.socket.setTimeout(msecs);
90+
}
9091
};
9192

9293

lib/_http_server.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,11 @@ function Server(requestListener) {
221221
this.addListener('request', requestListener);
222222
}
223223

224+
/* eslint-disable max-len */
224225
// Similar option to this. Too lazy to write my own docs.
225226
// http://www.squid-cache.org/Doc/config/half_closed_clients/
226227
// http://wiki.squid-cache.org/SquidFaq/InnerWorkings#What_is_a_half-closed_filedescriptor.3F
228+
/* eslint-enable max-len */
227229
this.httpAllowHalfOpen = false;
228230

229231
this.addListener('connection', connectionListener);

lib/_stream_readable.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,9 @@ function howMuchToRead(n, state) {
234234
if (!state.ended) {
235235
state.needReadable = true;
236236
return 0;
237-
} else
237+
} else {
238238
return state.length;
239+
}
239240
}
240241

241242
return n;
@@ -774,7 +775,7 @@ Readable.prototype.wrap = function(stream) {
774775
if (this[i] === undefined && typeof stream[i] === 'function') {
775776
this[i] = function(method) { return function() {
776777
return stream[method].apply(stream, arguments);
777-
}}(i);
778+
}; }(i);
778779
}
779780
}
780781

lib/_stream_writable.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ Writable.WritableState = WritableState;
99

1010
const util = require('util');
1111
const Stream = require('stream');
12-
const debug = util.debuglog('stream');
1312

1413
util.inherits(Writable, Stream);
1514

@@ -273,9 +272,9 @@ function writeOrBuffer(stream, state, chunk, encoding, cb) {
273272
} else {
274273
state.bufferedRequest = state.lastBufferedRequest;
275274
}
276-
}
277-
else
275+
} else {
278276
doWrite(stream, state, false, len, chunk, encoding, cb);
277+
}
279278

280279
return ret;
281280
}
@@ -471,8 +470,9 @@ function finishMaybe(stream, state) {
471470
prefinish(stream, state);
472471
state.finished = true;
473472
stream.emit('finish');
474-
} else
473+
} else {
475474
prefinish(stream, state);
475+
}
476476
}
477477
return need;
478478
}

lib/_tls_legacy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ function onnewsession(key, session) {
646646

647647
if (self.ssl)
648648
self.ssl.newSessionDone();
649-
};
649+
}
650650
}
651651

652652

lib/assert.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,4 +323,4 @@ assert.doesNotThrow = function(block, /*optional*/message) {
323323
_throws.apply(this, [false].concat(pSlice.call(arguments)));
324324
};
325325

326-
assert.ifError = function(err) { if (err) {throw err;}};
326+
assert.ifError = function(err) { if (err) throw err; };

lib/child_process.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,15 +169,15 @@ SocketListSend.prototype._request = function(msg, cmd, callback) {
169169
function onclose() {
170170
self.slave.removeListener('internalMessage', onreply);
171171
callback(new Error('Slave closed before reply'));
172-
};
172+
}
173173

174174
function onreply(msg) {
175175
if (!(msg.cmd === cmd && msg.key === self.key)) return;
176176
self.slave.removeListener('disconnect', onclose);
177177
self.slave.removeListener('internalMessage', onreply);
178178

179179
callback(null, msg);
180-
};
180+
}
181181

182182
this.slave.once('disconnect', onclose);
183183
this.slave.on('internalMessage', onreply);

lib/cluster.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const SCHED_RR = 2;
1111

1212
const uv = process.binding('uv');
1313

14-
const cluster = new EventEmitter;
14+
const cluster = new EventEmitter();
1515
module.exports = cluster;
1616
cluster.Worker = Worker;
1717
cluster.isWorker = ('NODE_UNIQUE_ID' in process.env);
@@ -127,11 +127,10 @@ RoundRobinHandle.prototype.add = function(worker, send) {
127127
function done() {
128128
if (self.handle.getsockname) {
129129
var out = {};
130-
var err = self.handle.getsockname(out);
130+
self.handle.getsockname(out);
131131
// TODO(bnoordhuis) Check err.
132132
send(null, { sockname: out }, null);
133-
}
134-
else {
133+
} else {
135134
send(null, null, null); // UNIX socket.
136135
}
137136
self.handoff(worker); // In case there are connections pending.
@@ -196,7 +195,7 @@ else
196195
function masterInit() {
197196
cluster.workers = {};
198197

199-
var intercom = new EventEmitter;
198+
var intercom = new EventEmitter();
200199
cluster.settings = {};
201200

202201
// XXX(bnoordhuis) Fold cluster.schedulingPolicy into cluster.settings?

0 commit comments

Comments
 (0)