Skip to content

Commit c00ddd5

Browse files
kibertoadelhigu
authored andcommitted
Cleanup based on analysis by https://lgtm.com (knex#2870)
* Cleanup based on analysis by https://lgtm.com * Fix linting
1 parent 132b79e commit c00ddd5

File tree

8 files changed

+12
-13
lines changed

8 files changed

+12
-13
lines changed

.eslintrc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var warning = process.env['CI'] ? 2 : 1;
1+
const warning = process.env['CI'] ? 2 : 1;
22

33
module.exports = {
44
parser: 'babel-eslint',

lgtm.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
path_classifiers:
2+
test:
3+
- scripts

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"chai": "^4.2.0",
4444
"chai-subset-in-order": "^2.1.2",
4545
"coveralls": "^3.0.2",
46-
"eslint": "5.6.1",
46+
"eslint": "5.7.0",
4747
"eslint-config-prettier": "^3.1.0",
4848
"eslint-plugin-import": "^2.14.0",
4949
"husky": "^1.1.1",
@@ -59,7 +59,7 @@
5959
"pg-query-stream": "^1.1.2",
6060
"prettier": "^1.14.3",
6161
"rimraf": "^2.6.2",
62-
"sinon": "^6.3.5",
62+
"sinon": "^7.0.0",
6363
"sinon-chai": "^3.2.0",
6464
"source-map-support": "^0.5.9",
6565
"sqlite3": "^4.0.2",

src/dialects/mssql/index.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,7 @@ assign(Client_MSSQL.prototype, {
251251

252252
// Grab a connection, run the query via the MSSQL streaming interface,
253253
// and pass that through to the stream we've sent back to the client.
254-
_stream(connection, obj, stream, options) {
255-
options = options || {};
254+
_stream(connection, obj, stream) {
256255
if (!obj || typeof obj === 'string') obj = { sql: obj };
257256
return new Promise((resolver, rejecter) => {
258257
stream.on('error', (err) => {

src/dialects/mysql2/transaction.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ assign(Transaction_MySQL2.prototype, {
1414
(err) => err.code === 'ER_SP_DOES_NOT_EXIST',
1515
() => {
1616
this.trxClient.logger.warn(
17-
'Transaction was implicitly committed, do not mix transactions and' +
17+
'Transaction was implicitly committed, do not mix transactions and ' +
1818
'DDL with MySQL (#805)'
1919
);
2020
}

src/dialects/oracle/query/compiler.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ assign(QueryCompiler_Oracle.prototype, {
184184
}
185185

186186
// always wrap returning argument in array
187-
if (returning && !Array.isArray(returning)) {
187+
if (!Array.isArray(returning)) {
188188
returning = [returning];
189189
}
190190

src/dialects/oracledb/query/compiler.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ _.assign(Oracledb_Compiler.prototype, {
1919
this.single.returning
2020
);
2121
const outBinding = outBindPrep.outBinding;
22-
let returning = outBindPrep.returning;
22+
const returning = outBindPrep.returning;
2323
const insertValues = outBindPrep.values;
2424

2525
if (
@@ -160,8 +160,6 @@ _.assign(Oracledb_Compiler.prototype, {
160160

161161
sql.outBinding = outBinding;
162162
if (returning[0] === '*') {
163-
returning = returning.slice(0, -1);
164-
165163
// Generate select statement with special order by
166164
// to keep the order because 'in (..)' may change the order
167165
sql.returningSql = function() {

src/raw.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,9 @@ function replaceRawArrBindings(raw, formatter) {
146146

147147
function replaceKeyBindings(raw, formatter) {
148148
const values = raw.bindings;
149-
let { sql } = raw;
150-
151149
const regex = /\\?(:(\w+):(?=::)|:(\w+):(?!:)|:(\w+))/g;
152-
sql = raw.sql.replace(regex, function(match, p1, p2, p3, p4) {
150+
151+
const sql = raw.sql.replace(regex, function(match, p1, p2, p3, p4) {
153152
if (match !== p1) {
154153
return p1;
155154
}

0 commit comments

Comments
 (0)