Skip to content

Commit 4b09dc5

Browse files
TrottMyles Borins
authored and
Myles Borins
committed
tools: enable no-redeclare rule for linter
PR-URL: #5047 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Roman Reiss <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 9cd623f commit 4b09dc5

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

.eslintrc

+2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ rules:
4848
# list: https://github.com/eslint/eslint/tree/master/docs/rules#best-practices
4949
## require falls through comment on switch-case
5050
no-fallthrough: 2
51+
## disallow declaring the same variable more than once
52+
no-redeclare: 2
5153

5254
# Stylistic Issues
5355
# list: https://github.com/eslint/eslint/tree/master/docs/rules#stylistic-issues

lib/dgram.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ Socket.prototype.send = function(buffer,
332332
!!callback);
333333
if (err && callback) {
334334
// don't emit as error, dgram_legacy.js compatibility
335-
var ex = exceptionWithHostPort(err, 'send', address, port);
335+
const ex = exceptionWithHostPort(err, 'send', address, port);
336336
process.nextTick(callback, ex);
337337
}
338338
}

test/parallel/test-crypto-dh.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,10 @@ assert.equal(bad_dh.verifyError, constants.DH_NOT_SUITABLE_GENERATOR);
152152
// Test ECDH
153153
var ecdh1 = crypto.createECDH('prime256v1');
154154
var ecdh2 = crypto.createECDH('prime256v1');
155-
var key1 = ecdh1.generateKeys();
156-
var key2 = ecdh2.generateKeys('hex');
157-
var secret1 = ecdh1.computeSecret(key2, 'hex', 'base64');
158-
var secret2 = ecdh2.computeSecret(key1, 'binary', 'buffer');
155+
key1 = ecdh1.generateKeys();
156+
key2 = ecdh2.generateKeys('hex');
157+
secret1 = ecdh1.computeSecret(key2, 'hex', 'base64');
158+
secret2 = ecdh2.computeSecret(key1, 'binary', 'buffer');
159159

160160
assert.equal(secret1, secret2.toString('base64'));
161161

@@ -168,7 +168,7 @@ crypto.createHash('sha256');
168168
assert.equal(ecdh1.getPublicKey('buffer', 'uncompressed')[0], 4);
169169
var firstByte = ecdh1.getPublicKey('buffer', 'compressed')[0];
170170
assert(firstByte === 2 || firstByte === 3);
171-
var firstByte = ecdh1.getPublicKey('buffer', 'hybrid')[0];
171+
firstByte = ecdh1.getPublicKey('buffer', 'hybrid')[0];
172172
assert(firstByte === 6 || firstByte === 7);
173173

174174
// ECDH should check that point is on curve

test/parallel/test-fs-utimes.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function stat_resource(resource) {
1818
}
1919

2020
function check_mtime(resource, mtime) {
21-
var mtime = fs._toUnixTimestamp(mtime);
21+
mtime = fs._toUnixTimestamp(mtime);
2222
var stats = stat_resource(resource);
2323
var real_mtime = fs._toUnixTimestamp(stats.mtime);
2424
// check up to single-second precision

0 commit comments

Comments
 (0)