Skip to content

Commit 0cdf85e

Browse files
committed
Lint all the JavaScripts.
1 parent 31721da commit 0cdf85e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+750
-543
lines changed

lib/_debugger.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ Protocol.prototype.execute = function(d) {
112112

113113
this.state = 'body';
114114

115-
if (Buffer.byteLength(res.raw, 'utf8') - this.bodyStartByteIndex
116-
< this.contentLength) {
115+
var len = Buffer.byteLength(res.raw, 'utf8');
116+
if (len - this.bodyStartByteIndex < this.contentLength) {
117117
break;
118118
}
119119
// pass thru
@@ -125,16 +125,16 @@ Protocol.prototype.execute = function(d) {
125125
buf.write(res.raw, 0, resRawByteLength, 'utf8');
126126
res.body =
127127
buf.slice(this.bodyStartByteIndex,
128-
this.bodyStartByteIndex
129-
+ this.contentLength).toString('utf8');
128+
this.bodyStartByteIndex +
129+
this.contentLength).toString('utf8');
130130
// JSON parse body?
131131
res.body = res.body.length ? JSON.parse(res.body) : {};
132132

133133
// Done!
134134
this.onResponse(res);
135135

136-
this._newRes(buf.slice(this.bodyStartByteIndex
137-
+ this.contentLength).toString('utf8'));
136+
this._newRes(buf.slice(this.bodyStartByteIndex +
137+
this.contentLength).toString('utf8'));
138138
}
139139
break;
140140

@@ -149,8 +149,8 @@ Protocol.prototype.serialize = function(req) {
149149
req.type = 'request';
150150
req.seq = this.reqSeq++;
151151
var json = JSON.stringify(req);
152-
return 'Content-Length: ' + Buffer.byteLength(json,'utf8') + '\r\n\r\n'
153-
+ json;
152+
return 'Content-Length: ' + Buffer.byteLength(json, 'utf8') +
153+
'\r\n\r\n' + json;
154154
};
155155

156156

lib/child_process.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ function setupChannel(target, channel) {
115115
throw new TypeError('message cannot be undefined');
116116
}
117117

118-
if (!this.connected) throw new Error("channel closed");
118+
if (!this.connected) throw new Error('channel closed');
119119

120120
// For overflow protection don't write if channel queue is too deep.
121121
if (channel.writeQueueSize > 1024 * 1024) {
@@ -140,33 +140,33 @@ function setupChannel(target, channel) {
140140

141141
target.connected = true;
142142
target.disconnect = function() {
143-
if (!this.connected) {
144-
this.emit('error', new Error('IPC channel is already disconnected'));
145-
return;
146-
}
143+
if (!this.connected) {
144+
this.emit('error', new Error('IPC channel is already disconnected'));
145+
return;
146+
}
147147

148-
// do not allow messages to be written
149-
this.connected = false;
150-
this._channel = null;
148+
// do not allow messages to be written
149+
this.connected = false;
150+
this._channel = null;
151151

152-
var fired = false;
153-
function finish() {
154-
if (fired) return;
155-
fired = true;
152+
var fired = false;
153+
function finish() {
154+
if (fired) return;
155+
fired = true;
156156

157-
channel.close();
158-
target.emit('disconnect');
159-
}
157+
channel.close();
158+
target.emit('disconnect');
159+
}
160160

161-
// If a message is being read, then wait for it to complete.
162-
if (channel.buffering) {
163-
this.once('message', finish);
164-
this.once('internalMessage', finish);
161+
// If a message is being read, then wait for it to complete.
162+
if (channel.buffering) {
163+
this.once('message', finish);
164+
this.once('internalMessage', finish);
165165

166-
return;
167-
}
166+
return;
167+
}
168168

169-
finish();
169+
finish();
170170
};
171171

172172
channel.readStart();

lib/cluster.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ function eachWorker(cb) {
9090
}
9191

9292
cluster.setupMaster = function(options) {
93-
// This can only be called from the master.
94-
assert(cluster.isMaster);
93+
// This can only be called from the master.
94+
assert(cluster.isMaster);
9595

9696
// Don't allow this function to run more that once
97-
if (masterStarted) return;
98-
masterStarted = true;
97+
if (masterStarted) return;
98+
masterStarted = true;
9999

100100
// Get filename and arguments
101101
options = options || {};
@@ -122,7 +122,7 @@ cluster.setupMaster = function(options) {
122122
quickDestroyCluster();
123123
// when done exit process with error code: 1
124124
process.exit(1);
125-
});
125+
});
126126

127127
// emit setup event
128128
cluster.emit('setup');

lib/dns.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function errnoException(errorno, syscall) {
3232

3333
// For backwards compatibility. libuv returns ENOENT on NXDOMAIN.
3434
if (errorno == 'ENOENT') {
35-
errorno = 'ENOTFOUND'
35+
errorno = 'ENOTFOUND';
3636
}
3737

3838
e.errno = e.code = errorno;

lib/fs.js

Lines changed: 37 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,18 @@ var EventEmitter = require('events').EventEmitter;
3737
var kMinPoolSpace = 128;
3838
var kPoolSize = 40 * 1024;
3939

40-
var O_APPEND = constants.O_APPEND || 0;
41-
var O_CREAT = constants.O_CREAT || 0;
40+
var O_APPEND = constants.O_APPEND || 0;
41+
var O_CREAT = constants.O_CREAT || 0;
4242
var O_DIRECTORY = constants.O_DIRECTORY || 0;
43-
var O_EXCL = constants.O_EXCL || 0;
44-
var O_NOCTTY = constants.O_NOCTTY || 0;
45-
var O_NOFOLLOW = constants.O_NOFOLLOW || 0;
46-
var O_RDONLY = constants.O_RDONLY || 0;
47-
var O_RDWR = constants.O_RDWR || 0;
48-
var O_SYMLINK = constants.O_SYMLINK || 0;
49-
var O_SYNC = constants.O_SYNC || 0;
50-
var O_TRUNC = constants.O_TRUNC || 0;
51-
var O_WRONLY = constants.O_WRONLY || 0;
43+
var O_EXCL = constants.O_EXCL || 0;
44+
var O_NOCTTY = constants.O_NOCTTY || 0;
45+
var O_NOFOLLOW = constants.O_NOFOLLOW || 0;
46+
var O_RDONLY = constants.O_RDONLY || 0;
47+
var O_RDWR = constants.O_RDWR || 0;
48+
var O_SYMLINK = constants.O_SYMLINK || 0;
49+
var O_SYNC = constants.O_SYNC || 0;
50+
var O_TRUNC = constants.O_TRUNC || 0;
51+
var O_WRONLY = constants.O_WRONLY || 0;
5252

5353
fs.Stats = binding.Stats;
5454

@@ -199,18 +199,18 @@ function stringToFlags(flag) {
199199
}
200200

201201
switch (flag) {
202-
case 'r' : return O_RDONLY;
202+
case 'r' : return O_RDONLY;
203203
case 'r+' : return O_RDWR;
204204

205-
case 'w' : return O_TRUNC | O_CREAT | O_WRONLY;
205+
case 'w' : return O_TRUNC | O_CREAT | O_WRONLY;
206206
case 'wx' : // fall through
207207
case 'xw' : return O_TRUNC | O_CREAT | O_WRONLY | O_EXCL;
208208

209209
case 'w+' : return O_TRUNC | O_CREAT | O_RDWR;
210210
case 'wx+': // fall through
211211
case 'xw+': return O_TRUNC | O_CREAT | O_RDWR | O_EXCL;
212212

213-
case 'a' : return O_APPEND | O_CREAT | O_WRONLY;
213+
case 'a' : return O_APPEND | O_CREAT | O_WRONLY;
214214
case 'ax' : // fall through
215215
case 'xa' : return O_APPEND | O_CREAT | O_WRONLY | O_EXCL;
216216

@@ -262,8 +262,10 @@ fs.open = function(path, flags, mode, callback) {
262262

263263
mode = modeNum(mode, 438 /*=0666*/);
264264

265-
binding.open(pathModule._makeLong(path), stringToFlags(flags), mode,
266-
callback);
265+
binding.open(pathModule._makeLong(path),
266+
stringToFlags(flags),
267+
mode,
268+
callback);
267269
};
268270

269271
fs.openSync = function(path, flags, mode) {
@@ -363,13 +365,14 @@ fs.writeSync = function(fd, buffer, offset, length, position) {
363365
};
364366

365367
fs.rename = function(oldPath, newPath, callback) {
366-
binding.rename(pathModule._makeLong(oldPath), pathModule._makeLong(newPath),
367-
callback || noop);
368+
binding.rename(pathModule._makeLong(oldPath),
369+
pathModule._makeLong(newPath),
370+
callback || noop);
368371
};
369372

370373
fs.renameSync = function(oldPath, newPath) {
371374
return binding.rename(pathModule._makeLong(oldPath),
372-
pathModule._makeLong(newPath));
375+
pathModule._makeLong(newPath));
373376
};
374377

375378
fs.truncate = function(fd, len, callback) {
@@ -407,12 +410,12 @@ fs.fsyncSync = function(fd) {
407410
fs.mkdir = function(path, mode, callback) {
408411
if (typeof mode === 'function') callback = mode;
409412
binding.mkdir(pathModule._makeLong(path), modeNum(mode, 511 /*=0777*/),
410-
callback || noop);
413+
callback || noop);
411414
};
412415

413416
fs.mkdirSync = function(path, mode) {
414417
return binding.mkdir(pathModule._makeLong(path),
415-
modeNum(mode, 511 /*=0777*/));
418+
modeNum(mode, 511 /*=0777*/));
416419
};
417420

418421
fs.sendfile = function(outFd, inFd, inOffset, length, callback) {
@@ -468,22 +471,23 @@ fs.symlink = function(destination, path, type_, callback) {
468471
var callback_ = arguments[arguments.length - 1];
469472
callback = (typeof(callback_) == 'function' ? callback_ : null);
470473
binding.symlink(pathModule._makeLong(destination),
471-
pathModule._makeLong(path), type, callback);
474+
pathModule._makeLong(path), type, callback);
472475
};
473476

474477
fs.symlinkSync = function(destination, path, type) {
475478
return binding.symlink(pathModule._makeLong(destination),
476-
pathModule._makeLong(path), type);
479+
pathModule._makeLong(path), type);
477480
};
478481

479482
fs.link = function(srcpath, dstpath, callback) {
480-
binding.link(pathModule._makeLong(srcpath), pathModule._makeLong(dstpath),
481-
callback || noop);
483+
binding.link(pathModule._makeLong(srcpath),
484+
pathModule._makeLong(dstpath),
485+
callback || noop);
482486
};
483487

484488
fs.linkSync = function(srcpath, dstpath) {
485489
return binding.link(pathModule._makeLong(srcpath),
486-
pathModule._makeLong(dstpath));
490+
pathModule._makeLong(dstpath));
487491
};
488492

489493
fs.unlink = function(path, callback) {
@@ -637,7 +641,10 @@ function writeAll(fd, buffer, offset, length, position, callback) {
637641
if (written === length) {
638642
fs.close(fd, callback);
639643
} else {
640-
writeAll(fd, buffer, offset + written, length - written, position + written, callback);
644+
offset += written;
645+
length -= written;
646+
position += written;
647+
writeAll(fd, buffer, offset, length, position, callback);
641648
}
642649
}
643650
});
@@ -1462,7 +1469,8 @@ function SyncWriteStream(fd) {
14621469
this.fd = fd;
14631470
this.writable = true;
14641471
this.readable = false;
1465-
};
1472+
}
1473+
14661474
util.inherits(SyncWriteStream, Stream);
14671475

14681476

@@ -1481,7 +1489,7 @@ SyncWriteStream.prototype.write = function(data, arg1, arg2) {
14811489
} else if (typeof arg1 === 'function') {
14821490
cb = arg1;
14831491
} else {
1484-
throw new Error("bad arg");
1492+
throw new Error('bad arg');
14851493
}
14861494
}
14871495

0 commit comments

Comments
 (0)