This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Fixed a lot of jslint errors.

Fixes #1831
  • Loading branch information...
1 parent 627f379 commit 87286cc7371886d9856edf424785aaa890ba05a9 @Southern Southern committed with ry Oct 4, 2011
Showing with 1,237 additions and 1,191 deletions.
  1. +17 −17 lib/_debugger.js
  2. +2 −2 lib/assert.js
  3. +7 −7 lib/buffer_ieee754.js
  4. +5 −5 lib/child_process_uv.js
  5. +2 −2 lib/crypto.js
  6. +4 −4 lib/dns_legacy.js
  7. +12 −12 lib/dns_uv.js
  8. +9 −8 lib/fs.js
  9. +1 −2 lib/net_legacy.js
  10. +14 −13 lib/net_uv.js
  11. +6 −6 lib/path.js
  12. +2 −1 lib/readline.js
  13. +15 −14 lib/repl.js
  14. +2 −2 lib/tty_uv.js
  15. +29 −29 lib/util.js
  16. +7 −7 src/node.js
  17. +1 −1 test/common.js
  18. +1 −3 test/disabled/GH-670.js
  19. +16 −15 test/disabled/test-child-process-uid-gid.js
  20. +1 −1 test/disabled/test-dgram-multicast.js
  21. +3 −3 test/disabled/test-http-agent2.js
  22. +7 −7 test/disabled/test-http-big-proxy-responses.js
  23. +19 −19 test/disabled/test-http-default-port.js
  24. +2 −2 test/disabled/test-http-head-request.js
  25. +20 −20 test/disabled/test-https-loop-to-google.js
  26. +1 −1 test/disabled/test-tls-large-push.js
  27. +4 −4 test/disabled/test-tls-server.js
  28. +3 −3 test/disabled/tls-client.js
  29. +1 −1 test/fixtures/GH-892-request.js
  30. +2 −2 test/fixtures/breakpoints.js
  31. +1 −1 test/fixtures/child-process-channel.js
  32. +1 −1 test/fixtures/node_modules/asdf.js
  33. +1 −1 test/fixtures/node_modules/bar.js
  34. +1 −1 test/fixtures/node_modules/baz/index.js
  35. +1 −1 test/fixtures/node_modules/baz/node_modules/asdf.js
  36. +1 −1 test/fixtures/node_modules/foo.js
  37. +1 −1 test/fixtures/node_modules/node_modules/bar.js
  38. +1 −1 test/fixtures/packages/main-index/package-main-module/index.js
  39. +1 −1 test/fixtures/packages/main/package-main-module.js
  40. +2 −1 test/fixtures/test-init-index/index.js
  41. +2 −1 test/fixtures/test-init-native/fs.js
  42. +4 −4 test/internet/test-dns.js
  43. +1 −1 test/message/throw_custom_error.js
  44. +1 −1 test/message/throw_non_error.js
  45. +2 −2 test/pummel/test-http-upload-timeout.js
  46. +8 −8 test/pummel/test-https-large-response.js
  47. +3 −3 test/pummel/test-net-write-callbacks.js
  48. +9 −8 test/pummel/test-next-tick-loops-quick.js
  49. +3 −3 test/pummel/test-tls-throttle.js
  50. +3 −3 test/pummel/test-vm-memleak.js
  51. +11 −11 test/simple/test-assert.js
  52. +48 −47 test/simple/test-buffer.js
  53. +2 −2 test/simple/test-child-process-channel.js
  54. +1 −1 test/simple/test-child-process-customfd-bounded.js
  55. +1 −1 test/simple/test-child-process-cwd.js
  56. +9 −9 test/simple/test-child-process-double-pipe.js
  57. +1 −1 test/simple/test-child-process-env.js
  58. +2 −2 test/simple/test-child-process-exec-cwd.js
  59. +1 −1 test/simple/test-child-process-exec-env.js
  60. +4 −4 test/simple/test-child-process-set-blocking.js
  61. +1 −1 test/simple/test-cli-eval.js
  62. +2 −2 test/simple/test-console-not-call-toString.js
  63. +2 −2 test/simple/test-console.js
  64. +3 −3 test/simple/test-crypto-random.js
  65. +45 −43 test/simple/test-crypto.js
  66. +32 −32 test/simple/test-debugger-client.js
  67. +3 −3 test/simple/test-debugger-repl.js
  68. +2 −1 test/simple/test-error-reporting.js
  69. +3 −2 test/simple/test-eval.js
  70. +1 −1 test/simple/test-event-emitter-once.js
  71. +3 −3 test/simple/test-file-write-stream2.js
  72. +7 −7 test/simple/test-file-write-stream3.js
  73. +2 −1 test/simple/test-fs-open.js
  74. +28 −28 test/simple/test-fs-watch-file.js
  75. +55 −55 test/simple/test-fs-watch.js
  76. +32 −32 test/simple/test-http-1.0.js
  77. +15 −15 test/simple/test-http-abort-client.js
  78. +3 −3 test/simple/test-http-agent.js
  79. +2 −2 test/simple/test-http-allow-req-after-204-res.js
  80. +3 −3 test/simple/test-http-buffer-sanity.js
  81. +13 −9 test/simple/test-http-chunked.js
  82. +13 −13 test/simple/test-http-client-abort.js
  83. +3 −3 test/simple/test-http-client-parse-error.js
  84. +2 −2 test/simple/test-http-client-upload-buf.js
  85. +2 −2 test/simple/test-http-client-upload.js
  86. +2 −1 test/simple/test-http-conn-reset.js
  87. +2 −2 test/simple/test-http-curl-chunk-problem.js
  88. +1 −1 test/simple/test-http-default-encoding.js
  89. +9 −8 test/simple/test-http-dns-error.js
  90. +12 −12 test/simple/test-http-dns-fail.js
  91. +3 −3 test/simple/test-http-expect-continue.js
  92. +13 −13 test/simple/test-http-extra-response.js
  93. +6 −6 test/simple/test-http-get-pipeline-problem.js
  94. +2 −2 test/simple/test-http-head-request.js
  95. +2 −2 test/simple/test-http-head-response-has-no-body-end.js
  96. +3 −3 test/simple/test-http-header-read.js
  97. +1 −1 test/simple/test-http-host-headers.js
  98. +38 −20 test/simple/test-http-keep-alive-close-on-header.js
  99. +8 −8 test/simple/test-http-keep-alive.js
  100. +1 −1 test/simple/test-http-many-keep-alive-connections.js
  101. +10 −10 test/simple/test-http-multi-line-headers.js
  102. +7 −7 test/simple/test-http-mutable-headers.js
  103. +1 −1 test/simple/test-http-request-end-twice.js
  104. +1 −1 test/simple/test-http-request-end.js
  105. +4 −4 test/simple/test-http-response-close.js
  106. +3 −3 test/simple/test-http-set-timeout.js
  107. +2 −2 test/simple/test-http-status-code.js
  108. +7 −6 test/simple/test-http-unix-socket.js
  109. +6 −6 test/simple/test-http-upgrade-agent.js
  110. +3 −3 test/simple/test-http-upgrade-client2.js
  111. +2 −2 test/simple/test-http.js
  112. +4 −4 test/simple/test-https-agent.js
  113. +1 −1 test/simple/test-https-connecting-to-http.js
  114. +1 −1 test/simple/test-https-eof-for-eom.js
  115. +18 −17 test/simple/test-https-foafssl.js
  116. +10 −10 test/simple/test-https-simple.js
  117. +18 −18 test/simple/test-init.js
  118. +7 −7 test/simple/test-module-load-list.js
  119. +5 −3 test/simple/test-module-loading.js
  120. +4 −4 test/simple/test-net-bytes-stats.js
  121. +4 −4 test/simple/test-net-connect-buffer.js
  122. +4 −4 test/simple/test-net-connect-timeout.js
  123. +1 −1 test/simple/test-net-create-connection.js
  124. +2 −2 test/simple/test-net-pingpong.js
  125. +7 −7 test/simple/test-net-server-try-ports.js
  126. +2 −2 test/simple/test-net-stream.js
  127. +8 −8 test/simple/test-os.js
  128. +30 −30 test/simple/test-path.js
  129. +1 −1 test/simple/test-pipe-file-to-http.js
  130. +4 −3 test/simple/test-pipe-stream.js
  131. +3 −3 test/simple/test-pipe.js
  132. +1 −1 test/simple/test-process-env.js
  133. +2 −2 test/simple/test-process-kill-null.js
  134. +5 −5 test/simple/test-process-wrap.js
  135. +2 −2 test/simple/test-querystring.js
  136. +2 −2 test/simple/test-readdouble.js
  137. +2 −2 test/simple/test-readfloat.js
  138. +7 −7 test/simple/test-regress-GH-1531.js
  139. +4 −4 test/simple/test-regress-GH-1726.js
  140. +6 −6 test/simple/test-regress-GH-784.js
  141. +1 −1 test/simple/test-regress-GH-819.js
  142. +7 −7 test/simple/test-regress-GH-877.js
  143. +4 −4 test/simple/test-regress-GH-892.js
  144. +1 −1 test/simple/test-regress-GH-897.js
  145. +4 −4 test/simple/test-repl.js
  146. +2 −2 test/simple/test-require-cache-without-stat.js
  147. +3 −3 test/simple/test-script-context.js
  148. +2 −2 test/simple/test-signal-handler.js
  149. +2 −1 test/simple/test-stdin-from-file.js
  150. +19 −19 test/simple/test-stream-pipe-cleanup.js
  151. +4 −4 test/simple/test-stream-pipe-event.js
  152. +19 −19 test/simple/test-stream-pipe-multi.js
  153. +4 −4 test/simple/test-tcp-wrap-connect.js
  154. +9 −9 test/simple/test-tcp-wrap-listen.js
  155. +3 −3 test/simple/test-tcp-wrap.js
  156. +6 −6 test/simple/test-timers-linked-list.js
  157. +2 −2 test/simple/test-tls-client-abort.js
  158. +6 −6 test/simple/test-tls-client-resume.js
  159. +43 −43 test/simple/test-tls-client-verify.js
  160. +4 −3 test/simple/test-tls-connect.js
  161. +5 −4 test/simple/test-tls-ext-key-usage.js
  162. +7 −7 test/simple/test-tls-junk-closes-server.js
  163. +4 −4 test/simple/test-tls-npn-server-client.js
  164. +1 −1 test/simple/test-tls-peer-certificate.js
  165. +3 −3 test/simple/test-tls-securepair-client.js
  166. +3 −2 test/simple/test-tls-securepair-server.js
  167. +48 −47 test/simple/test-tls-server-verify.js
  168. +1 −1 test/simple/test-tls-set-encoding.js
  169. +4 −4 test/simple/test-tls-sni-server-client.js
  170. +3 −3 test/simple/test-tty-wrap.js
  171. +6 −6 test/simple/test-util-inspect.js
  172. +2 −1 test/simple/test-vm-create-context-circular-reference.js
  173. +2 −2 test/simple/test-writedouble.js
  174. +4 −4 test/simple/test-writefloat.js
  175. +66 −66 test/simple/test-zlib.js
