diff --git a/.eslintrc b/.eslintrc index 2197bf35ccf7be..fec8179aa31f14 100644 --- a/.eslintrc +++ b/.eslintrc @@ -25,6 +25,8 @@ rules: no-dupe-keys: 2 ## check duplicate switch-case no-duplicate-case: 2 + ## disallow superfluous semicolons + no-extra-semi: 2 ## disallow assignment of exceptional params no-ex-assign: 2 ## disallow unreachable code diff --git a/lib/_debugger.js b/lib/_debugger.js index 2bab958418e941..822b5e18271f00 100644 --- a/lib/_debugger.js +++ b/lib/_debugger.js @@ -574,7 +574,7 @@ Client.prototype.mirrorObject = function(handle, depth, cb) { }); cb(null, mirror); } - }; + } }); return; } else if (handle.type === 'function') { @@ -800,7 +800,7 @@ function Interface(stdin, stdout, args) { } else { self.repl.context[key] = fn; } - }; + } // Copy all prototype methods in repl context // Setup them as getters if possible diff --git a/lib/events.js b/lib/events.js index f57882ab6dc427..5860254654d8f1 100644 --- a/lib/events.js +++ b/lib/events.js @@ -434,7 +434,7 @@ function listenerCount(type) { } return 0; -}; +} // About 1.5x faster than the two-arg version of Array#splice(). function spliceOne(list, index) { diff --git a/lib/net.js b/lib/net.js index 1faaa5c13bfdfd..68b79462447cc4 100644 --- a/lib/net.js +++ b/lib/net.js @@ -1183,7 +1183,7 @@ function createServerHandle(address, port, addressType, fd) { } return handle; -}; +} exports._createServerHandle = createServerHandle; diff --git a/lib/tls.js b/lib/tls.js index 1abeb77873692b..245afb6bdc7561 100644 --- a/lib/tls.js +++ b/lib/tls.js @@ -46,7 +46,7 @@ function convertProtocols(protocols) { }, 0); return buff; -}; +} exports.convertNPNProtocols = function(protocols, out) { // If protocols is Array - translate it into buffer diff --git a/test/common.js b/test/common.js index 133294d91e15e1..b91044ec4b6ff9 100644 --- a/test/common.js +++ b/test/common.js @@ -337,7 +337,7 @@ function leakedGlobals() { leaked.push(val); return leaked; -}; +} exports.leakedGlobals = leakedGlobals; // Turn this off if the test should not check for global leaks. diff --git a/test/debugger/helper-debugger-repl.js b/test/debugger/helper-debugger-repl.js index 714a22c2a22fdc..20cd341165042d 100644 --- a/test/debugger/helper-debugger-repl.js +++ b/test/debugger/helper-debugger-repl.js @@ -103,7 +103,7 @@ function addTest(input, output) { } else { quit(); } - }; + } expected.push({input: input, lines: output, callback: next}); } diff --git a/test/parallel/test-child-process-spawnsync-input.js b/test/parallel/test-child-process-spawnsync-input.js index 338b4277fb1982..0116f092920a8b 100644 --- a/test/parallel/test-child-process-spawnsync-input.js +++ b/test/parallel/test-child-process-spawnsync-input.js @@ -23,7 +23,7 @@ var ret; function checkSpawnSyncRet(ret) { assert.strictEqual(ret.status, 0); assert.strictEqual(ret.error, undefined); -}; +} function verifyBufOutput(ret) { checkSpawnSyncRet(ret); diff --git a/test/parallel/test-http-1.0-keep-alive.js b/test/parallel/test-http-1.0-keep-alive.js index 516a02031ef247..fa49707c24a8d5 100644 --- a/test/parallel/test-http-1.0-keep-alive.js +++ b/test/parallel/test-http-1.0-keep-alive.js @@ -122,7 +122,7 @@ function check(tests) { current++; if (ctx.expectClose) return; conn.removeListener('close', onclose); - conn.removeListener('data', ondata);; + conn.removeListener('data', ondata); connected(); } conn.on('data', ondata); diff --git a/test/parallel/test-stream-big-packet.js b/test/parallel/test-stream-big-packet.js index 67bb32847bd7f7..e64f4aa34fd481 100644 --- a/test/parallel/test-stream-big-packet.js +++ b/test/parallel/test-stream-big-packet.js @@ -8,7 +8,7 @@ var passed = false; function PassThrough() { stream.Transform.call(this); -}; +} util.inherits(PassThrough, stream.Transform); PassThrough.prototype._transform = function(chunk, encoding, done) { this.push(chunk); @@ -17,7 +17,7 @@ PassThrough.prototype._transform = function(chunk, encoding, done) { function TestStream() { stream.Transform.call(this); -}; +} util.inherits(TestStream, stream.Transform); TestStream.prototype._transform = function(chunk, encoding, done) { if (!passed) { diff --git a/test/parallel/test-stream-pipe-without-listenerCount.js b/test/parallel/test-stream-pipe-without-listenerCount.js index d7a6a6b653a6bf..872be6d7be5ce8 100644 --- a/test/parallel/test-stream-pipe-without-listenerCount.js +++ b/test/parallel/test-stream-pipe-without-listenerCount.js @@ -16,4 +16,4 @@ r.on('error', common.mustCall(noop)); w.on('error', common.mustCall(noop)); r.pipe(w); -function noop() {}; +function noop() {} diff --git a/test/parallel/test-stream-writable-change-default-encoding.js b/test/parallel/test-stream-writable-change-default-encoding.js index d8193123d6f3af..d1d4af5b824baf 100644 --- a/test/parallel/test-stream-writable-change-default-encoding.js +++ b/test/parallel/test-stream-writable-change-default-encoding.js @@ -8,7 +8,7 @@ var util = require('util'); function MyWritable(fn, options) { stream.Writable.call(this, options); this.fn = fn; -}; +} util.inherits(MyWritable, stream.Writable); diff --git a/test/parallel/test-stream-writable-decoded-encoding.js b/test/parallel/test-stream-writable-decoded-encoding.js index b5f1b4f6b73f49..75d5d424766323 100644 --- a/test/parallel/test-stream-writable-decoded-encoding.js +++ b/test/parallel/test-stream-writable-decoded-encoding.js @@ -8,7 +8,7 @@ var util = require('util'); function MyWritable(fn, options) { stream.Writable.call(this, options); this.fn = fn; -}; +} util.inherits(MyWritable, stream.Writable); @@ -17,7 +17,7 @@ MyWritable.prototype._write = function(chunk, encoding, callback) { callback(); }; -;(function decodeStringsTrue() { +(function decodeStringsTrue() { var m = new MyWritable(function(isBuffer, type, enc) { assert(isBuffer); assert.equal(type, 'object'); @@ -28,7 +28,7 @@ MyWritable.prototype._write = function(chunk, encoding, callback) { m.end(); })(); -;(function decodeStringsFalse() { +(function decodeStringsFalse() { var m = new MyWritable(function(isBuffer, type, enc) { assert(!isBuffer); assert.equal(type, 'string'); diff --git a/test/parallel/test-stream2-base64-single-char-read-end.js b/test/parallel/test-stream2-base64-single-char-read-end.js index 900e090921b712..0f9f56b3e70730 100644 --- a/test/parallel/test-stream2-base64-single-char-read-end.js +++ b/test/parallel/test-stream2-base64-single-char-read-end.js @@ -17,7 +17,7 @@ src._read = function(n) { src.push(new Buffer('1')); src.push(null); }); - }; + } }; dst._write = function(chunk, enc, cb) { diff --git a/test/parallel/test-stream3-pause-then-read.js b/test/parallel/test-stream3-pause-then-read.js index e4e33738b33206..0aee70f6832c7f 100644 --- a/test/parallel/test-stream3-pause-then-read.js +++ b/test/parallel/test-stream3-pause-then-read.js @@ -42,7 +42,7 @@ function read100() { function readn(n, then) { console.error('read %d', n); expectEndingData -= n; - ;(function read() { + (function read() { var c = r.read(n); if (!c) r.once('readable', read); diff --git a/test/parallel/test-timers-socket-timeout-removes-other-socket-unref-timer.js b/test/parallel/test-timers-socket-timeout-removes-other-socket-unref-timer.js index c9ca3eafd64ebf..a26b548385e5f6 100644 --- a/test/parallel/test-timers-socket-timeout-removes-other-socket-unref-timer.js +++ b/test/parallel/test-timers-socket-timeout-removes-other-socket-unref-timer.js @@ -39,7 +39,7 @@ server.listen(common.PORT, common.localhostIPv4, function() { if (nbClientsEnded === 2) { server.close(); } - }; + } const client1 = net.connect({ port: common.PORT }); client1.on('end', addEndedClient); diff --git a/test/parallel/test-tls-alpn-server-client.js b/test/parallel/test-tls-alpn-server-client.js index e5d809d1489aee..a9fe0b84d4ca5f 100644 --- a/test/parallel/test-tls-alpn-server-client.js +++ b/test/parallel/test-tls-alpn-server-client.js @@ -66,7 +66,7 @@ function runTest(clientsOptions, serverOptions, cb) { cb(results); } }); - }; + } } diff --git a/test/parallel/test-tls-npn-server-client.js b/test/parallel/test-tls-npn-server-client.js index 211cfc7ed35067..d74d65c8b03bd7 100644 --- a/test/parallel/test-tls-npn-server-client.js +++ b/test/parallel/test-tls-npn-server-client.js @@ -85,7 +85,7 @@ function startTest() { callback(); }); - }; + } connectClient(clientsOptions[0], function() { connectClient(clientsOptions[1], function() { diff --git a/test/parallel/test-tls-sni-option.js b/test/parallel/test-tls-sni-option.js index 1f69a4cc5102ac..0b9fae6e1426ef 100644 --- a/test/parallel/test-tls-sni-option.js +++ b/test/parallel/test-tls-sni-option.js @@ -146,7 +146,7 @@ function startTest() { else connectClient(i + 1, callback); } - }; + } connectClient(0, function() { server.close(); diff --git a/test/parallel/test-tls-sni-server-client.js b/test/parallel/test-tls-sni-server-client.js index 8eb80b50e41540..733713c8e72df8 100644 --- a/test/parallel/test-tls-sni-server-client.js +++ b/test/parallel/test-tls-sni-server-client.js @@ -103,7 +103,7 @@ function startTest() { // Continue start(); }); - }; + } start(); } diff --git a/test/parallel/test-url.js b/test/parallel/test-url.js index 9fa087261e0127..20e6138b268b5c 100644 --- a/test/parallel/test-url.js +++ b/test/parallel/test-url.js @@ -1569,6 +1569,6 @@ var throws = [ ]; for (var i = 0; i < throws.length; i++) { assert.throws(function() { url.format(throws[i]); }, TypeError); -}; +} assert(url.format('') === ''); assert(url.format({}) === ''); diff --git a/test/parallel/test-zlib-flush-drain.js b/test/parallel/test-zlib-flush-drain.js index f04dac9f0699ac..14a42e76cc3874 100644 --- a/test/parallel/test-zlib-flush-drain.js +++ b/test/parallel/test-zlib-flush-drain.js @@ -33,7 +33,7 @@ deflater.flush(function(err) { }); deflater.on('drain', function() { - drainCount++;; + drainCount++; }); process.once('exit', function() { diff --git a/test/pummel/test-tls-server-large-request.js b/test/pummel/test-tls-server-large-request.js index d7663e936de78a..cb740c63ed7d68 100644 --- a/test/pummel/test-tls-server-large-request.js +++ b/test/pummel/test-tls-server-large-request.js @@ -24,7 +24,7 @@ var options = { function Mediator() { stream.Writable.call(this); this.buf = ''; -}; +} util.inherits(Mediator, stream.Writable); Mediator.prototype._write = function write(data, enc, cb) { diff --git a/test/sequential/test-child-process-fork-getconnections.js b/test/sequential/test-child-process-fork-getconnections.js index a7521f1635fb39..f7bb9f5eea216f 100644 --- a/test/sequential/test-child-process-fork-getconnections.js +++ b/test/sequential/test-child-process-fork-getconnections.js @@ -11,7 +11,7 @@ if (process.argv[2] === 'child') { process.on('message', function(m, socket) { function sendClosed(id) { process.send({ id: id, status: 'closed'}); - }; + } if (m.cmd === 'new') { assert(socket); @@ -82,7 +82,7 @@ if (process.argv[2] === 'child') { }); sent++; child.send({ id: i, cmd: 'close' }); - }; + } let closeEmitted = false; server.on('close', function() { diff --git a/test/sequential/test-tcp-wrap-listen.js b/test/sequential/test-tcp-wrap-listen.js index 44254c3d3f39aa..d16069f25dbeab 100644 --- a/test/sequential/test-tcp-wrap-listen.js +++ b/test/sequential/test-tcp-wrap-listen.js @@ -65,7 +65,7 @@ server.onconnection = function(err, client) { writeCount++; console.log('write ' + writeCount); maybeCloseClient(); - }; + } sliceCount++; } else {