summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/_debugger.js9
-rw-r--r--lib/_http_incoming.js6
-rw-r--r--lib/_http_outgoing.js3
-rw-r--r--lib/_http_server.js2
-rw-r--r--lib/_stream_readable.js5
-rw-r--r--lib/_stream_writable.js8
-rw-r--r--lib/_tls_legacy.js2
-rw-r--r--lib/assert.js2
-rw-r--r--lib/child_process.js4
-rw-r--r--lib/cluster.js9
-rw-r--r--lib/console.js2
-rw-r--r--lib/crypto.js2
-rw-r--r--lib/dgram.js7
-rw-r--r--lib/dns.js2
-rw-r--r--lib/events.js3
-rw-r--r--lib/fs.js2
-rw-r--r--lib/net.js4
-rw-r--r--lib/querystring.js2
-rw-r--r--lib/repl.js2
-rw-r--r--lib/url.js2
-rw-r--r--lib/util.js1
-rw-r--r--src/node.js5
22 files changed, 45 insertions, 39 deletions
diff --git a/lib/_debugger.js b/lib/_debugger.js
index f1885b2e32..4c503d2f54 100644
--- a/lib/_debugger.js
+++ b/lib/_debugger.js
@@ -101,7 +101,7 @@ Protocol.prototype.execute = function(d) {
if (len - this.bodyStartByteIndex < this.contentLength) {
break;
}
- // pass thru
+ // falls through
case 'body':
var resRawByteLength = Buffer.byteLength(res.raw, 'utf8');
@@ -125,7 +125,6 @@ Protocol.prototype.execute = function(d) {
default:
throw new Error('Unknown state');
- break;
}
};
@@ -262,7 +261,7 @@ Client.prototype.req = function(req, cb) {
Client.prototype.reqVersion = function(cb) {
cb = cb || function() {};
- this.req({ command: 'version' } , function(err, body, res) {
+ this.req({ command: 'version' }, function(err, body, res) {
if (err) return cb(err);
cb(null, res.body.body.V8Version, res.body.running);
});
@@ -398,7 +397,7 @@ Client.prototype.reqFrameEval = function(expression, frame, cb) {
// reqBacktrace(cb)
// TODO: from, to, bottom
Client.prototype.reqBacktrace = function(cb) {
- this.req({ command: 'backtrace', arguments: { inlineRefs: true } } , cb);
+ this.req({ command: 'backtrace', arguments: { inlineRefs: true } }, cb);
};
@@ -432,7 +431,7 @@ Client.prototype.reqScripts = function(cb) {
var self = this;
cb = cb || function() {};
- this.req({ command: 'scripts' } , function(err, res) {
+ this.req({ command: 'scripts' }, function(err, res) {
if (err) return cb(err);
for (var i = 0; i < res.length; i++) {
diff --git a/lib/_http_incoming.js b/lib/_http_incoming.js
index 41ece371cd..aea665e809 100644
--- a/lib/_http_incoming.js
+++ b/lib/_http_incoming.js
@@ -137,8 +137,10 @@ IncomingMessage.prototype._addHeaderLine = function(field, value, dest) {
}
break;
+ /* eslint-disable max-len */
// list is taken from:
// https://mxr.mozilla.org/mozilla/source/netwerk/protocol/http/src/nsHttpHeaderArray.cpp
+ /* eslint-enable max-len */
case 'content-type':
case 'content-length':
case 'user-agent':
@@ -158,9 +160,9 @@ IncomingMessage.prototype._addHeaderLine = function(field, value, dest) {
default:
// make comma-separated list
- if (dest[field] !== undefined)
+ if (dest[field] !== undefined) {
dest[field] += ', ' + value;
- else {
+ } else {
dest[field] = value;
}
}
diff --git a/lib/_http_outgoing.js b/lib/_http_outgoing.js
index 88590551c9..bfebef21b6 100644
--- a/lib/_http_outgoing.js
+++ b/lib/_http_outgoing.js
@@ -85,8 +85,9 @@ OutgoingMessage.prototype.setTimeout = function(msecs, callback) {
this.once('socket', function(socket) {
socket.setTimeout(msecs);
});
- } else
+ } else {
this.socket.setTimeout(msecs);
+ }
};
diff --git a/lib/_http_server.js b/lib/_http_server.js
index 99903024c2..ae2bba035c 100644
--- a/lib/_http_server.js
+++ b/lib/_http_server.js
@@ -221,9 +221,11 @@ function Server(requestListener) {
this.addListener('request', requestListener);
}
+ /* eslint-disable max-len */
// Similar option to this. Too lazy to write my own docs.
// http://www.squid-cache.org/Doc/config/half_closed_clients/
// http://wiki.squid-cache.org/SquidFaq/InnerWorkings#What_is_a_half-closed_filedescriptor.3F
+ /* eslint-enable max-len */
this.httpAllowHalfOpen = false;
this.addListener('connection', connectionListener);
diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js
index 1de5559712..bebbc80e2b 100644
--- a/lib/_stream_readable.js
+++ b/lib/_stream_readable.js
@@ -234,8 +234,9 @@ function howMuchToRead(n, state) {
if (!state.ended) {
state.needReadable = true;
return 0;
- } else
+ } else {
return state.length;
+ }
}
return n;
@@ -774,7 +775,7 @@ Readable.prototype.wrap = function(stream) {
if (this[i] === undefined && typeof stream[i] === 'function') {
this[i] = function(method) { return function() {
return stream[method].apply(stream, arguments);
- }}(i);
+ }; }(i);
}
}
diff --git a/lib/_stream_writable.js b/lib/_stream_writable.js
index da65ddb90a..54f751abdf 100644
--- a/lib/_stream_writable.js
+++ b/lib/_stream_writable.js
@@ -9,7 +9,6 @@ Writable.WritableState = WritableState;
const util = require('util');
const Stream = require('stream');
-const debug = util.debuglog('stream');
util.inherits(Writable, Stream);
@@ -273,9 +272,9 @@ function writeOrBuffer(stream, state, chunk, encoding, cb) {
} else {
state.bufferedRequest = state.lastBufferedRequest;
}
- }
- else
+ } else {
doWrite(stream, state, false, len, chunk, encoding, cb);
+ }
return ret;
}
@@ -471,8 +470,9 @@ function finishMaybe(stream, state) {
prefinish(stream, state);
state.finished = true;
stream.emit('finish');
- } else
+ } else {
prefinish(stream, state);
+ }
}
return need;
}
diff --git a/lib/_tls_legacy.js b/lib/_tls_legacy.js
index 3348d7f92d..0a0c7bca7b 100644
--- a/lib/_tls_legacy.js
+++ b/lib/_tls_legacy.js
@@ -646,7 +646,7 @@ function onnewsession(key, session) {
if (self.ssl)
self.ssl.newSessionDone();
- };
+ }
}
diff --git a/lib/assert.js b/lib/assert.js
index 4a01e5c7f0..70e784a50c 100644
--- a/lib/assert.js
+++ b/lib/assert.js
@@ -323,4 +323,4 @@ assert.doesNotThrow = function(block, /*optional*/message) {
_throws.apply(this, [false].concat(pSlice.call(arguments)));
};
-assert.ifError = function(err) { if (err) {throw err;}};
+assert.ifError = function(err) { if (err) throw err; };
diff --git a/lib/child_process.js b/lib/child_process.js
index 99da7cfbde..34ce359f5b 100644
--- a/lib/child_process.js
+++ b/lib/child_process.js
@@ -169,7 +169,7 @@ SocketListSend.prototype._request = function(msg, cmd, callback) {
function onclose() {
self.slave.removeListener('internalMessage', onreply);
callback(new Error('Slave closed before reply'));
- };
+ }
function onreply(msg) {
if (!(msg.cmd === cmd && msg.key === self.key)) return;
@@ -177,7 +177,7 @@ SocketListSend.prototype._request = function(msg, cmd, callback) {
self.slave.removeListener('internalMessage', onreply);
callback(null, msg);
- };
+ }
this.slave.once('disconnect', onclose);
this.slave.on('internalMessage', onreply);
diff --git a/lib/cluster.js b/lib/cluster.js
index 9a7900bc92..ca1005b738 100644
--- a/lib/cluster.js
+++ b/lib/cluster.js
@@ -11,7 +11,7 @@ const SCHED_RR = 2;
const uv = process.binding('uv');
-const cluster = new EventEmitter;
+const cluster = new EventEmitter();
module.exports = cluster;
cluster.Worker = Worker;
cluster.isWorker = ('NODE_UNIQUE_ID' in process.env);
@@ -127,11 +127,10 @@ RoundRobinHandle.prototype.add = function(worker, send) {
function done() {
if (self.handle.getsockname) {
var out = {};
- var err = self.handle.getsockname(out);
+ self.handle.getsockname(out);
// TODO(bnoordhuis) Check err.
send(null, { sockname: out }, null);
- }
- else {
+ } else {
send(null, null, null); // UNIX socket.
}
self.handoff(worker); // In case there are connections pending.
@@ -196,7 +195,7 @@ else
function masterInit() {
cluster.workers = {};
- var intercom = new EventEmitter;
+ var intercom = new EventEmitter();
cluster.settings = {};
// XXX(bnoordhuis) Fold cluster.schedulingPolicy into cluster.settings?
diff --git a/lib/console.js b/lib/console.js
index 63e3c5e0bf..f9032e24a0 100644
--- a/lib/console.js
+++ b/lib/console.js
@@ -73,7 +73,7 @@ Console.prototype.timeEnd = function(label) {
Console.prototype.trace = function trace() {
// TODO probably can to do this better with V8's debug object once that is
// exposed.
- var err = new Error;
+ var err = new Error();
err.name = 'Trace';
err.message = util.format.apply(this, arguments);
Error.captureStackTrace(err, trace);
diff --git a/lib/crypto.js b/lib/crypto.js
index 10ff71e854..7ce89482d5 100644
--- a/lib/crypto.js
+++ b/lib/crypto.js
@@ -320,7 +320,7 @@ function Verify(algorithm, options) {
if (!(this instanceof Verify))
return new Verify(algorithm, options);
- this._handle = new binding.Verify;
+ this._handle = new binding.Verify();
this._handle.init(algorithm);
stream.Writable.call(this, options);
diff --git a/lib/dgram.js b/lib/dgram.js
index 7d2592819a..e80f78da07 100644
--- a/lib/dgram.js
+++ b/lib/dgram.js
@@ -39,13 +39,13 @@ function lookup6(address, callback) {
function newHandle(type) {
if (type == 'udp4') {
- var handle = new UDP;
+ var handle = new UDP();
handle.lookup = lookup4;
return handle;
}
if (type == 'udp6') {
- var handle = new UDP;
+ var handle = new UDP();
handle.lookup = lookup6;
handle.bind = handle.bind6;
handle.send = handle.send6;
@@ -301,8 +301,7 @@ Socket.prototype.send = function(buffer,
if (ex) {
if (callback) callback(ex);
self.emit('error', ex);
- }
- else if (self._handle) {
+ } else if (self._handle) {
var req = new SendWrap();
req.buffer = buffer; // Keep reference alive.
req.length = length;
diff --git a/lib/dns.js b/lib/dns.js
index 9334800e4d..28f1607b44 100644
--- a/lib/dns.js
+++ b/lib/dns.js
@@ -239,7 +239,7 @@ function resolver(bindingName) {
if (err) throw errnoException(err, bindingName);
callback.immediately = true;
return req;
- }
+ };
}
diff --git a/lib/events.js b/lib/events.js
index 064f3838b3..63d79cea6d 100644
--- a/lib/events.js
+++ b/lib/events.js
@@ -307,8 +307,9 @@ EventEmitter.prototype.removeListener =
if (--this._eventsCount === 0) {
this._events = {};
return this;
- } else
+ } else {
delete events[type];
+ }
} else {
spliceOne(list, position);
}
diff --git a/lib/fs.js b/lib/fs.js
index b6b6226540..4cdd0ef5e3 100644
--- a/lib/fs.js
+++ b/lib/fs.js
@@ -40,7 +40,7 @@ function rethrow() {
// Only enable in debug mode. A backtrace uses ~1000 bytes of heap space and
// is fairly slow to generate.
if (DEBUG) {
- var backtrace = new Error;
+ var backtrace = new Error();
return function(err) {
if (err) {
backtrace.stack = err.name + ': ' + err.message +
diff --git a/lib/net.js b/lib/net.js
index df3c3d328a..76890335c1 100644
--- a/lib/net.js
+++ b/lib/net.js
@@ -431,7 +431,7 @@ Socket.prototype._destroy = function(exception, cb) {
});
self._writableState.errorEmitted = true;
}
- };
+ }
if (this.destroyed) {
debug('already destroyed, fire error callbacks');
@@ -1338,7 +1338,7 @@ Server.prototype.listen = function() {
Server.prototype.address = function() {
if (this._handle && this._handle.getsockname) {
var out = {};
- var err = this._handle.getsockname(out);
+ this._handle.getsockname(out);
// TODO(bnoordhuis) Check err and throw?
return out;
} else if (this._pipeName) {
diff --git a/lib/querystring.js b/lib/querystring.js
index 09220a919e..6aa188725a 100644
--- a/lib/querystring.js
+++ b/lib/querystring.js
@@ -28,7 +28,7 @@ QueryString.unescapeBuffer = function(s, decodeSpaces) {
break;
case charCode('+'):
if (decodeSpaces) c = charCode(' ');
- // pass thru
+ // falls through
default:
out[outIndex++] = c;
break;
diff --git a/lib/repl.js b/lib/repl.js
index 45bc49b513..fae6dc4610 100644
--- a/lib/repl.js
+++ b/lib/repl.js
@@ -350,7 +350,7 @@ function REPLServer(prompt,
// Display prompt again
self.displayPrompt();
- };
+ }
});
self.on('SIGCONT', function() {
diff --git a/lib/url.js b/lib/url.js
index 1683f90503..8da2f025dc 100644
--- a/lib/url.js
+++ b/lib/url.js
@@ -80,7 +80,7 @@ const querystring = require('querystring');
function urlParse(url, parseQueryString, slashesDenoteHost) {
if (url instanceof Url) return url;
- var u = new Url;
+ var u = new Url();
u.parse(url, parseQueryString, slashesDenoteHost);
return u;
}
diff --git a/lib/util.js b/lib/util.js
index 9293587d58..c00b4ad2cc 100644
--- a/lib/util.js
+++ b/lib/util.js
@@ -28,6 +28,7 @@ exports.format = function(f) {
} catch (_) {
return '[Circular]';
}
+ // falls through
default:
return x;
}
diff --git a/src/node.js b/src/node.js
index bd8ef5b04e..55b1d782ce 100644
--- a/src/node.js
+++ b/src/node.js
@@ -475,7 +475,7 @@
if (process._exiting)
return;
- var args = undefined;
+ var args;
if (arguments.length > 1) {
args = [];
for (var i = 1; i < arguments.length; i++)
@@ -496,8 +496,9 @@
if (!process.emit('unhandledRejection', reason, promise)) {
// Nobody is listening.
// TODO(petkaantonov) Take some default action, see #830
- } else
+ } else {
hadListeners = true;
+ }
}
}
return hadListeners;