Skip to content

Commit 5461573

Browse files
committed
lint: fix object key spacing
1 parent 09b308f commit 5461573

17 files changed

+57
-63
lines changed

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"consistent-return": 2,
88
"eqeqeq": [2, "allow-null"],
99
"indent": [2, 2, { "VariableDeclarator": 2, "SwitchCase": 1 }],
10+
"key-spacing": [2, { "align": { "beforeColon": true, "afterColon": true, "on": "colon" } }],
1011
"new-parens": 2,
1112
"no-cond-assign": 2,
1213
"no-constant-condition": 2,

lib/protocol/Auth.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ Auth.hashPassword = function(password) {
7171

7272
Auth.randomInit = function(seed1, seed2) {
7373
return {
74-
max_value: 0x3FFFFFFF,
75-
max_value_dbl: 0x3FFFFFFF,
76-
seed1: seed1 % 0x3FFFFFFF,
77-
seed2: seed2 % 0x3FFFFFFF
74+
max_value : 0x3FFFFFFF,
75+
max_value_dbl : 0x3FFFFFFF,
76+
seed1 : seed1 % 0x3FFFFFFF,
77+
seed2 : seed2 % 0x3FFFFFFF
7878
};
7979
};
8080

lib/protocol/packets/RowDataPacket.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ function RowDataPacket() {
88
}
99

1010
Object.defineProperty(RowDataPacket.prototype, 'parse', {
11-
configurable: true,
12-
enumerable: false,
13-
value: parse
11+
configurable : true,
12+
enumerable : false,
13+
value : parse
1414
});
1515

1616
Object.defineProperty(RowDataPacket.prototype, '_typeCast', {
17-
configurable: true,
18-
enumerable: false,
19-
value: typeCast
17+
configurable : true,
18+
enumerable : false,
19+
value : typeCast
2020
});
2121

2222
function parse(parser, fieldPackets, typeCast, nestTables, connection) {

lib/protocol/sequences/Handshake.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ Handshake.prototype._sendCredentials = function() {
7272
maxPacketSize : this._config.maxPacketSize,
7373
charsetNumber : this._config.charsetNumber,
7474
user : this._config.user,
75+
database : this._config.database,
76+
protocol41 : packet.protocol41,
7577
scrambleBuff : (packet.protocol41)
7678
? Auth.token(this._config.password, packet.scrambleBuff())
77-
: Auth.scramble323(packet.scrambleBuff(), this._config.password),
78-
database : this._config.database,
79-
protocol41 : packet.protocol41
79+
: Auth.scramble323(packet.scrambleBuff(), this._config.password)
8080
}));
8181
};
8282

@@ -95,7 +95,7 @@ Handshake.prototype['UseOldPasswordPacket'] = function() {
9595
}
9696

9797
this.emit('packet', new Packets.OldPasswordPacket({
98-
scrambleBuff : Auth.scramble323(this._handshakeInitializationPacket.scrambleBuff(), this._config.password)
98+
scrambleBuff: Auth.scramble323(this._handshakeInitializationPacket.scrambleBuff(), this._config.password)
9999
}));
100100
};
101101

