Skip to content

Commit

Permalink
fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sidorares committed Aug 28, 2019
1 parent 653b9dd commit cef866e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 41 deletions.
13 changes: 6 additions & 7 deletions benchmarks/FB/hello.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ const connMap = {
host: 'localhost'
};

Mapper.connect(
connMap,
{ verbose: false, strict: false }
);
Mapper.connect(connMap, { verbose: false, strict: false });
const World = Mapper.map('World', 'id', 'randomNumber');

const template = jade.compile(fs.readFileSync('./fortunes.jade'));
Expand Down Expand Up @@ -175,7 +172,8 @@ http
let values;
let queries;
let queryFunctions;
/* eslint-disable no-case-declarations, no-inner-declarations */
/* eslint-disable no-case-declarations */
/* eslint-disable no-inner-declarations */
switch (path) {
case '/json':
// JSON Response Test
Expand Down Expand Up @@ -293,7 +291,9 @@ http

rows[0].randomNumber = getRandomNumber();
libmysql.query(
`UPDATE World SET randomNumber = ${rows[0].randomNumber} WHERE id = ${rows[0]['id']}`,
`UPDATE World SET randomNumber = ${
rows[0].randomNumber
} WHERE id = ${rows[0]['id']}`,
err => {
if (err) {
throw err;
Expand Down Expand Up @@ -327,6 +327,5 @@ http
res.writeHead(404, { 'Content-Type': 'text/html; charset=UTF-8' });
res.end('NOT IMPLEMENTED');
}
/* eslint-enable no-case-declarations no-inner-declarations */
})
.listen(8080);
52 changes: 23 additions & 29 deletions lib/commands/server_handshake.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,36 +39,30 @@ class ServerHandshake extends Command {
// TODO check we don't have something similar already
connection.clientHelloReply = clientHelloReply;
if (this.args.authCallback) {
try {
this.args.authCallback(
{
user: clientHelloReply.user,
database: clientHelloReply.database,
address: connection.stream.remoteAddress,
authPluginData1: this.serverHello.authPluginData1,
authPluginData2: this.serverHello.authPluginData2,
authToken: clientHelloReply.authToken
},
(err, mysqlError) => {
// if (err)
if (!mysqlError) {
connection.writeOk();
} else {
// TODO create constants / errorToCode
// 1045 = ER_ACCESS_DENIED_ERROR
connection.writeError({
message: mysqlError.message || '',
code: mysqlError.code || 1045
});
connection.close();
}
this.args.authCallback(
{
user: clientHelloReply.user,
database: clientHelloReply.database,
address: connection.stream.remoteAddress,
authPluginData1: this.serverHello.authPluginData1,
authPluginData2: this.serverHello.authPluginData2,
authToken: clientHelloReply.authToken
},
(err, mysqlError) => {
// if (err)
if (!mysqlError) {
connection.writeOk();
} else {
// TODO create constants / errorToCode
// 1045 = ER_ACCESS_DENIED_ERROR
connection.writeError({
message: mysqlError.message || '',
code: mysqlError.code || 1045
});
connection.close();
}
);
} catch (err) {
throw err;
// TODO
// connection.writeError(err)
}
}
);
} else {
connection.writeOk();
}
Expand Down
8 changes: 3 additions & 5 deletions lib/connection_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ class ConnectionConfig {
} else if (options && options.uri) {
const uriOptions = ConnectionConfig.parseUrl(options.uri);
for (const key in uriOptions) {
if (!uriOptions.hasOwnProperty(key)) continue;
if (!Object.prototype.hasOwnProperty.call(uriOptions, key)) continue;
if (options[key]) continue;
options[key] = uriOptions[key];
}
}
for (const key in options) {
if (!options.hasOwnProperty(key)) continue;
if (!Object.prototype.hasOwnProperty.call(options, key)) continue;
if (validOptions[key] !== 1) {
// REVIEW: Should this be emitted somehow?
// eslint-disable-next-line no-console
Expand Down Expand Up @@ -99,9 +99,7 @@ class ConnectionConfig {
// https://github.com/mysqljs/mysql#user-content-connection-options
// eslint-disable-next-line no-console
console.error(
`Ignoring invalid timezone passed to Connection: ${
options.timezone
}. This is currently a warning, but in future versions of MySQL2, an error will be thrown if you pass an invalid configuration option to a Connection`
`Ignoring invalid timezone passed to Connection: ${options.timezone}. This is currently a warning, but in future versions of MySQL2, an error will be thrown if you pass an invalid configuration option to a Connection`
);
// SqlStrings falls back to UTC on invalid timezone
this.timezone = 'Z';
Expand Down

0 comments on commit cef866e

Please sign in to comment.