Skip to content

Commit 47d6e84

Browse files
committed
lint: separate variable declarations
1 parent 61808c8 commit 47d6e84

File tree

4 files changed

+23
-20
lines changed

4 files changed

+23
-20
lines changed

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"no-unexpected-multiline": 2,
3838
"no-unreachable": 2,
3939
"no-unused-vars": 2,
40+
"one-var": ["error", { "initialized": "never" }],
4041
"quotes": [2, "single", { "avoidEscape": true, "allowTemplateLiterals": true }],
4142
"semi": [2, "always"],
4243
"semi-spacing": 2,

benchmark/analyze.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ function sdev() {
8181
}
8282

8383
function variance() {
84-
var t = 0, squares = 0, len = numbers.length;
84+
var t = 0;
85+
var squares = 0;
86+
var len = numbers.length;
8587

8688
for (var i = 0; i < len; i++) {
8789
var obs = numbers[i];

lib/protocol/Auth.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ Auth.token = function(password, scramble) {
3535
// This is a port of sql/password.c:hash_password which needs to be used for
3636
// pre-4.1 passwords.
3737
Auth.hashPassword = function(password) {
38-
var nr = [0x5030, 0x5735],
39-
add = 7,
40-
nr2 = [0x1234, 0x5671],
41-
result = Buffer.alloc(8);
38+
var nr = [0x5030, 0x5735];
39+
var add = 7;
40+
var nr2 = [0x1234, 0x5671];
41+
var result = Buffer.alloc(8);
4242

4343
if (typeof password === 'string'){
4444
password = Buffer.from(password);
@@ -86,12 +86,12 @@ Auth.myRnd = function(r){
8686
};
8787

8888
Auth.scramble323 = function(message, password) {
89-
var to = Buffer.allocUnsafe(8),
90-
hashPass = this.hashPassword(password),
91-
hashMessage = this.hashPassword(message.slice(0, 8)),
92-
seed1 = this.int32Read(hashPass, 0) ^ this.int32Read(hashMessage, 0),
93-
seed2 = this.int32Read(hashPass, 4) ^ this.int32Read(hashMessage, 4),
94-
r = this.randomInit(seed1, seed2);
89+
var to = Buffer.allocUnsafe(8);
90+
var hashPass = this.hashPassword(password);
91+
var hashMessage = this.hashPassword(message.slice(0, 8));
92+
var seed1 = this.int32Read(hashPass, 0) ^ this.int32Read(hashMessage, 0);
93+
var seed2 = this.int32Read(hashPass, 4) ^ this.int32Read(hashMessage, 4);
94+
var r = this.randomInit(seed1, seed2);
9595

9696
for (var i = 0; i < 8; i++){
9797
to[i] = Math.floor(this.myRnd(r) * 31) + 64;
@@ -110,17 +110,17 @@ Auth.xor32 = function(a, b){
110110
};
111111

112112
Auth.add32 = function(a, b){
113-
var w1 = a[1] + b[1],
114-
w2 = a[0] + b[0] + ((w1 & 0xFFFF0000) >> 16);
113+
var w1 = a[1] + b[1];
114+
var w2 = a[0] + b[0] + ((w1 & 0xFFFF0000) >> 16);
115115

116116
return [w2 & 0xFFFF, w1 & 0xFFFF];
117117
};
118118

119119
Auth.mul32 = function(a, b){
120120
// based on this example of multiplying 32b ints using 16b
121121
// http://www.dsprelated.com/showmessage/89790/1.php
122-
var w1 = a[1] * b[1],
123-
w2 = (((a[1] * b[1]) >> 16) & 0xFFFF) + ((a[0] * b[1]) & 0xFFFF) + (a[1] * b[0] & 0xFFFF);
122+
var w1 = a[1] * b[1];
123+
var w2 = (((a[1] * b[1]) >> 16) & 0xFFFF) + ((a[0] * b[1]) & 0xFFFF) + (a[1] * b[0] & 0xFFFF);
124124

125125
return [w2 & 0xFFFF, w1 & 0xFFFF];
126126
};
@@ -131,8 +131,8 @@ Auth.and32 = function(a, b){
131131

132132
Auth.shl32 = function(a, b){
133133
// assume b is 16 or less
134-
var w1 = a[1] << b,
135-
w2 = (a[0] << b) | ((w1 & 0xFFFF0000) >> 16);
134+
var w1 = a[1] << b;
135+
var w2 = (a[0] << b) | ((w1 & 0xFFFF0000) >> 16);
136136

137137
return [w2 & 0xFFFF, w1 & 0xFFFF];
138138
};

lib/protocol/sequences/Query.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,12 @@ Query.prototype._sendLocalDataFile = function(path) {
180180
};
181181

182182
Query.prototype.stream = function(options) {
183-
var self = this,
184-
stream;
183+
var self = this;
185184

186185
options = options || {};
187186
options.objectMode = true;
188-
stream = new Readable(options);
187+
188+
var stream = new Readable(options);
189189

190190
stream._read = function() {
191191
self._connection && self._connection.resume();

0 commit comments

Comments
 (0)