Skip to content

Commit 87286cc

Browse files
Southernry
authored andcommitted
Fixed a lot of jslint errors.
Fixes nodejs#1831
1 parent 627f379 commit 87286cc

175 files changed

Lines changed: 1237 additions & 1191 deletions

File tree

Some content is hidden

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

lib/_debugger.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ Client.prototype.req = function(req, cb) {
256256

257257

258258
Client.prototype.reqVersion = function(cb) {
259-
cb = cb || function () {};
259+
cb = cb || function() {};
260260
this.req({ command: 'version' } , function(err, body, res) {
261261
if (err) return cb(err);
262262
cb(null, res.body.body.V8Version, res.body.running);
@@ -276,7 +276,7 @@ Client.prototype.reqLookup = function(refs, cb) {
276276
}
277277
};
278278

279-
cb = cb || function () {};
279+
cb = cb || function() {};
280280
this.req(req, function(err, res) {
281281
if (err) return cb(err);
282282
for (var ref in res) {
@@ -285,7 +285,7 @@ Client.prototype.reqLookup = function(refs, cb) {
285285
}
286286
}
287287

288-
cb(null, res);
288+
cb(null, res);
289289
});
290290
};
291291

@@ -296,7 +296,7 @@ Client.prototype.reqScopes = function(cb) {
296296
arguments: {}
297297
};
298298

299-
cb = cb || function () {};
299+
cb = cb || function() {};
300300
this.req(req, function(err, res) {
301301
if (err) return cb(err);
302302
var refs = res.scopes.map(function(scope) {
@@ -328,7 +328,7 @@ Client.prototype.reqEval = function(expression, cb) {
328328
return;
329329
}
330330

331-
cb = cb || function () {};
331+
cb = cb || function() {};
332332
// Otherwise we need to get the current frame to see which scopes it has.
333333
this.reqBacktrace(function(err, bt) {
334334
if (err || !bt.frames) {
@@ -361,7 +361,7 @@ Client.prototype._reqFramesEval = function(expression, evalFrames, cb) {
361361
var self = this;
362362
var i = evalFrames.shift();
363363

364-
cb = cb || function () {};
364+
cb = cb || function() {};
365365
this.reqFrameEval(expression, i, function(err, res) {
366366
if (!err) return cb(null, res);
367367
self._reqFramesEval(expression, evalFrames, cb);
@@ -382,7 +382,7 @@ Client.prototype.reqFrameEval = function(expression, frame, cb) {
382382
req.arguments.frame = frame;
383383
}
384384

385-
cb = cb || function () {};
385+
cb = cb || function() {};
386386
this.req(req, function(err, res) {
387387
if (!err) self._addHandle(res);
388388
cb(err, res);
@@ -415,7 +415,7 @@ Client.prototype.reqBacktrace = function(cb) {
415415
//
416416
Client.prototype.reqScripts = function(cb) {
417417
var self = this;
418-
cb = cb || function () {};
418+
cb = cb || function() {};
419419

420420
this.req({ command: 'scripts' } , function(err, res) {
421421
if (err) return cb(err);
@@ -502,7 +502,7 @@ Client.prototype.mirrorObject = function(handle, depth, cb) {
502502
return p.ref;
503503
});
504504

505-
cb = cb || function () {};
505+
cb = cb || function() {};
506506
this.reqLookup(propertyRefs, function(err, res) {
507507
if (err) {
508508
console.error('problem with reqLookup');
@@ -581,7 +581,7 @@ Client.prototype.mirrorObject = function(handle, depth, cb) {
581581
Client.prototype.fullTrace = function(cb) {
582582
var self = this;
583583

584-
cb = cb || function () {};
584+
cb = cb || function() {};
585585
this.reqBacktrace(function(err, trace) {
586586
if (err) return cb(err);
587587
if (trace.totalFrames <= 0) return cb(Error('No frames'));
@@ -641,7 +641,7 @@ var commands = [
641641
'out (o)',
642642
'backtrace (bt)',
643643
'setBreakpoint (sb)',
644-
'clearBreakpoint (cb)',
644+
'clearBreakpoint (cb)'
645645
],
646646
[
647647
'watch',
@@ -799,7 +799,7 @@ function Interface(stdin, stdout, args) {
799799
self.resume();
800800
});
801801
}, 10);
802-
};
802+
}
803803

804804

805805
// Stream control
@@ -882,7 +882,7 @@ Interface.prototype.handleBreak = function(r) {
882882
this.print(SourceInfo(r));
883883

884884
// Show watchers' values
885-
this.watchers(true, function (err) {
885+
this.watchers(true, function(err) {
886886
if (err) return self.error(err);
887887

888888
// And list source
@@ -1167,9 +1167,9 @@ Interface.prototype.scripts = function() {
11671167
script.name == client.currentScript ||
11681168
!script.isNative) {
11691169
scripts.push(
1170-
(script.name == client.currentScript ? '* ' : ' ') +
1171-
id + ': ' +
1172-
path.basename(script.name)
1170+
(script.name == client.currentScript ? '* ' : ' ') +
1171+
id + ': ' +
1172+
path.basename(script.name)
11731173
);
11741174
}
11751175
}
@@ -1572,7 +1572,7 @@ Interface.prototype.trySpawn = function(cb) {
15721572
});
15731573

15741574
client.on('close', function() {
1575-
self.pause()
1575+
self.pause();
15761576
self.print('program terminated');
15771577
self.resume();
15781578
self.client = null;

lib/assert.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ function truncate(s, n) {
7474

7575
assert.AssertionError.prototype.toString = function() {
7676
if (this.message) {
77-
return [ this.name + ':', this.message ].join(' ');
77+
return [this.name + ':', this.message].join(' ');
7878
} else {
7979
return [
8080
this.name + ':',
@@ -122,7 +122,7 @@ assert.fail = fail;
122122

123123
function ok(value, message) {
124124
if (!!!value) fail(value, true, message, '==', assert.ok);
125-
};
125+
}
126126
assert.ok = ok;
127127

128128
// 5. The equality assertion tests shallow, coercive equality with

lib/buffer_ieee754.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
// Copyright (c) 2008, Fair Oaks Labs, Inc.
22
// All rights reserved.
3-
//
3+
//
44
// Redistribution and use in source and binary forms, with or without
55
// modification, are permitted provided that the following conditions are met:
6-
//
6+
//
77
// * Redistributions of source code must retain the above copyright notice,
88
// this list of conditions and the following disclaimer.
9-
//
9+
//
1010
// * Redistributions in binary form must reproduce the above copyright notice,
1111
// this list of conditions and the following disclaimer in the documentation
1212
// and/or other materials provided with the distribution.
13-
//
13+
//
1414
// * Neither the name of Fair Oaks Labs, Inc. nor the names of its contributors
1515
// may be used to endorse or promote products derived from this software
1616
// without specific prior written permission.
17-
//
17+
//
1818
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
1919
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2020
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -69,7 +69,7 @@ exports.writeIEEE754 = function(buffer, value, offset, isBE, mLen, nBytes) {
6969
eMax = (1 << eLen) - 1,
7070
eBias = eMax >> 1,
7171
rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0),
72-
i = isBE ? (nBytes-1) : 0,
72+
i = isBE ? (nBytes - 1) : 0,
7373
d = isBE ? -1 : 1,
7474
s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;
7575

@@ -84,7 +84,7 @@ exports.writeIEEE754 = function(buffer, value, offset, isBE, mLen, nBytes) {
8484
e--;
8585
c *= 2;
8686
}
87-
if (e+eBias >= 1) {
87+
if (e + eBias >= 1) {
8888
value += rt / c;
8989
} else {
9090
value += rt * Math.pow(2, 1 - eBias);

lib/child_process_uv.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ function setStreamOption(name, index, options) {
272272
if (options.customFds[index] === index) {
273273
options[name] = null;
274274
} else {
275-
throw new Error("customFds not yet supported");
275+
throw new Error('customFds not yet supported');
276276
}
277277
} else {
278278
options[name] = createPipe();
@@ -283,9 +283,9 @@ function setStreamOption(name, index, options) {
283283
ChildProcess.prototype.spawn = function(options) {
284284
var self = this;
285285

286-
setStreamOption("stdinStream", 0, options);
287-
setStreamOption("stdoutStream", 1, options);
288-
setStreamOption("stderrStream", 2, options);
286+
setStreamOption('stdinStream', 0, options);
287+
setStreamOption('stdoutStream', 1, options);
288+
setStreamOption('stderrStream', 2, options);
289289

290290
var r = this._internal.spawn(options);
291291

@@ -304,7 +304,7 @@ ChildProcess.prototype.spawn = function(options) {
304304

305305
this._internal.close();
306306
this._internal = null;
307-
throw errnoException("spawn", errno)
307+
throw errnoException('spawn', errno);
308308
}
309309

310310
this.pid = this._internal.pid;

lib/crypto.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ exports.createCredentials = function(options, context) {
9696

9797
if (options.crl) {
9898
if (Array.isArray(options.crl)) {
99-
for(var i = 0, len = options.crl.length; i < len; i++) {
99+
for (var i = 0, len = options.crl.length; i < len; i++) {
100100
c.context.addCRL(options.crl[i]);
101101
}
102102
} else {
@@ -162,7 +162,7 @@ exports.createDiffieHellman = function(size_or_key, enc) {
162162
return new DiffieHellman(size_or_key, enc);
163163
}
164164

165-
}
165+
};
166166

167167
exports.pbkdf2 = PBKDF2;
168168

lib/dns_legacy.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,15 @@ var channel = new dns.Channel({SOCK_STATE_CB: function(socket, read, write) {
9393

9494
// c-ares invokes a callback either synchronously or asynchronously,
9595
// but the dns API should always invoke a callback asynchronously.
96-
//
96+
//
9797
// This function makes sure that the callback is invoked asynchronously.
9898
// It returns a function that invokes the callback within nextTick().
99-
//
99+
//
100100
// To avoid invoking unnecessary nextTick(), `immediately` property of
101101
// returned function should be set to true after c-ares returned.
102-
//
102+
//
103103
// Usage:
104-
//
104+
//
105105
// function someAPI(callback) {
106106
// callback = makeAsync(callback);
107107
// channel.someAPI(..., callback);

lib/dns_uv.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ function symToFamily(family) {
5454

5555
// c-ares invokes a callback either synchronously or asynchronously,
5656
// but the dns API should always invoke a callback asynchronously.
57-
//
57+
//
5858
// This function makes sure that the callback is invoked asynchronously.
5959
// It returns a function that invokes the callback within nextTick().
60-
//
60+
//
6161
// To avoid invoking unnecessary nextTick(), `immediately` property of
6262
// returned function should be set to true after c-ares returned.
63-
//
64-
// Usage:
65-
//
63+
//
64+
// Usage:
65+
//
6666
// function someAPI(callback) {
6767
// callback = makeAsync(callback);
6868
// channel.someAPI(..., callback);
@@ -193,14 +193,14 @@ function resolver(bindingName) {
193193

194194

195195
var resolveMap = {};
196-
exports.resolve4 = resolveMap.A = resolver('queryA');
197-
exports.resolve6 = resolveMap.AAAA = resolver('queryAaaa');
196+
exports.resolve4 = resolveMap.A = resolver('queryA');
197+
exports.resolve6 = resolveMap.AAAA = resolver('queryAaaa');
198198
exports.resolveCname = resolveMap.CNAME = resolver('queryCname');
199-
exports.resolveMx = resolveMap.MX = resolver('queryMx');
200-
exports.resolveNs = resolveMap.NS = resolver('queryNs');
201-
exports.resolveTxt = resolveMap.TXT = resolver('queryTxt');
202-
exports.resolveSrv = resolveMap.SRV = resolver('querySrv');
203-
exports.reverse = resolveMap.PTR = resolver('getHostByAddr');
199+
exports.resolveMx = resolveMap.MX = resolver('queryMx');
200+
exports.resolveNs = resolveMap.NS = resolver('queryNs');
201+
exports.resolveTxt = resolveMap.TXT = resolver('queryTxt');
202+
exports.resolveSrv = resolveMap.SRV = resolver('querySrv');
203+
exports.reverse = resolveMap.PTR = resolver('getHostByAddr');
204204

205205

206206
exports.resolve = function(domain, type_, callback_) {

lib/fs.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ fs.closeSync = function(fd) {
194194
};
195195

196196
function modeNum(m, def) {
197-
switch(typeof m) {
197+
switch (typeof m) {
198198
case 'number': return m;
199199
case 'string': return parseInt(m, 8);
200200
default:
@@ -447,7 +447,7 @@ fs.fchmodSync = function(fd, mode) {
447447
if (constants.hasOwnProperty('O_SYMLINK')) {
448448
fs.lchmod = function(path, mode, callback) {
449449
callback = callback || noop;
450-
fs.open(path, constants.O_WRONLY | constants.O_SYMLINK, function (err, fd) {
450+
fs.open(path, constants.O_WRONLY | constants.O_SYMLINK, function(err, fd) {
451451
if (err) {
452452
callback(err);
453453
return;
@@ -474,7 +474,7 @@ fs.chmodSync = function(path, mode) {
474474
if (constants.hasOwnProperty('O_SYMLINK')) {
475475
fs.lchown = function(path, uid, gid, callback) {
476476
callback = callback || noop;
477-
fs.open(path, constants.O_WRONLY | constants.O_SYMLINK, function (err, fd) {
477+
fs.open(path, constants.O_WRONLY | constants.O_SYMLINK, function(err, fd) {
478478
if (err) {
479479
callback(err);
480480
return;
@@ -514,7 +514,7 @@ function toUnixTimestamp(time) {
514514
// convert to 123.456 UNIX timestamp
515515
return time.getTime() / 1000;
516516
}
517-
throw new Error("Cannot parse time: " + time);
517+
throw new Error('Cannot parse time: ' + time);
518518
}
519519

520520
// exported for unit tests, not for public consumption
@@ -569,7 +569,8 @@ fs.writeFile = function(path, data, encoding_, callback) {
569569
if (openErr) {
570570
if (callback) callback(openErr);
571571
} else {
572-
var buffer = Buffer.isBuffer(data) ? data : new Buffer('' + data, encoding);
572+
var buffer = Buffer.isBuffer(data) ? data : new Buffer('' + data,
573+
encoding);
573574
writeAll(fd, buffer, 0, buffer.length, callback);
574575
}
575576
});
@@ -621,7 +622,7 @@ FSWatcher.prototype.start = function(filename, persistent) {
621622

622623
if (r) {
623624
this._handle.close();
624-
throw errnoException(errno, "watch")
625+
throw errnoException(errno, 'watch');
625626
}
626627
};
627628

@@ -663,11 +664,11 @@ function StatWatcher() {
663664
this._handle = new binding.StatWatcher();
664665

665666
this._handle.onchange = function(current, previous) {
666-
self.emit('change', current, previous);
667+
self.emit('change', current, previous);
667668
};
668669

669670
this._handle.onstop = function() {
670-
self.emit('stop');
671+
self.emit('stop');
671672
};
672673
}
673674
util.inherits(StatWatcher, EventEmitter);

lib/net_legacy.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ Socket.prototype._writeOut = function(data, encoding, fd, cb) {
459459

460460
this.bytesWritten += bytesWritten;
461461

462-
debug('wrote ' + bytesWritten + ' bytes to socket.')
462+
debug('wrote ' + bytesWritten + ' bytes to socket.');
463463
debug('[fd, off, len] = ' + JSON.stringify([this.fd, off, len]));
464464

465465
timers.active(this);
@@ -509,7 +509,6 @@ Socket.prototype._writeOut = function(data, encoding, fd, cb) {
509509

510510
Socket.prototype._onBufferChange = function() {
511511
// Put DTrace hooks here.
512-
;
513512
};
514513

515514

0 commit comments

Comments
 (0)