Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LTS: backport no-unused-vars to v4.x-staging #4688

Merged
merged 11 commits into from
Jan 14, 2016
2 changes: 2 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ rules:
# list: https://github.com/eslint/eslint/tree/master/docs/rules#variables
## disallow use of undefined variables (globals)
no-undef: 2
## disallow declaration of variables that are not used in the code
no-unused-vars: [2, {"args": "none"}]

# Custom rules in tools/eslint-rules
require-buffer: 2
Expand Down
1 change: 0 additions & 1 deletion lib/_http_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
const util = require('util');
const net = require('net');
const url = require('url');
const EventEmitter = require('events');
const HTTPParser = process.binding('http_parser').HTTPParser;
const assert = require('assert').ok;
const common = require('_http_common');
Expand Down
1 change: 0 additions & 1 deletion lib/os.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

const binding = process.binding('os');
const util = require('util');
const internalUtil = require('internal/util');
const isWindows = process.platform === 'win32';

Expand Down
2 changes: 1 addition & 1 deletion test/addons/at-exit/test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
'use strict';
require('../../common');
var binding = require('./build/Release/binding');
require('./build/Release/binding');
2 changes: 1 addition & 1 deletion test/addons/repl-domain-abort/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ var options = {
};

// Run commands from fake REPL.
var dummy = repl.start(options);
repl.start(options);
3 changes: 3 additions & 0 deletions test/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@ exports.spawnPwd = function(options) {
};

