lib: fix eslint styles
PR-URL: https://github.com/iojs/io.js/pull/1539 Fixes: https://github.com/iojs/io.js/issues/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>
This commit is contained in:
parent
f9dd34d301
commit
19ffb5cf1c
@ -101,7 +101,7 @@ Protocol.prototype.execute = function(d) {
|
|||||||
if (len - this.bodyStartByteIndex < this.contentLength) {
|
if (len - this.bodyStartByteIndex < this.contentLength) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// pass thru
|
// falls through
|
||||||
case 'body':
|
case 'body':
|
||||||
var resRawByteLength = Buffer.byteLength(res.raw, 'utf8');
|
var resRawByteLength = Buffer.byteLength(res.raw, 'utf8');
|
||||||
|
|
||||||
@ -125,7 +125,6 @@ Protocol.prototype.execute = function(d) {
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
throw new Error('Unknown state');
|
throw new Error('Unknown state');
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -262,7 +261,7 @@ Client.prototype.req = function(req, cb) {
|
|||||||
|
|
||||||
Client.prototype.reqVersion = function(cb) {
|
Client.prototype.reqVersion = function(cb) {
|
||||||
cb = cb || function() {};
|
cb = cb || function() {};
|
||||||
this.req({ command: 'version' } , function(err, body, res) {
|
this.req({ command: 'version' }, function(err, body, res) {
|
||||||
if (err) return cb(err);
|
if (err) return cb(err);
|
||||||
cb(null, res.body.body.V8Version, res.body.running);
|
cb(null, res.body.body.V8Version, res.body.running);
|
||||||
});
|
});
|
||||||
@ -398,7 +397,7 @@ Client.prototype.reqFrameEval = function(expression, frame, cb) {
|
|||||||
// reqBacktrace(cb)
|
// reqBacktrace(cb)
|
||||||
// TODO: from, to, bottom
|
// TODO: from, to, bottom
|
||||||
Client.prototype.reqBacktrace = function(cb) {
|
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;
|
var self = this;
|
||||||
cb = cb || function() {};
|
cb = cb || function() {};
|
||||||
|
|
||||||
this.req({ command: 'scripts' } , function(err, res) {
|
this.req({ command: 'scripts' }, function(err, res) {
|
||||||
if (err) return cb(err);
|
if (err) return cb(err);
|
||||||
|
|
||||||
for (var i = 0; i < res.length; i++) {
|
for (var i = 0; i < res.length; i++) {
|
||||||
|
@ -137,8 +137,10 @@ IncomingMessage.prototype._addHeaderLine = function(field, value, dest) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
/* eslint-disable max-len */
|
||||||
// list is taken from:
|
// list is taken from:
|
||||||
// https://mxr.mozilla.org/mozilla/source/netwerk/protocol/http/src/nsHttpHeaderArray.cpp
|
// https://mxr.mozilla.org/mozilla/source/netwerk/protocol/http/src/nsHttpHeaderArray.cpp
|
||||||
|
/* eslint-enable max-len */
|
||||||
case 'content-type':
|
case 'content-type':
|
||||||
case 'content-length':
|
case 'content-length':
|
||||||
case 'user-agent':
|
case 'user-agent':
|
||||||
@ -158,9 +160,9 @@ IncomingMessage.prototype._addHeaderLine = function(field, value, dest) {
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
// make comma-separated list
|
// make comma-separated list
|
||||||
if (dest[field] !== undefined)
|
if (dest[field] !== undefined) {
|
||||||
dest[field] += ', ' + value;
|
dest[field] += ', ' + value;
|
||||||
else {
|
} else {
|
||||||
dest[field] = value;
|
dest[field] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,8 +85,9 @@ OutgoingMessage.prototype.setTimeout = function(msecs, callback) {
|
|||||||
this.once('socket', function(socket) {
|
this.once('socket', function(socket) {
|
||||||
socket.setTimeout(msecs);
|
socket.setTimeout(msecs);
|
||||||
});
|
});
|
||||||
} else
|
} else {
|
||||||
this.socket.setTimeout(msecs);
|
this.socket.setTimeout(msecs);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -221,9 +221,11 @@ function Server(requestListener) {
|
|||||||
this.addListener('request', requestListener);
|
this.addListener('request', requestListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* eslint-disable max-len */
|
||||||
// Similar option to this. Too lazy to write my own docs.
|
// Similar option to this. Too lazy to write my own docs.
|
||||||
// http://www.squid-cache.org/Doc/config/half_closed_clients/
|
// http://www.squid-cache.org/Doc/config/half_closed_clients/
|
||||||
// http://wiki.squid-cache.org/SquidFaq/InnerWorkings#What_is_a_half-closed_filedescriptor.3F
|
// http://wiki.squid-cache.org/SquidFaq/InnerWorkings#What_is_a_half-closed_filedescriptor.3F
|
||||||
|
/* eslint-enable max-len */
|
||||||
this.httpAllowHalfOpen = false;
|
this.httpAllowHalfOpen = false;
|
||||||
|
|
||||||
this.addListener('connection', connectionListener);
|
this.addListener('connection', connectionListener);
|
||||||
|
@ -234,9 +234,10 @@ function howMuchToRead(n, state) {
|
|||||||
if (!state.ended) {
|
if (!state.ended) {
|
||||||
state.needReadable = true;
|
state.needReadable = true;
|
||||||
return 0;
|
return 0;
|
||||||
} else
|
} else {
|
||||||
return state.length;
|
return state.length;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
@ -774,7 +775,7 @@ Readable.prototype.wrap = function(stream) {
|
|||||||
if (this[i] === undefined && typeof stream[i] === 'function') {
|
if (this[i] === undefined && typeof stream[i] === 'function') {
|
||||||
this[i] = function(method) { return function() {
|
this[i] = function(method) { return function() {
|
||||||
return stream[method].apply(stream, arguments);
|
return stream[method].apply(stream, arguments);
|
||||||
}}(i);
|
}; }(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,6 @@ Writable.WritableState = WritableState;
|
|||||||
|
|
||||||
const util = require('util');
|
const util = require('util');
|
||||||
const Stream = require('stream');
|
const Stream = require('stream');
|
||||||
const debug = util.debuglog('stream');
|
|
||||||
|
|
||||||
util.inherits(Writable, Stream);
|
util.inherits(Writable, Stream);
|
||||||
|
|
||||||
@ -273,9 +272,9 @@ function writeOrBuffer(stream, state, chunk, encoding, cb) {
|
|||||||
} else {
|
} else {
|
||||||
state.bufferedRequest = state.lastBufferedRequest;
|
state.bufferedRequest = state.lastBufferedRequest;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
doWrite(stream, state, false, len, chunk, encoding, cb);
|
doWrite(stream, state, false, len, chunk, encoding, cb);
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -471,9 +470,10 @@ function finishMaybe(stream, state) {
|
|||||||
prefinish(stream, state);
|
prefinish(stream, state);
|
||||||
state.finished = true;
|
state.finished = true;
|
||||||
stream.emit('finish');
|
stream.emit('finish');
|
||||||
} else
|
} else {
|
||||||
prefinish(stream, state);
|
prefinish(stream, state);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return need;
|
return need;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -646,7 +646,7 @@ function onnewsession(key, session) {
|
|||||||
|
|
||||||
if (self.ssl)
|
if (self.ssl)
|
||||||
self.ssl.newSessionDone();
|
self.ssl.newSessionDone();
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -323,4 +323,4 @@ assert.doesNotThrow = function(block, /*optional*/message) {
|
|||||||
_throws.apply(this, [false].concat(pSlice.call(arguments)));
|
_throws.apply(this, [false].concat(pSlice.call(arguments)));
|
||||||
};
|
};
|
||||||
|
|
||||||
assert.ifError = function(err) { if (err) {throw err;}};
|
assert.ifError = function(err) { if (err) throw err; };
|
||||||
|
@ -169,7 +169,7 @@ SocketListSend.prototype._request = function(msg, cmd, callback) {
|
|||||||
function onclose() {
|
function onclose() {
|
||||||
self.slave.removeListener('internalMessage', onreply);
|
self.slave.removeListener('internalMessage', onreply);
|
||||||
callback(new Error('Slave closed before reply'));
|
callback(new Error('Slave closed before reply'));
|
||||||
};
|
}
|
||||||
|
|
||||||
function onreply(msg) {
|
function onreply(msg) {
|
||||||
if (!(msg.cmd === cmd && msg.key === self.key)) return;
|
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);
|
self.slave.removeListener('internalMessage', onreply);
|
||||||
|
|
||||||
callback(null, msg);
|
callback(null, msg);
|
||||||
};
|
}
|
||||||
|
|
||||||
this.slave.once('disconnect', onclose);
|
this.slave.once('disconnect', onclose);
|
||||||
this.slave.on('internalMessage', onreply);
|
this.slave.on('internalMessage', onreply);
|
||||||
|
@ -11,7 +11,7 @@ const SCHED_RR = 2;
|
|||||||
|
|
||||||
const uv = process.binding('uv');
|
const uv = process.binding('uv');
|
||||||
|
|
||||||
const cluster = new EventEmitter;
|
const cluster = new EventEmitter();
|
||||||
module.exports = cluster;
|
module.exports = cluster;
|
||||||
cluster.Worker = Worker;
|
cluster.Worker = Worker;
|
||||||
cluster.isWorker = ('NODE_UNIQUE_ID' in process.env);
|
cluster.isWorker = ('NODE_UNIQUE_ID' in process.env);
|
||||||
@ -127,11 +127,10 @@ RoundRobinHandle.prototype.add = function(worker, send) {
|
|||||||
function done() {
|
function done() {
|
||||||
if (self.handle.getsockname) {
|
if (self.handle.getsockname) {
|
||||||
var out = {};
|
var out = {};
|
||||||
var err = self.handle.getsockname(out);
|
self.handle.getsockname(out);
|
||||||
// TODO(bnoordhuis) Check err.
|
// TODO(bnoordhuis) Check err.
|
||||||
send(null, { sockname: out }, null);
|
send(null, { sockname: out }, null);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
send(null, null, null); // UNIX socket.
|
send(null, null, null); // UNIX socket.
|
||||||
}
|
}
|
||||||
self.handoff(worker); // In case there are connections pending.
|
self.handoff(worker); // In case there are connections pending.
|
||||||
@ -196,7 +195,7 @@ else
|
|||||||
function masterInit() {
|
function masterInit() {
|
||||||
cluster.workers = {};
|
cluster.workers = {};
|
||||||
|
|
||||||
var intercom = new EventEmitter;
|
var intercom = new EventEmitter();
|
||||||
cluster.settings = {};
|
cluster.settings = {};
|
||||||
|
|
||||||
// XXX(bnoordhuis) Fold cluster.schedulingPolicy into cluster.settings?
|
// XXX(bnoordhuis) Fold cluster.schedulingPolicy into cluster.settings?
|
||||||
|
@ -73,7 +73,7 @@ Console.prototype.timeEnd = function(label) {
|
|||||||
Console.prototype.trace = function trace() {
|
Console.prototype.trace = function trace() {
|
||||||
// TODO probably can to do this better with V8's debug object once that is
|
// TODO probably can to do this better with V8's debug object once that is
|
||||||
// exposed.
|
// exposed.
|
||||||
var err = new Error;
|
var err = new Error();
|
||||||
err.name = 'Trace';
|
err.name = 'Trace';
|
||||||
err.message = util.format.apply(this, arguments);
|
err.message = util.format.apply(this, arguments);
|
||||||
Error.captureStackTrace(err, trace);
|
Error.captureStackTrace(err, trace);
|
||||||
|
@ -320,7 +320,7 @@ function Verify(algorithm, options) {
|
|||||||
if (!(this instanceof Verify))
|
if (!(this instanceof Verify))
|
||||||
return new Verify(algorithm, options);
|
return new Verify(algorithm, options);
|
||||||
|
|
||||||
this._handle = new binding.Verify;
|
this._handle = new binding.Verify();
|
||||||
this._handle.init(algorithm);
|
this._handle.init(algorithm);
|
||||||
|
|
||||||
stream.Writable.call(this, options);
|
stream.Writable.call(this, options);
|
||||||
|
@ -39,13 +39,13 @@ function lookup6(address, callback) {
|
|||||||
|
|
||||||
function newHandle(type) {
|
function newHandle(type) {
|
||||||
if (type == 'udp4') {
|
if (type == 'udp4') {
|
||||||
var handle = new UDP;
|
var handle = new UDP();
|
||||||
handle.lookup = lookup4;
|
handle.lookup = lookup4;
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == 'udp6') {
|
if (type == 'udp6') {
|
||||||
var handle = new UDP;
|
var handle = new UDP();
|
||||||
handle.lookup = lookup6;
|
handle.lookup = lookup6;
|
||||||
handle.bind = handle.bind6;
|
handle.bind = handle.bind6;
|
||||||
handle.send = handle.send6;
|
handle.send = handle.send6;
|
||||||
@ -301,8 +301,7 @@ Socket.prototype.send = function(buffer,
|
|||||||
if (ex) {
|
if (ex) {
|
||||||
if (callback) callback(ex);
|
if (callback) callback(ex);
|
||||||
self.emit('error', ex);
|
self.emit('error', ex);
|
||||||
}
|
} else if (self._handle) {
|
||||||
else if (self._handle) {
|
|
||||||
var req = new SendWrap();
|
var req = new SendWrap();
|
||||||
req.buffer = buffer; // Keep reference alive.
|
req.buffer = buffer; // Keep reference alive.
|
||||||
req.length = length;
|
req.length = length;
|
||||||
|
@ -239,7 +239,7 @@ function resolver(bindingName) {
|
|||||||
if (err) throw errnoException(err, bindingName);
|
if (err) throw errnoException(err, bindingName);
|
||||||
callback.immediately = true;
|
callback.immediately = true;
|
||||||
return req;
|
return req;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -307,8 +307,9 @@ EventEmitter.prototype.removeListener =
|
|||||||
if (--this._eventsCount === 0) {
|
if (--this._eventsCount === 0) {
|
||||||
this._events = {};
|
this._events = {};
|
||||||
return this;
|
return this;
|
||||||
} else
|
} else {
|
||||||
delete events[type];
|
delete events[type];
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
spliceOne(list, position);
|
spliceOne(list, position);
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ function rethrow() {
|
|||||||
// Only enable in debug mode. A backtrace uses ~1000 bytes of heap space and
|
// Only enable in debug mode. A backtrace uses ~1000 bytes of heap space and
|
||||||
// is fairly slow to generate.
|
// is fairly slow to generate.
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
var backtrace = new Error;
|
var backtrace = new Error();
|
||||||
return function(err) {
|
return function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
backtrace.stack = err.name + ': ' + err.message +
|
backtrace.stack = err.name + ': ' + err.message +
|
||||||
|
@ -431,7 +431,7 @@ Socket.prototype._destroy = function(exception, cb) {
|
|||||||
});
|
});
|
||||||
self._writableState.errorEmitted = true;
|
self._writableState.errorEmitted = true;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
if (this.destroyed) {
|
if (this.destroyed) {
|
||||||
debug('already destroyed, fire error callbacks');
|
debug('already destroyed, fire error callbacks');
|
||||||
@ -1338,7 +1338,7 @@ Server.prototype.listen = function() {
|
|||||||
Server.prototype.address = function() {
|
Server.prototype.address = function() {
|
||||||
if (this._handle && this._handle.getsockname) {
|
if (this._handle && this._handle.getsockname) {
|
||||||
var out = {};
|
var out = {};
|
||||||
var err = this._handle.getsockname(out);
|
this._handle.getsockname(out);
|
||||||
// TODO(bnoordhuis) Check err and throw?
|
// TODO(bnoordhuis) Check err and throw?
|
||||||
return out;
|
return out;
|
||||||
} else if (this._pipeName) {
|
} else if (this._pipeName) {
|
||||||
|
@ -28,7 +28,7 @@ QueryString.unescapeBuffer = function(s, decodeSpaces) {
|
|||||||
break;
|
break;
|
||||||
case charCode('+'):
|
case charCode('+'):
|
||||||
if (decodeSpaces) c = charCode(' ');
|
if (decodeSpaces) c = charCode(' ');
|
||||||
// pass thru
|
// falls through
|
||||||
default:
|
default:
|
||||||
out[outIndex++] = c;
|
out[outIndex++] = c;
|
||||||
break;
|
break;
|
||||||
|
@ -350,7 +350,7 @@ function REPLServer(prompt,
|
|||||||
|
|
||||||
// Display prompt again
|
// Display prompt again
|
||||||
self.displayPrompt();
|
self.displayPrompt();
|
||||||
};
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
self.on('SIGCONT', function() {
|
self.on('SIGCONT', function() {
|
||||||
|
@ -80,7 +80,7 @@ const querystring = require('querystring');
|
|||||||
function urlParse(url, parseQueryString, slashesDenoteHost) {
|
function urlParse(url, parseQueryString, slashesDenoteHost) {
|
||||||
if (url instanceof Url) return url;
|
if (url instanceof Url) return url;
|
||||||
|
|
||||||
var u = new Url;
|
var u = new Url();
|
||||||
u.parse(url, parseQueryString, slashesDenoteHost);
|
u.parse(url, parseQueryString, slashesDenoteHost);
|
||||||
return u;
|
return u;
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ exports.format = function(f) {
|
|||||||
} catch (_) {
|
} catch (_) {
|
||||||
return '[Circular]';
|
return '[Circular]';
|
||||||
}
|
}
|
||||||
|
// falls through
|
||||||
default:
|
default:
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
@ -475,7 +475,7 @@
|
|||||||
if (process._exiting)
|
if (process._exiting)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var args = undefined;
|
var args;
|
||||||
if (arguments.length > 1) {
|
if (arguments.length > 1) {
|
||||||
args = [];
|
args = [];
|
||||||
for (var i = 1; i < arguments.length; i++)
|
for (var i = 1; i < arguments.length; i++)
|
||||||
@ -496,10 +496,11 @@
|
|||||||
if (!process.emit('unhandledRejection', reason, promise)) {
|
if (!process.emit('unhandledRejection', reason, promise)) {
|
||||||
// Nobody is listening.
|
// Nobody is listening.
|
||||||
// TODO(petkaantonov) Take some default action, see #830
|
// TODO(petkaantonov) Take some default action, see #830
|
||||||
} else
|
} else {
|
||||||
hadListeners = true;
|
hadListeners = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return hadListeners;
|
return hadListeners;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user