lib/protocol/sequences/Query.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,9 @@ Query.prototype['RowDataPacket'] = function(packet, parser, connection) {
150150
Query.prototype._sendLocalDataFile = function(path) {
151151
var self = this;
152152
var localStream = fs.createReadStream(path, {
153-
'flag': 'r',
154-
'encoding': null,
155-
'autoClose': true
153+
flag : 'r',
154+
encoding : null,
155+
autoClose : true
156156
});
157157

158158
this.on('pause', function () {

test/FakeServer.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ FakeConnection.prototype.handshake = function(options) {
8585

8686
FakeConnection.prototype.deny = function(message, errno) {
8787
this._sendPacket(new Packets.ErrorPacket({
88-
message: message,
89-
errno: errno
88+
message : message,
89+
errno : errno
9090
}));
9191
};
9292

@@ -97,8 +97,8 @@ FakeConnection.prototype._sendAuthResponse = function(packet, expected) {
9797
this._sendPacket(new Packets.OkPacket());
9898
} else {
9999
this._sendPacket(new Packets.ErrorPacket({
100-
message: 'expected ' + expected.toString('hex') + ' got ' + got.toString('hex'),
101-
errno: Errors.ER_ACCESS_DENIED_ERROR
100+
message : 'expected ' + expected.toString('hex') + ' got ' + got.toString('hex'),
101+
errno : Errors.ER_ACCESS_DENIED_ERROR
102102
}));
103103
}
104104

@@ -317,14 +317,14 @@ FakeConnection.prototype._parsePacket = function(header) {
317317
}
318318

319319
this._clientAuthenticationPacket = new Packets.ClientAuthenticationPacket({
320-
clientFlags : this._clientAuthenticationPacket.clientFlags,
321-
filler : this._clientAuthenticationPacket.filler,
322-
maxPacketSize: this._clientAuthenticationPacket.maxPacketSize,
323-
protocol41 : this._clientAuthenticationPacket.protocol41,
324-
charsetNumber: packet.charsetNumber,
325-
database : packet.database,
326-
scrambleBuff : packet.scrambleBuff,
327-
user : packet.user
320+
clientFlags : this._clientAuthenticationPacket.clientFlags,
321+
filler : this._clientAuthenticationPacket.filler,
322+
maxPacketSize : this._clientAuthenticationPacket.maxPacketSize,
323+
protocol41 : this._clientAuthenticationPacket.protocol41,
324+
charsetNumber : packet.charsetNumber,
325+
database : packet.database,
326+
scrambleBuff : packet.scrambleBuff,
327+
user : packet.user
328328
});
329329
this._sendPacket(new Packets.OkPacket());
330330
this._parser.resetPacketNumber();

test/integration/connection/test-timezones.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ function testNextDate(connection) {
101101
connection.query('INSERT INTO ?? SET ?', [table, {day: day, timezone: timezone, dt: dt, pre_idx: pre_idx}], assert.ifError);
102102

103103
var options = {
104-
sql: 'SELECT * FROM ?? WHERE timezone = ? AND day = ? AND pre_idx = ?',
105-
values: [table, timezone, day, pre_idx],
106-
typeCast: function (field, next) {
104+
sql : 'SELECT * FROM ?? WHERE timezone = ? AND day = ? AND pre_idx = ?',
105+
values : [table, timezone, day, pre_idx],
106+
typeCast : function (field, next) {
107107
if (field.type !== 'DATETIME') {
108108
return next();
109109
}

test/integration/connection/test-transaction-commit.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ common.getTestConnection(function (err, connection) {
2020
assert.ifError(err);
2121

2222
var row = {
23-
id: 1,
24-
title: 'Test row'
23+
id : 1,
24+
title : 'Test row'
2525
};
2626

2727
connection.query('INSERT INTO ?? SET ?', [table, row], function (err) {

test/integration/connection/test-transaction-rollback.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ common.getTestConnection(function (err, connection) {
2020
assert.ifError(err);
2121

2222
var row = {
23-
id: 1,
24-
title: 'Test row'
23+
id : 1,
24+
title : 'Test row'
2525
};
2626

2727
connection.query('INSERT INTO ?? SET ?', [table, row], function (err) {

test/integration/connection/test-type-casting.js

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,16 @@ var tests = [
3737
{type: 'mediumtext', insert: 'Hello World'},
3838
{type: 'longtext', insert: 'Hello World'},
3939
{type: 'text', insert: 'Hello World'},
40-
{type: 'point', insertRaw: 'POINT(1.2,-3.4)', expect: {x:1.2, y:-3.4}, deep: true},
41-
{type: 'point', insertRaw: (function() {
42-
var buffer = new Buffer(21);
43-
buffer.writeUInt8(1, 0);
44-
buffer.writeUInt32LE(1, 1);
45-
buffer.writeDoubleLE(-5.6, 5);
46-
buffer.writeDoubleLE(10.23, 13);
47-
return 'GeomFromWKB(X\'' + buffer.toString('hex') + '\')';
48-
})(), expect: {x:-5.6, y:10.23}, deep: true},
40+
{type: 'point', insertRaw: 'POINT(1.2,-3.4)', expect: {x: 1.2, y: -3.4}, deep: true},
41+
{type: 'point', insertRaw: 'GeomFromWKB(X\'010100000066666666666616c0f6285c8fc2752440\')', expect: {x: -5.6, y: 10.23}, deep: true},
4942
{type: 'point', insertRaw: '', insert: null, expect: null},
50-
{type: 'linestring', insertRaw: 'LINESTRING(POINT(1.2,-3.4),POINT(-5.6,10.23),POINT(0.2,0.7))', expect: [{x:1.2, y:-3.4}, {x:-5.6, y:10.23}, {x:0.2, y:0.7}], deep: true},
51-
{type: 'polygon', insertRaw: "GeomFromText('POLYGON((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5))')", expect: [[{x:0,y:0},{x:10,y:0},{x:10,y:10},{x:0,y:10},{x:0,y:0}],[{x:5,y:5},{x:7,y:5},{x:7,y:7},{x:5,y:7},{x:5,y:5}]], deep: true},
52-
{type: 'geometry', insertRaw: 'POINT(1.2,-3.4)', expect: {x:1.2, y:-3.4}, deep: true},
53-
{type: 'multipoint', insertRaw: "GeomFromText('MULTIPOINT(0 0, 20 20, 60 60)')", expect: [{x:0, y:0}, {x:20, y:20}, {x:60, y:60}], deep: true},
54-
{type: 'multilinestring', insertRaw: "GeomFromText('MULTILINESTRING((10 10, 20 20), (15 15, 30 15))')", expect: [[{x:10,y:10},{x:20,y:20}],[{x:15,y:15},{x:30,y:15}]], deep: true},
55-
{type: 'multipolygon', insertRaw: "GeomFromText('MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0)),((5 5,7 5,7 7,5 7, 5 5)))')", expect: [[[{x:0,y:0},{x:10,y:0},{x:10,y:10},{x:0,y:10},{x:0,y:0}]],[[{x:5,y:5},{x:7,y:5},{x:7,y:7},{x:5,y:7},{x:5,y:5}]]], deep: true},
56-
{type: 'geometrycollection', insertRaw: "GeomFromText('GEOMETRYCOLLECTION(POINT(10 10), POINT(30 30), LINESTRING(15 15, 20 20))')", expect: [{x:10,y:10},{x:30,y:30},[{x:15,y:15},{x:20,y:20}]], deep: true}
43+
{type: 'linestring', insertRaw: 'LINESTRING(POINT(1.2,-3.4),POINT(-5.6,10.23),POINT(0.2,0.7))', expect: [{x: 1.2, y: -3.4}, {x: -5.6, y: 10.23}, {x: 0.2, y: 0.7}], deep: true},
44+
{type: 'polygon', insertRaw: "GeomFromText('POLYGON((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5))')", expect: [[{x: 0,y: 0}, {x: 10, y: 0}, {x: 10, y: 10}, {x: 0, y: 10}, {x: 0, y: 0}], [{x: 5, y: 5}, {x: 7, y: 5}, {x: 7, y: 7}, {x: 5, y: 7}, {x: 5, y: 5}]], deep: true},
45+
{type: 'geometry', insertRaw: 'POINT(1.2,-3.4)', expect: {x: 1.2, y: -3.4}, deep: true},
46+
{type: 'multipoint', insertRaw: "GeomFromText('MULTIPOINT(0 0, 20 20, 60 60)')", expect: [{x: 0, y: 0}, {x: 20, y: 20}, {x: 60, y: 60}], deep: true},
47+
{type: 'multilinestring', insertRaw: "GeomFromText('MULTILINESTRING((10 10, 20 20), (15 15, 30 15))')", expect: [[{x: 10, y: 10}, {x: 20, y: 20}], [{x: 15, y: 15}, {x: 30, y: 15}]], deep: true},
48+
{type: 'multipolygon', insertRaw: "GeomFromText('MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0)),((5 5,7 5,7 7,5 7, 5 5)))')", expect: [[[{x: 0,y: 0}, {x: 10, y: 0}, {x: 10, y: 10}, {x: 0, y: 10}, {x: 0, y: 0}]], [[{x: 5, y: 5}, {x: 7, y: 5}, {x: 7, y: 7}, {x: 5, y: 7}, {x: 5, y: 5}]]], deep: true},
49+
{type: 'geometrycollection', insertRaw: "GeomFromText('GEOMETRYCOLLECTION(POINT(10 10), POINT(30 30), LINESTRING(15 15, 20 20))')", expect: [{x: 10, y: 10}, {x: 30, y: 30}, [{x: 15, y: 15}, {x: 20,y: 20}]], deep: true}
5750
];
5851

5952
var table = 'type_casting';

0 commit comments

Comments
 (0)