View
@@ -256,7 +256,7 @@ Client.prototype.req = function(req, cb) {
Client.prototype.reqVersion = function(cb) {
- cb = cb || function () {};
+ cb = cb || function() {};
this.req({ command: 'version' } , function(err, body, res) {
if (err) return cb(err);
cb(null, res.body.body.V8Version, res.body.running);
@@ -276,7 +276,7 @@ Client.prototype.reqLookup = function(refs, cb) {
}
};
- cb = cb || function () {};
+ cb = cb || function() {};
this.req(req, function(err, res) {
if (err) return cb(err);
for (var ref in res) {
@@ -285,7 +285,7 @@ Client.prototype.reqLookup = function(refs, cb) {
}
}
- cb(null, res);
+ cb(null, res);
});
};
@@ -296,7 +296,7 @@ Client.prototype.reqScopes = function(cb) {
arguments: {}
};
- cb = cb || function () {};
+ cb = cb || function() {};
this.req(req, function(err, res) {
if (err) return cb(err);
var refs = res.scopes.map(function(scope) {
@@ -328,7 +328,7 @@ Client.prototype.reqEval = function(expression, cb) {
return;
}
- cb = cb || function () {};
+ cb = cb || function() {};
// Otherwise we need to get the current frame to see which scopes it has.
this.reqBacktrace(function(err, bt) {
if (err || !bt.frames) {
@@ -361,7 +361,7 @@ Client.prototype._reqFramesEval = function(expression, evalFrames, cb) {
var self = this;
var i = evalFrames.shift();
- cb = cb || function () {};
+ cb = cb || function() {};
this.reqFrameEval(expression, i, function(err, res) {
if (!err) return cb(null, res);
self._reqFramesEval(expression, evalFrames, cb);
@@ -382,7 +382,7 @@ Client.prototype.reqFrameEval = function(expression, frame, cb) {
req.arguments.frame = frame;
}
- cb = cb || function () {};
+ cb = cb || function() {};
this.req(req, function(err, res) {
if (!err) self._addHandle(res);
cb(err, res);
@@ -415,7 +415,7 @@ Client.prototype.reqBacktrace = function(cb) {
//
Client.prototype.reqScripts = function(cb) {
var self = this;
- cb = cb || function () {};
+ cb = cb || function() {};
this.req({ command: 'scripts' } , function(err, res) {
if (err) return cb(err);
@@ -502,7 +502,7 @@ Client.prototype.mirrorObject = function(handle, depth, cb) {
return p.ref;
});
- cb = cb || function () {};
+ cb = cb || function() {};
this.reqLookup(propertyRefs, function(err, res) {
if (err) {
console.error('problem with reqLookup');
@@ -581,7 +581,7 @@ Client.prototype.mirrorObject = function(handle, depth, cb) {
Client.prototype.fullTrace = function(cb) {
var self = this;
- cb = cb || function () {};
+ cb = cb || function() {};
this.reqBacktrace(function(err, trace) {
if (err) return cb(err);
if (trace.totalFrames <= 0) return cb(Error('No frames'));
@@ -641,7 +641,7 @@ var commands = [
'out (o)',
'backtrace (bt)',
'setBreakpoint (sb)',
- 'clearBreakpoint (cb)',
+ 'clearBreakpoint (cb)'
],
[
'watch',
@@ -799,7 +799,7 @@ function Interface(stdin, stdout, args) {
self.resume();
});
}, 10);
-};
+}
// Stream control
@@ -882,7 +882,7 @@ Interface.prototype.handleBreak = function(r) {
this.print(SourceInfo(r));
// Show watchers' values
- this.watchers(true, function (err) {
+ this.watchers(true, function(err) {
if (err) return self.error(err);
// And list source
@@ -1167,9 +1167,9 @@ Interface.prototype.scripts = function() {
script.name == client.currentScript ||
!script.isNative) {
scripts.push(
- (script.name == client.currentScript ? '* ' : ' ') +
- id + ': ' +
- path.basename(script.name)
+ (script.name == client.currentScript ? '* ' : ' ') +
+ id + ': ' +
+ path.basename(script.name)
);
}
}
@@ -1572,7 +1572,7 @@ Interface.prototype.trySpawn = function(cb) {
});
client.on('close', function() {
- self.pause()
+ self.pause();
self.print('program terminated');
self.resume();
self.client = null;
View
@@ -74,7 +74,7 @@ function truncate(s, n) {
assert.AssertionError.prototype.toString = function() {
if (this.message) {
- return [ this.name + ':', this.message ].join(' ');
+ return [this.name + ':', this.message].join(' ');
} else {
return [
this.name + ':',
@@ -122,7 +122,7 @@ assert.fail = fail;
function ok(value, message) {
if (!!!value) fail(value, true, message, '==', assert.ok);
-};
+}
assert.ok = ok;
// 5. The equality assertion tests shallow, coercive equality with
View
@@ -1,20 +1,20 @@
// Copyright (c) 2008, Fair Oaks Labs, Inc.
// All rights reserved.
-//
+//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
-//
+//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
-//
+//
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
-//
+//
// * Neither the name of Fair Oaks Labs, Inc. nor the names of its contributors
// may be used to endorse or promote products derived from this software
// without specific prior written permission.
-//
+//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -69,7 +69,7 @@ exports.writeIEEE754 = function(buffer, value, offset, isBE, mLen, nBytes) {
eMax = (1 << eLen) - 1,
eBias = eMax >> 1,
rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0),
- i = isBE ? (nBytes-1) : 0,
+ i = isBE ? (nBytes - 1) : 0,
d = isBE ? -1 : 1,
s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;
@@ -84,7 +84,7 @@ exports.writeIEEE754 = function(buffer, value, offset, isBE, mLen, nBytes) {
e--;
c *= 2;
}
- if (e+eBias >= 1) {
+ if (e + eBias >= 1) {
value += rt / c;
} else {
value += rt * Math.pow(2, 1 - eBias);
View
@@ -272,7 +272,7 @@ function setStreamOption(name, index, options) {
if (options.customFds[index] === index) {
options[name] = null;
} else {
- throw new Error("customFds not yet supported");
+ throw new Error('customFds not yet supported');
}
} else {
options[name] = createPipe();
@@ -283,9 +283,9 @@ function setStreamOption(name, index, options) {
ChildProcess.prototype.spawn = function(options) {
var self = this;
- setStreamOption("stdinStream", 0, options);
- setStreamOption("stdoutStream", 1, options);
- setStreamOption("stderrStream", 2, options);
+ setStreamOption('stdinStream', 0, options);
+ setStreamOption('stdoutStream', 1, options);
+ setStreamOption('stderrStream', 2, options);
var r = this._internal.spawn(options);
@@ -304,7 +304,7 @@ ChildProcess.prototype.spawn = function(options) {
this._internal.close();
this._internal = null;
- throw errnoException("spawn", errno)
+ throw errnoException('spawn', errno);
}
this.pid = this._internal.pid;
View
@@ -96,7 +96,7 @@ exports.createCredentials = function(options, context) {
if (options.crl) {
if (Array.isArray(options.crl)) {
- for(var i = 0, len = options.crl.length; i < len; i++) {
+ for (var i = 0, len = options.crl.length; i < len; i++) {
c.context.addCRL(options.crl[i]);
}
} else {
@@ -162,7 +162,7 @@ exports.createDiffieHellman = function(size_or_key, enc) {
return new DiffieHellman(size_or_key, enc);
}
-}
+};
exports.pbkdf2 = PBKDF2;
View
@@ -93,15 +93,15 @@ var channel = new dns.Channel({SOCK_STATE_CB: function(socket, read, write) {
// c-ares invokes a callback either synchronously or asynchronously,
// but the dns API should always invoke a callback asynchronously.
-//
+//
// This function makes sure that the callback is invoked asynchronously.
// It returns a function that invokes the callback within nextTick().
-//
+//
// To avoid invoking unnecessary nextTick(), `immediately` property of
// returned function should be set to true after c-ares returned.
-//
+//
// Usage:
-//
+//
// function someAPI(callback) {
// callback = makeAsync(callback);
// channel.someAPI(..., callback);
View
@@ -54,15 +54,15 @@ function symToFamily(family) {
// c-ares invokes a callback either synchronously or asynchronously,
// but the dns API should always invoke a callback asynchronously.
-//
+//
// This function makes sure that the callback is invoked asynchronously.
// It returns a function that invokes the callback within nextTick().
-//
+//
// To avoid invoking unnecessary nextTick(), `immediately` property of
// returned function should be set to true after c-ares returned.
-//
-// Usage:
-//
+//
+// Usage:
+//
// function someAPI(callback) {
// callback = makeAsync(callback);
// channel.someAPI(..., callback);
@@ -193,14 +193,14 @@ function resolver(bindingName) {
var resolveMap = {};
-exports.resolve4 = resolveMap.A = resolver('queryA');
-exports.resolve6 = resolveMap.AAAA = resolver('queryAaaa');
+exports.resolve4 = resolveMap.A = resolver('queryA');
+exports.resolve6 = resolveMap.AAAA = resolver('queryAaaa');
exports.resolveCname = resolveMap.CNAME = resolver('queryCname');
-exports.resolveMx = resolveMap.MX = resolver('queryMx');
-exports.resolveNs = resolveMap.NS = resolver('queryNs');
-exports.resolveTxt = resolveMap.TXT = resolver('queryTxt');
-exports.resolveSrv = resolveMap.SRV = resolver('querySrv');
-exports.reverse = resolveMap.PTR = resolver('getHostByAddr');
+exports.resolveMx = resolveMap.MX = resolver('queryMx');
+exports.resolveNs = resolveMap.NS = resolver('queryNs');
+exports.resolveTxt = resolveMap.TXT = resolver('queryTxt');
+exports.resolveSrv = resolveMap.SRV = resolver('querySrv');
+exports.reverse = resolveMap.PTR = resolver('getHostByAddr');
exports.resolve = function(domain, type_, callback_) {
View
@@ -194,7 +194,7 @@ fs.closeSync = function(fd) {
};
function modeNum(m, def) {
- switch(typeof m) {
+ switch (typeof m) {
case 'number': return m;
case 'string': return parseInt(m, 8);
default:
@@ -447,7 +447,7 @@ fs.fchmodSync = function(fd, mode) {
if (constants.hasOwnProperty('O_SYMLINK')) {
fs.lchmod = function(path, mode, callback) {
callback = callback || noop;
- fs.open(path, constants.O_WRONLY | constants.O_SYMLINK, function (err, fd) {
+ fs.open(path, constants.O_WRONLY | constants.O_SYMLINK, function(err, fd) {
if (err) {
callback(err);
return;
@@ -474,7 +474,7 @@ fs.chmodSync = function(path, mode) {
if (constants.hasOwnProperty('O_SYMLINK')) {
fs.lchown = function(path, uid, gid, callback) {
callback = callback || noop;
- fs.open(path, constants.O_WRONLY | constants.O_SYMLINK, function (err, fd) {
+ fs.open(path, constants.O_WRONLY | constants.O_SYMLINK, function(err, fd) {
if (err) {
callback(err);
return;
@@ -514,7 +514,7 @@ function toUnixTimestamp(time) {
// convert to 123.456 UNIX timestamp
return time.getTime() / 1000;
}
- throw new Error("Cannot parse time: " + time);
+ throw new Error('Cannot parse time: ' + time);
}
// exported for unit tests, not for public consumption
@@ -569,7 +569,8 @@ fs.writeFile = function(path, data, encoding_, callback) {
if (openErr) {
if (callback) callback(openErr);
} else {
- var buffer = Buffer.isBuffer(data) ? data : new Buffer('' + data, encoding);
+ var buffer = Buffer.isBuffer(data) ? data : new Buffer('' + data,
+ encoding);
writeAll(fd, buffer, 0, buffer.length, callback);
}
});
@@ -621,7 +622,7 @@ FSWatcher.prototype.start = function(filename, persistent) {
if (r) {
this._handle.close();
- throw errnoException(errno, "watch")
+ throw errnoException(errno, 'watch');
}
};
@@ -663,11 +664,11 @@ function StatWatcher() {
this._handle = new binding.StatWatcher();
this._handle.onchange = function(current, previous) {
- self.emit('change', current, previous);
+ self.emit('change', current, previous);
};
this._handle.onstop = function() {
- self.emit('stop');
+ self.emit('stop');
};
}
util.inherits(StatWatcher, EventEmitter);
View
@@ -459,7 +459,7 @@ Socket.prototype._writeOut = function(data, encoding, fd, cb) {
this.bytesWritten += bytesWritten;
- debug('wrote ' + bytesWritten + ' bytes to socket.')
+ debug('wrote ' + bytesWritten + ' bytes to socket.');
debug('[fd, off, len] = ' + JSON.stringify([this.fd, off, len]));
timers.active(this);
@@ -509,7 +509,6 @@ Socket.prototype._writeOut = function(data, encoding, fd, cb) {
Socket.prototype._onBufferChange = function() {
// Put DTrace hooks here.
- ;
};
Oops, something went wrong.

0 comments on commit 87286cc

Please sign in to comment.