Browse Source

tools: enable no-redeclare rule for linter

PR-URL: https://github.com/nodejs/node/pull/5047
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
v4.x
Rich Trott 9 years ago
committed by Myles Borins
parent
commit
4b09dc5cac
  1. 2
      .eslintrc
  2. 2
      lib/dgram.js
  3. 10
      test/parallel/test-crypto-dh.js
  4. 2
      test/parallel/test-fs-utimes.js

2
.eslintrc

@ -48,6 +48,8 @@ rules:
# list: https://github.com/eslint/eslint/tree/master/docs/rules#best-practices
## require falls through comment on switch-case
no-fallthrough: 2
## disallow declaring the same variable more than once
no-redeclare: 2
# Stylistic Issues
# list: https://github.com/eslint/eslint/tree/master/docs/rules#stylistic-issues

2
lib/dgram.js

@ -332,7 +332,7 @@ Socket.prototype.send = function(buffer,
!!callback);
if (err && callback) {
// don't emit as error, dgram_legacy.js compatibility
var ex = exceptionWithHostPort(err, 'send', address, port);
const ex = exceptionWithHostPort(err, 'send', address, port);
process.nextTick(callback, ex);
}
}

10
test/parallel/test-crypto-dh.js

@ -152,10 +152,10 @@ assert.equal(bad_dh.verifyError, constants.DH_NOT_SUITABLE_GENERATOR);
// Test ECDH
var ecdh1 = crypto.createECDH('prime256v1');
var ecdh2 = crypto.createECDH('prime256v1');
var key1 = ecdh1.generateKeys();
var key2 = ecdh2.generateKeys('hex');
var secret1 = ecdh1.computeSecret(key2, 'hex', 'base64');
var secret2 = ecdh2.computeSecret(key1, 'binary', 'buffer');
key1 = ecdh1.generateKeys();
key2 = ecdh2.generateKeys('hex');
secret1 = ecdh1.computeSecret(key2, 'hex', 'base64');
secret2 = ecdh2.computeSecret(key1, 'binary', 'buffer');
assert.equal(secret1, secret2.toString('base64'));
@ -168,7 +168,7 @@ crypto.createHash('sha256');
assert.equal(ecdh1.getPublicKey('buffer', 'uncompressed')[0], 4);
var firstByte = ecdh1.getPublicKey('buffer', 'compressed')[0];
assert(firstByte === 2 || firstByte === 3);
var firstByte = ecdh1.getPublicKey('buffer', 'hybrid')[0];
firstByte = ecdh1.getPublicKey('buffer', 'hybrid')[0];
assert(firstByte === 6 || firstByte === 7);
// ECDH should check that point is on curve

2
test/parallel/test-fs-utimes.js

@ -18,7 +18,7 @@ function stat_resource(resource) {
}
function check_mtime(resource, mtime) {
var mtime = fs._toUnixTimestamp(mtime);
mtime = fs._toUnixTimestamp(mtime);
var stats = stat_resource(resource);
var real_mtime = fs._toUnixTimestamp(stats.mtime);
// check up to single-second precision

Loading…
Cancel
Save