diff --git a/src/errors/check-constraint-violation.js b/src/errors/check-constraint-violation.js index d886747..3c1f4e7 100644 --- a/src/errors/check-constraint-violation.js +++ b/src/errors/check-constraint-violation.js @@ -27,7 +27,7 @@ module.exports = { throw new Error("Encountered unknown error format"); } - let [_, query, table, constraint] = messageMatch; + let [_, query, _table, _constraint] = messageMatch; let columns = getColumns(query); diff --git a/src/errors/not-null-constraint-violation.js b/src/errors/not-null-constraint-violation.js index cdfd6fb..8981554 100644 --- a/src/errors/not-null-constraint-violation.js +++ b/src/errors/not-null-constraint-violation.js @@ -20,7 +20,7 @@ module.exports = { ); }, convert: function convertError(error) { - let [_, query, column] = messageRegex.exec(error.message); + let [_, query, _column] = messageRegex.exec(error.message); return new NotNullConstraintViolationError(`Missing required value for column '${error.column}' in table '${error.table}'`, { originalError: error, diff --git a/src/errors/undefined-column.js b/src/errors/undefined-column.js index 457ef2d..dcde6ef 100644 --- a/src/errors/undefined-column.js +++ b/src/errors/undefined-column.js @@ -4,7 +4,6 @@ const { create } = require("error-chain"); const pgErrorCodes = require("pg-error-codes"); const DatabaseError = require("../database-error.js"); -const getTable = require("../get-table"); let UndefinedColumnError = create("UndefinedColumnError", { inheritsFrom: DatabaseError }); diff --git a/src/get-columns.js b/src/get-columns.js index 0b4678c..9efa3c5 100644 --- a/src/get-columns.js +++ b/src/get-columns.js @@ -5,7 +5,7 @@ let updateRegex = /^update "[^"]+" set (.+) where/; let updateColumnRegex = /^"([^"]+)"/; module.exports = function getColumns(query) { - let match, columns; + let match; if (match = insertRegex.exec(query)) { return match[1].split(",").map((columnName) => { diff --git a/test/create-tables/check-constraint-violation.js b/test/create-tables/check-constraint-violation.js index 24d7809..ddd9603 100644 --- a/test/create-tables/check-constraint-violation.js +++ b/test/create-tables/check-constraint-violation.js @@ -1,7 +1,5 @@ 'use strict'; -const Promise = require("bluebird"); - module.exports = { up: function createCheckConstraintViolationTable(knex, errorHandler) { return knex.schema.createTable("check_constraint_violation", (table) => { diff --git a/test/create-tables/index.js b/test/create-tables/index.js index 2134ba9..cdee9ab 100644 --- a/test/create-tables/index.js +++ b/test/create-tables/index.js @@ -12,7 +12,7 @@ let tables = [ require("./not-null-constraint-violation") ]; -let noop = function noop(err) { +let noop = function noop(_err) { // Do nothing. };