exports.platformTimeout = function(ms) {
if (process.config.target_defaults.default_configuration === 'Debug')
ms = 2 * ms;

if (process.arch !== 'arm')
return ms;

Expand Down
9 changes: 1 addition & 8 deletions test/debugger/test-debugger-pid.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
'use strict';
var common = require('../common');
require('../common');
var assert = require('assert');
var spawn = require('child_process').spawn;

var port = common.PORT + 1337;
var buffer = '';
var expected = [];
var scriptToDebug = common.fixturesDir + '/empty.js';

function fail() {
assert(0); // `--debug-brk script.js` should not quit
}

// connect to debug agent
var interfacer = spawn(process.execPath, ['debug', '-p', '655555']);
Expand Down
2 changes: 0 additions & 2 deletions test/debugger/test-debugger-remote.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ var common = require('../common');
var assert = require('assert');
var spawn = require('child_process').spawn;

var port = common.PORT + 1337;
var buffer = '';
var expected = [];
var scriptToDebug = common.fixturesDir + '/empty.js';

function fail() {
Expand Down
2 changes: 0 additions & 2 deletions test/internet/test-dns-ipv4.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ var common = require('../common');
var assert = require('assert'),
dns = require('dns'),
net = require('net'),
isIP = net.isIP,
isIPv4 = net.isIPv4;
var util = require('util');

var expected = 0,
completed = 0,
Expand Down
2 changes: 0 additions & 2 deletions test/internet/test-dns-ipv6.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ var common = require('../common');
var assert = require('assert'),
dns = require('dns'),
net = require('net'),
isIP = net.isIP,
isIPv6 = net.isIPv6;
var util = require('util');

var expected = 0,
completed = 0,
Expand Down
5 changes: 2 additions & 3 deletions test/internet/test-dns.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ require('../common');
var assert = require('assert'),
dns = require('dns'),
net = require('net'),
isIP = net.isIP,
isIPv4 = net.isIPv4,
isIPv6 = net.isIPv6;
var util = require('util');
Expand Down Expand Up @@ -48,7 +47,7 @@ TEST(function test_reverse_bogus(done) {
var error;

try {
var req = dns.reverse('bogus ip', function() {
dns.reverse('bogus ip', function() {
assert.ok(false);
});
} catch (e) {
Expand Down Expand Up @@ -369,7 +368,7 @@ console.log('looking up nodejs.org...');

var cares = process.binding('cares_wrap');
var req = new cares.GetAddrInfoReqWrap();
var err = cares.getaddrinfo(req, 'nodejs.org', 4);
cares.getaddrinfo(req, 'nodejs.org', 4);

req.oncomplete = function(err, domains) {
assert.strictEqual(err, 0);
Expand Down
1 change: 0 additions & 1 deletion test/message/2100bytes.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';
require('../common');
var util = require('util');

console.log([
'_______________________________________________50',
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-assert-typedarray-deepequal.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const common = require('../common');
require('../common');
const assert = require('assert');
const a = require('assert');

Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-buffer-fakes.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
require('../common');
const assert = require('assert');
const Buffer = require('buffer').Buffer;
const Bp = Buffer.prototype;

function FakeBuffer() { }
FakeBuffer.__proto__ = Buffer;
Expand Down
2 changes: 0 additions & 2 deletions test/parallel/test-child-process-buffering.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
var common = require('../common');
var assert = require('assert');

var spawn = require('child_process').spawn;

var pwd_called = false;
var childClosed = false;
var childExited = false;
Expand Down
2 changes: 0 additions & 2 deletions test/parallel/test-child-process-cwd.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
'use strict';
var common = require('../common');
var assert = require('assert');
var spawn = require('child_process').spawn;
var path = require('path');

var returns = 0;

Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-child-process-exec-buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var success_count = 0;
var str = 'hello';

// default encoding
var child = exec('echo ' + str, function(err, stdout, stderr) {
exec('echo ' + str, function(err, stdout, stderr) {
assert.ok('string', typeof(stdout), 'Expected stdout to be a string');
assert.ok('string', typeof(stderr), 'Expected stderr to be a string');
assert.equal(str + os.EOL, stdout);
Expand All @@ -18,7 +18,7 @@ var child = exec('echo ' + str, function(err, stdout, stderr) {
});

// no encoding (Buffers expected)
var child = exec('echo ' + str, {
exec('echo ' + str, {
encoding: null
}, function(err, stdout, stderr) {
assert.ok(stdout instanceof Buffer, 'Expected stdout to be a Buffer');
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-child-process-exec-cwd.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if (common.isWindows) {
dir = '/dev';
}

var child = exec(pwdcommand, {cwd: dir}, function(err, stdout, stderr) {
exec(pwdcommand, {cwd: dir}, function(err, stdout, stderr) {
if (err) {
error_count++;
console.log('error!: ' + err.code);
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-child-process-fork-dgram.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ if (common.isWindows) {
}

if (process.argv[2] === 'child') {
var childCollected = 0;
var server;

process.on('message', function removeMe(msg, clusterServer) {
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-child-process-fork-exec-path.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';
var assert = require('assert');
var cp = require('child_process');
var fs = require('fs');
var path = require('path');
var common = require('../common');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-child-process-fork-ref2.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';
require('../common');
var assert = require('assert');
var fork = require('child_process').fork;

if (process.argv[2] === 'child') {
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-child-process-spawn-error.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';
var common = require('../common');
var fs = require('fs');
var spawn = require('child_process').spawn;
var assert = require('assert');

Expand Down
14 changes: 2 additions & 12 deletions test/parallel/test-child-process-stdin.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,20 @@ var response = '';
var exitStatus = -1;
var closed = false;

var gotStdoutEOF = false;

cat.stdout.setEncoding('utf8');
cat.stdout.on('data', function(chunk) {
console.log('stdout: ' + chunk);
response += chunk;
});

cat.stdout.on('end', function() {
gotStdoutEOF = true;
});


var gotStderrEOF = false;
cat.stdout.on('end', common.mustCall(function() {}));

cat.stderr.on('data', function(chunk) {
// shouldn't get any stderr output
assert.ok(false);
});

cat.stderr.on('end', function(chunk) {
gotStderrEOF = true;
});

cat.stderr.on('end', common.mustCall(function() {}));

cat.on('exit', function(status) {
console.log('exit event');
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-child-process-stdio-inherit.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ function grandparent() {

function parent() {
// should not immediately exit.
var child = common.spawnCat({ stdio: 'inherit' });
common.spawnCat({ stdio: 'inherit' });
}
1 change: 0 additions & 1 deletion test/parallel/test-child-process-stdio.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';
var common = require('../common');
var assert = require('assert');
var spawn = require('child_process').spawn;

var options = {stdio: ['pipe']};
var child = common.spawnPwd(options);
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-child-process-stdout-flush-exit.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';
var common = require('../common');
var assert = require('assert');
var path = require('path');

// if child process output to console and exit
if (process.argv[2] === 'child') {
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-cluster-eaddrinuse.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

var common = require('../common');
var assert = require('assert');
var cluster = require('cluster');
var fork = require('child_process').fork;
var net = require('net');

Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-cluster-http-pipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ http.createServer(function(req, res) {
res.writeHead(200);
res.end('OK');
}).listen(common.PIPE, function() {
var self = this;
http.get({ socketPath: common.PIPE, path: '/' }, function(res) {
res.resume();
res.on('end', function(err) {
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-cluster-worker-forced-exit.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
require('../common');
var assert = require('assert');
var cluster = require('cluster');
var net = require('net');

var SENTINEL = 42;

Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-crypto-binary-default.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ var fs = require('fs');
var path = require('path');

// Test Certificates
var caPem = fs.readFileSync(common.fixturesDir + '/test_ca.pem', 'ascii');
var certPem = fs.readFileSync(common.fixturesDir + '/test_cert.pem', 'ascii');
var certPfx = fs.readFileSync(common.fixturesDir + '/test_cert.pfx');
var keyPem = fs.readFileSync(common.fixturesDir + '/test_key.pem', 'ascii');
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-crypto-certificate.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ var crypto = require('crypto');
crypto.DEFAULT_ENCODING = 'buffer';

var fs = require('fs');
var path = require('path');

// Test Certificates
var spkacValid = fs.readFileSync(common.fixturesDir + '/spkac.valid');
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-crypto-dh.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ var ecdh3 = crypto.createECDH('secp256k1');
var key3 = ecdh3.generateKeys();

assert.throws(function() {
var secret3 = ecdh2.computeSecret(key3, 'binary', 'buffer');
ecdh2.computeSecret(key3, 'binary', 'buffer');
});

// ECDH should allow .setPrivateKey()/.setPublicKey()
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-debug-signal-cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ var options = { stdio: ['inherit', 'inherit', 'pipe', 'ipc'] };
var child = spawn(process.execPath, args, options);

var outputLines = [];
var outputTimerId;
var waitingForDebuggers = false;

var pids = null;
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-dgram-error-message-address.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ socket_ipv4.bind(common.PORT, '1.1.1.1');

// IPv6 Test
var socket_ipv6 = dgram.createSocket('udp6');
var family_ipv6 = 'IPv6';

socket_ipv6.on('listening', common.fail);

Expand Down
2 changes: 0 additions & 2 deletions test/parallel/test-dgram-pingpong.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ function pingPongTest(port, host) {
var callbacks = 0;
var N = 500;
var count = 0;
var sent_final_ping = false;

var server = dgram.createSocket('udp4', function(msg, rinfo) {
if (debug) console.log('server got: ' + msg +
Expand Down Expand Up @@ -48,7 +47,6 @@ function pingPongTest(port, host) {
if (count < N) {
client.send(buf, 0, buf.length, port, 'localhost');
} else {
sent_final_ping = true;
client.send(buf, 0, buf.length, port, 'localhost', function() {
client.close();
});
Expand Down
2 changes: 0 additions & 2 deletions test/parallel/test-dgram-send-callback-buffer-length.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
var common = require('../common');
var assert = require('assert');

var fs = require('fs');
var dgram = require('dgram');
var callbacks = 0;
var client, timer, buf, len, offset;


Expand Down
3 changes: 1 addition & 2 deletions test/parallel/test-dgram-udp4.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
var common = require('../common');
var assert = require('assert');

var fs = require('fs'),
dgram = require('dgram'), server, client,
var dgram = require('dgram'), server, client,
server_port = common.PORT,
message_to_send = 'A message to send',
timer;
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-domain-exit-dispose-again.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// to that domain, including those whose callbacks are called from within
// the same invocation of listOnTimeout, _are_ called.

var common = require('../common');
require('../common');
var assert = require('assert');
var domain = require('domain');
var disposalFailed = false;
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-domain-http-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ objects.baz.asdf = objects;

var serverCaught = 0;
var clientCaught = 0;
var disposeEmit = 0;

var server = http.createServer(function(req, res) {
var dom = domain.create();
Expand Down
Loading