Skip to content

Commit c19c867

Browse files
committed
lint: enforce consistent quote style
1 parent 8b1519c commit c19c867

File tree

12 files changed

+25
-24
lines changed

12 files changed

+25
-24
lines changed

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"no-trailing-spaces": 2,
3232
"no-unexpected-multiline": 2,
3333
"no-unreachable": 2,
34+
"quotes": [2, "single", { "avoidEscape": true, "allowTemplateLiterals": true }],
3435
"semi": [2, "always"],
3536
"use-isnan": 2,
3637
"valid-jsdoc": 2,

lib/Connection.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function Connection(options) {
1818
this._socket = options.socket;
1919
this._protocol = new Protocol({config: this.config, connection: this});
2020
this._connectCalled = false;
21-
this.state = "disconnected";
21+
this.state = 'disconnected';
2222
this.threadId = null;
2323
}
2424

@@ -256,7 +256,7 @@ Connection.prototype.end = function end(options, callback) {
256256
};
257257

258258
Connection.prototype.destroy = function() {
259-
this.state = "disconnected";
259+
this.state = 'disconnected';
260260
this._implyConnect();
261261
this._socket.destroy();
262262
this._protocol.destroy();
@@ -281,7 +281,7 @@ Connection.prototype.escapeId = function escapeId(value) {
281281
};
282282

283283
Connection.prototype.format = function(sql, values) {
284-
if (typeof this.config.queryFormat == "function") {
284+
if (typeof this.config.queryFormat == 'function') {
285285
return this.config.queryFormat.call(this, sql, values, this.config.timezone);
286286
}
287287
return SqlString.format(sql, values, this.config.stringifyObjects, this.config.timezone);
@@ -435,7 +435,7 @@ Connection.prototype._handleNetworkError = function(err) {
435435
};
436436

437437
Connection.prototype._handleProtocolError = function(err) {
438-
this.state = "protocol_error";
438+
this.state = 'protocol_error';
439439
this.emit('error', err);
440440
};
441441

@@ -444,17 +444,17 @@ Connection.prototype._handleProtocolDrain = function() {
444444
};
445445

446446
Connection.prototype._handleProtocolConnect = function() {
447-
this.state = "connected";
447+
this.state = 'connected';
448448
this.emit('connect');
449449
};
450450

451451
Connection.prototype._handleProtocolHandshake = function _handleProtocolHandshake(packet) {
452-
this.state = "authenticated";
452+
this.state = 'authenticated';
453453
this.threadId = packet.threadId;
454454
};
455455

456456
Connection.prototype._handleProtocolEnd = function(err) {
457-
this.state = "disconnected";
457+
this.state = 'disconnected';
458458
this.emit('end', err);
459459
};
460460

lib/ConnectionConfig.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ function ConnectionConfig(options) {
3838
? true
3939
: options.typeCast;
4040

41-
if (this.timezone[0] == " ") {
41+
if (this.timezone[0] == ' ') {
4242
// "+" is a url encoded char for space so it
4343
// gets translated to space when giving a
4444
// connection string..
45-
this.timezone = "+" + this.timezone.substr(1);
45+
this.timezone = '+' + this.timezone.substr(1);
4646
}
4747

4848
if (this.ssl) {

lib/Pool.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ Pool.prototype.releaseConnection = function releaseConnection(connection) {
159159
Pool.prototype.end = function (cb) {
160160
this._closed = true;
161161

162-
if (typeof cb != "function") {
162+
if (typeof cb != 'function') {
163163
cb = function (err) {
164164
if (err) throw err;
165165
};

lib/protocol/Auth.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Auth.token = function(password, scramble) {
2626
}
2727

2828
// password must be in binary format, not utf8
29-
var stage1 = sha1((new Buffer(password, "utf8")).toString("binary"));
29+
var stage1 = sha1((new Buffer(password, 'utf8')).toString('binary'));
3030
var stage2 = sha1(stage1);
3131
var stage3 = sha1(scramble.toString('binary') + stage2);
3232
return xor(stage3, stage1);

lib/protocol/Protocol.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ Protocol.prototype.destroy = function() {
430430
this._destroyed = true;
431431
this._parser.pause();
432432

433-
if (this._connection.state !== "disconnected") {
433+
if (this._connection.state !== 'disconnected') {
434434
if(!this._ended) {
435435
this.end();
436436
}

lib/protocol/packets/HandshakeInitializationPacket.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ HandshakeInitializationPacket.prototype.write = function(writer) {
8989

9090
HandshakeInitializationPacket.prototype.scrambleBuff = function() {
9191
var buffer = new Buffer(this.scrambleBuff1.length +
92-
(typeof this.scrambleBuff2 != "undefined" ? this.scrambleBuff2.length : 0));
92+
(typeof this.scrambleBuff2 != 'undefined' ? this.scrambleBuff2.length : 0));
9393

9494
this.scrambleBuff1.copy(buffer);
95-
if (typeof this.scrambleBuff2 != "undefined") {
95+
if (typeof this.scrambleBuff2 != 'undefined') {
9696
this.scrambleBuff2.copy(buffer, this.scrambleBuff1.length);
9797
}
9898

lib/protocol/packets/RowDataPacket.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function parse(parser, fieldPackets, typeCast, nestTables, connection) {
2929
var fieldPacket = fieldPackets[i];
3030
var value;
3131

32-
if (typeof typeCast == "function") {
32+
if (typeof typeCast == 'function') {
3333
value = typeCast.apply(connection, [ new Field({ packet: fieldPacket, parser: parser }), next ]);
3434
} else {
3535
value = (typeCast)
@@ -39,7 +39,7 @@ function parse(parser, fieldPackets, typeCast, nestTables, connection) {
3939
: parser.parseLengthCodedString() );
4040
}
4141

42-
if (typeof nestTables == "string" && nestTables.length) {
42+
if (typeof nestTables == 'string' && nestTables.length) {
4343
this[fieldPacket.table + nestTables + fieldPacket.name] = value;
4444
} else if (nestTables) {
4545
this[fieldPacket.table] = this[fieldPacket.table] || {};
@@ -93,12 +93,12 @@ function typeCast(field, parser, timeZone, supportBigNumbers, bigNumberStrings,
9393
case Types.FLOAT:
9494
case Types.DOUBLE:
9595
numberString = parser.parseLengthCodedString();
96-
return (numberString === null || (field.zeroFill && numberString[0] == "0"))
96+
return (numberString === null || (field.zeroFill && numberString[0] == '0'))
9797
? numberString : Number(numberString);
9898
case Types.NEWDECIMAL:
9999
case Types.LONGLONG:
100100
numberString = parser.parseLengthCodedString();
101-
return (numberString === null || (field.zeroFill && numberString[0] == "0"))
101+
return (numberString === null || (field.zeroFill && numberString[0] == '0'))
102102
? numberString
103103
: ((supportBigNumbers && (bigNumberStrings || (Number(numberString) >= IEEE_754_BINARY_64_PRECISION) || Number(numberString) <= -IEEE_754_BINARY_64_PRECISION))
104104
? numberString

test/integration/connection/test-timezones.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ function testNextDate(connection) {
7373
} else if (offset === 'local') {
7474
timezone = offset;
7575
} else {
76-
timezone = (offset < 0 ? "-" : "+") + pad2(Math.abs(offset)) + ":00";
76+
timezone = (offset < 0 ? '-' : '+') + pad2(Math.abs(offset)) + ':00';
7777
}
7878

7979
var dt = new Date(day);
@@ -134,5 +134,5 @@ function testNextDate(connection) {
134134
}
135135

136136
function pad2(v) {
137-
return (v < 10 ? "0" : "") + v;
137+
return (v < 10 ? '0' : '') + v;
138138
}

test/integration/connection/test-type-cast-query.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ common.getTestConnection({typeCast: true}, function (err, connection) {
66
assert.ifError(err);
77

88
var options = {
9-
sql : "SELECT NOW() as date, POINT(1.2,-3.4) as point",
9+
sql : 'SELECT NOW() as date, POINT(1.2,-3.4) as point',
1010
typeCast : false
1111
};
1212

0 commit comments

Comments
 (0)