From 83a0e3e90ecdf618afee9cab25a8d273c3796e12 Mon Sep 17 00:00:00 2001 From: Alex Anderson <191496+alxndrsn@users.noreply.github.com> Date: Tue, 18 Jun 2024 23:55:17 +0300 Subject: [PATCH] eslint: enable rule: @typescript-eslint/no-unused-vars (#3247) When enabling this rule, it's recommended to also *disable* the standard `no-unused-vars` rule. Although `no-unused-vars` is not currently enabled, it seems helpful to explicitly disable it here. See: https://typescript-eslint.io/rules/no-unused-vars/ Co-authored-by: alxndrsn --- .eslintrc | 8 +++++++- packages/pg-protocol/src/b.ts | 3 --- packages/pg-protocol/src/inbound-parser.test.ts | 11 ----------- packages/pg-protocol/src/index.ts | 2 +- packages/pg-protocol/src/parser.ts | 1 - packages/pg-query-stream/test/async-iterator.ts | 2 ++ packages/pg-query-stream/test/pauses.ts | 2 +- packages/pg/test/integration/client/appname-tests.js | 1 - .../test/integration/client/big-simple-query-tests.js | 3 +-- .../test/integration/client/error-handling-tests.js | 5 ++--- .../test/integration/client/multiple-results-tests.js | 2 +- packages/pg/test/integration/client/no-data-tests.js | 4 ++-- .../integration/client/prepared-statement-tests.js | 3 +-- .../test/integration/client/result-metadata-tests.js | 2 +- .../test/integration/client/results-as-array-tests.js | 2 +- .../pg/test/integration/client/simple-query-tests.js | 1 + .../pg/test/integration/client/type-coercion-tests.js | 4 +--- .../test/integration/connection-pool/error-tests.js | 1 - packages/pg/test/integration/connection/copy-tests.js | 4 ++-- .../pg/test/integration/connection/test-helper.js | 1 - packages/pg/test/integration/domain-tests.js | 2 +- packages/pg/test/integration/gh-issues/1542-tests.js | 2 +- packages/pg/test/integration/gh-issues/2064-tests.js | 1 - packages/pg/test/integration/gh-issues/2303-tests.js | 1 - .../pg/test/unit/client/early-disconnect-tests.js | 2 +- .../pg/test/unit/client/prepared-statement-tests.js | 2 -- packages/pg/test/unit/client/query-queue-tests.js | 2 +- packages/pg/test/unit/client/result-metadata-tests.js | 2 +- .../stream-and-query-error-interaction-tests.js | 2 +- .../pg/test/unit/client/throw-in-type-parser-tests.js | 7 +------ .../test/unit/connection-parameters/creation-tests.js | 1 - packages/pg/test/unit/utils-tests.js | 2 -- 32 files changed, 31 insertions(+), 57 deletions(-) diff --git a/.eslintrc b/.eslintrc index bb77004ec..fd9bb8ddc 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,5 +1,5 @@ { - "plugins": ["prettier"], + "plugins": ["@typescript-eslint", "prettier"], "parser": "@typescript-eslint/parser", "extends": ["plugin:prettier/recommended", "prettier"], "ignorePatterns": ["node_modules", "coverage", "packages/pg-protocol/dist/**/*", "packages/pg-query-stream/dist/**/*"], @@ -11,5 +11,11 @@ "node": true, "es6": true, "mocha": true + }, + "rules": { + "@typescript-eslint/no-unused-vars": ["error", { + "args": "none" + }], + "no-unused-vars": "off" } } diff --git a/packages/pg-protocol/src/b.ts b/packages/pg-protocol/src/b.ts index 028b76393..088ca1857 100644 --- a/packages/pg-protocol/src/b.ts +++ b/packages/pg-protocol/src/b.ts @@ -1,13 +1,10 @@ // file for microbenchmarking -import { Writer } from './buffer-writer' -import { serialize } from './index' import { BufferReader } from './buffer-reader' const LOOPS = 1000 let count = 0 let start = Date.now() -const writer = new Writer() const reader = new BufferReader() const buffer = Buffer.from([33, 33, 33, 33, 33, 33, 33, 0]) diff --git a/packages/pg-protocol/src/inbound-parser.test.ts b/packages/pg-protocol/src/inbound-parser.test.ts index 364bd8d95..0c905c501 100644 --- a/packages/pg-protocol/src/inbound-parser.test.ts +++ b/packages/pg-protocol/src/inbound-parser.test.ts @@ -14,17 +14,6 @@ var parseCompleteBuffer = buffers.parseComplete() var bindCompleteBuffer = buffers.bindComplete() var portalSuspendedBuffer = buffers.portalSuspended() -var addRow = function (bufferList: BufferList, name: string, offset: number) { - return bufferList - .addCString(name) // field name - .addInt32(offset++) // table id - .addInt16(offset++) // attribute of column number - .addInt32(offset++) // objectId of field's data type - .addInt16(offset++) // datatype size - .addInt32(offset++) // type modifier - .addInt16(0) // format code, 0 => text -} - var row1 = { name: 'id', tableID: 1, diff --git a/packages/pg-protocol/src/index.ts b/packages/pg-protocol/src/index.ts index 00491ff7f..703ff2e49 100644 --- a/packages/pg-protocol/src/index.ts +++ b/packages/pg-protocol/src/index.ts @@ -1,4 +1,4 @@ -import { BackendMessage, DatabaseError } from './messages' +import { DatabaseError } from './messages' import { serialize } from './serializer' import { Parser, MessageCallback } from './parser' diff --git a/packages/pg-protocol/src/parser.ts b/packages/pg-protocol/src/parser.ts index 1ad4e3abd..5a3b0f6be 100644 --- a/packages/pg-protocol/src/parser.ts +++ b/packages/pg-protocol/src/parser.ts @@ -27,7 +27,6 @@ import { NoticeMessage, } from './messages' import { BufferReader } from './buffer-reader' -import assert from 'assert' // every message is prefixed with a single bye const CODE_LENGTH = 1 diff --git a/packages/pg-query-stream/test/async-iterator.ts b/packages/pg-query-stream/test/async-iterator.ts index e2f8a7552..227a9ec9a 100644 --- a/packages/pg-query-stream/test/async-iterator.ts +++ b/packages/pg-query-stream/test/async-iterator.ts @@ -122,9 +122,11 @@ if (!process.version.startsWith('v8')) { const pool = new pg.Pool({ max: 1 }) const client = await pool.connect() + /* eslint-disable @typescript-eslint/no-unused-vars */ for await (const _ of client.query(new QueryStream('select TRUE', [], { highWaterMark: 1 }))) break for await (const _ of client.query(new QueryStream('select TRUE', [], { highWaterMark: 1 }))) break for await (const _ of client.query(new QueryStream('select TRUE', [], { highWaterMark: 1 }))) break + /* eslint-enable @typescript-eslint/no-unused-vars */ client.release() await pool.end() diff --git a/packages/pg-query-stream/test/pauses.ts b/packages/pg-query-stream/test/pauses.ts index 75fee57f6..4906341f8 100644 --- a/packages/pg-query-stream/test/pauses.ts +++ b/packages/pg-query-stream/test/pauses.ts @@ -2,7 +2,7 @@ import helper from './helper' import concat from 'concat-stream' import JSONStream from 'JSONStream' import QueryStream from '../src' -import { Transform, TransformCallback } from 'stream' +import { Transform } from 'stream' class PauseStream extends Transform { constructor() { diff --git a/packages/pg/test/integration/client/appname-tests.js b/packages/pg/test/integration/client/appname-tests.js index ab7202a9b..ae05c7e72 100644 --- a/packages/pg/test/integration/client/appname-tests.js +++ b/packages/pg/test/integration/client/appname-tests.js @@ -27,7 +27,6 @@ function getAppName(conf, cb) { } suite.test('No default appliation_name ', function (done) { - var conf = getConInfo() getAppName({}, function (res) { assert.strictEqual(res, '') done() diff --git a/packages/pg/test/integration/client/big-simple-query-tests.js b/packages/pg/test/integration/client/big-simple-query-tests.js index b0dc252f6..acc9fe7f8 100644 --- a/packages/pg/test/integration/client/big-simple-query-tests.js +++ b/packages/pg/test/integration/client/big-simple-query-tests.js @@ -92,8 +92,7 @@ process.on('exit', function () { }) var runBigQuery = function (client) { - var rows = [] - var q = client.query( + client.query( "select 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' as bla from person where name = $1 or 1 = 1", [''], function (err, result) { diff --git a/packages/pg/test/integration/client/error-handling-tests.js b/packages/pg/test/integration/client/error-handling-tests.js index 4e879c9e0..19dc961cf 100644 --- a/packages/pg/test/integration/client/error-handling-tests.js +++ b/packages/pg/test/integration/client/error-handling-tests.js @@ -1,7 +1,6 @@ 'use strict' var helper = require('./test-helper') -var util = require('util') var pg = helper.pg const Client = pg.Client @@ -113,7 +112,7 @@ var ensureFuture = function (testClient, done) { suite.test('when query is parsing', (done) => { var client = createErorrClient() - var q = client.query({ text: 'CREATE TEMP TABLE boom(age integer); INSERT INTO boom (age) VALUES (28);' }) + client.query({ text: 'CREATE TEMP TABLE boom(age integer); INSERT INTO boom (age) VALUES (28);' }) // this query wont parse since there isn't a table named bang var query = client.query( @@ -131,7 +130,7 @@ suite.test('when query is parsing', (done) => { suite.test('when a query is binding', function (done) { var client = createErorrClient() - var q = client.query({ text: 'CREATE TEMP TABLE boom(age integer); INSERT INTO boom (age) VALUES (28);' }) + client.query({ text: 'CREATE TEMP TABLE boom(age integer); INSERT INTO boom (age) VALUES (28);' }) var query = client.query( new pg.Query({ diff --git a/packages/pg/test/integration/client/multiple-results-tests.js b/packages/pg/test/integration/client/multiple-results-tests.js index c27295103..89c9f0057 100644 --- a/packages/pg/test/integration/client/multiple-results-tests.js +++ b/packages/pg/test/integration/client/multiple-results-tests.js @@ -33,7 +33,7 @@ suite.test( // TODO should be text or sql? try { - const results = yield client.query({ + yield client.query({ text: `SELECT 'foo'::text as name; SELECT 'bar'::text as baz`, queryMode: 'extended', }) diff --git a/packages/pg/test/integration/client/no-data-tests.js b/packages/pg/test/integration/client/no-data-tests.js index ad0f22be3..1a27e2ae4 100644 --- a/packages/pg/test/integration/client/no-data-tests.js +++ b/packages/pg/test/integration/client/no-data-tests.js @@ -5,7 +5,7 @@ const suite = new helper.Suite() suite.test('noData message handling', function () { var client = helper.client() - var q = client.query({ + client.query({ name: 'boom', text: 'create temp table boom(id serial, size integer)', }) @@ -29,7 +29,7 @@ suite.test('noData message handling', function () { values: [101], }) - var query = client.query( + client.query( { name: 'fetch', text: 'select size from boom where size < $1', diff --git a/packages/pg/test/integration/client/prepared-statement-tests.js b/packages/pg/test/integration/client/prepared-statement-tests.js index ebc1f7380..ce58373ca 100644 --- a/packages/pg/test/integration/client/prepared-statement-tests.js +++ b/packages/pg/test/integration/client/prepared-statement-tests.js @@ -9,7 +9,6 @@ var suite = new helper.Suite() client.on('drain', client.end.bind(client)) var queryName = 'user by age and like name' - var parseCount = 0 suite.test('first named prepared statement', function (done) { var query = client.query( @@ -89,7 +88,7 @@ var suite = new helper.Suite() var client2 = helper.client() suite.test('client 1 execution', function (done) { - var query = client1.query( + client1.query( { name: statementName, text: statement1, diff --git a/packages/pg/test/integration/client/result-metadata-tests.js b/packages/pg/test/integration/client/result-metadata-tests.js index 66d9ac4ae..e7f02dee5 100644 --- a/packages/pg/test/integration/client/result-metadata-tests.js +++ b/packages/pg/test/integration/client/result-metadata-tests.js @@ -19,7 +19,7 @@ new helper.Suite().test('should return insert metadata', function () { assert.equal(result.oid, null) assert.equal(result.command, 'CREATE') - var q = client.query( + client.query( "INSERT INTO zugzug(name) VALUES('more work?')", assert.calls(function (err, result) { assert(!err) diff --git a/packages/pg/test/integration/client/results-as-array-tests.js b/packages/pg/test/integration/client/results-as-array-tests.js index 5ebb2a9d5..40dc40cc2 100644 --- a/packages/pg/test/integration/client/results-as-array-tests.js +++ b/packages/pg/test/integration/client/results-as-array-tests.js @@ -23,7 +23,7 @@ test('returns results as array', function () { values: ['hai'], rowMode: 'array', } - var query = client.query( + client.query( config, assert.success(function (result) { assert.equal(result.rows.length, 1) diff --git a/packages/pg/test/integration/client/simple-query-tests.js b/packages/pg/test/integration/client/simple-query-tests.js index d22d74742..ff81a968a 100644 --- a/packages/pg/test/integration/client/simple-query-tests.js +++ b/packages/pg/test/integration/client/simple-query-tests.js @@ -18,6 +18,7 @@ test('simple query interface', function () { query.once('row', function (row) { test('Can iterate through columns', function () { var columnCount = 0 + // eslint-disable-next-line @typescript-eslint/no-unused-vars for (var column in row) { columnCount++ } diff --git a/packages/pg/test/integration/client/type-coercion-tests.js b/packages/pg/test/integration/client/type-coercion-tests.js index 9abb31347..f03ff397b 100644 --- a/packages/pg/test/integration/client/type-coercion-tests.js +++ b/packages/pg/test/integration/client/type-coercion-tests.js @@ -14,7 +14,7 @@ var testForTypeCoercion = function (type) { assert(!err) type.values.forEach(function (val) { - var insertQuery = client.query( + client.query( 'insert into test_type(col) VALUES($1)', [val], assert.calls(function (err, result) { @@ -135,8 +135,6 @@ if (helper.config.binary) { }) } -var valueCount = 0 - types.forEach(function (type) { testForTypeCoercion(type) }) diff --git a/packages/pg/test/integration/connection-pool/error-tests.js b/packages/pg/test/integration/connection-pool/error-tests.js index f3f9cdcaa..a012dce34 100644 --- a/packages/pg/test/integration/connection-pool/error-tests.js +++ b/packages/pg/test/integration/connection-pool/error-tests.js @@ -18,7 +18,6 @@ suite.test('errors emitted on checked-out clients', (cb) => { client.query('SELECT NOW()', function () { pool.connect( assert.success(function (client2, done2) { - var pidColName = 'procpid' helper.versionGTE( client2, 90200, diff --git a/packages/pg/test/integration/connection/copy-tests.js b/packages/pg/test/integration/connection/copy-tests.js index 177009d00..7e0aeddd4 100644 --- a/packages/pg/test/integration/connection/copy-tests.js +++ b/packages/pg/test/integration/connection/copy-tests.js @@ -4,7 +4,7 @@ var assert = require('assert') test('COPY FROM events check', function () { helper.connect(function (con) { - var stdinStream = con.query('COPY person FROM STDIN') + con.query('COPY person FROM STDIN') con.on('copyInResponse', function () { con.endCopyFrom() }) @@ -28,7 +28,7 @@ test('COPY FROM events check', function () { }) test('COPY TO events check', function () { helper.connect(function (con) { - var stdoutStream = con.query('COPY person TO STDOUT') + con.query('COPY person TO STDOUT') assert.emits(con, 'copyOutResponse', function () {}, 'backend should emit copyOutResponse after COPY TO query') assert.emits(con, 'copyData', function () {}, 'backend should emit copyData on every data row') assert.emits( diff --git a/packages/pg/test/integration/connection/test-helper.js b/packages/pg/test/integration/connection/test-helper.js index 475f30333..a36023402 100644 --- a/packages/pg/test/integration/connection/test-helper.js +++ b/packages/pg/test/integration/connection/test-helper.js @@ -2,7 +2,6 @@ var net = require('net') var helper = require('../test-helper') var Connection = require('../../../lib/connection') -var utils = require('../../../lib/utils') const crypto = require('../../../lib/crypto/utils') var connect = function (callback) { var username = helper.args.user diff --git a/packages/pg/test/integration/domain-tests.js b/packages/pg/test/integration/domain-tests.js index a90880bcd..07453d000 100644 --- a/packages/pg/test/integration/domain-tests.js +++ b/packages/pg/test/integration/domain-tests.js @@ -29,7 +29,7 @@ suite.test('with domain', function (cb) { assert.success(function (client, done) { assert(process.domain, 'no domain exists in connect callback') assert.equal(startingDomain, process.domain, 'domain was lost when checking out a client') - var query = client.query( + client.query( 'SELECT NOW()', assert.success(function () { assert(process.domain, 'no domain exists in query callback') diff --git a/packages/pg/test/integration/gh-issues/1542-tests.js b/packages/pg/test/integration/gh-issues/1542-tests.js index f65aa3fb6..6ad075b22 100644 --- a/packages/pg/test/integration/gh-issues/1542-tests.js +++ b/packages/pg/test/integration/gh-issues/1542-tests.js @@ -17,6 +17,6 @@ suite.testAsync('BoundPool can be subclassed', async () => { suite.test('calling pg.Pool without new throws', () => { const Pool = helper.pg.Pool assert.throws(() => { - const pool = Pool() + Pool() }) }) diff --git a/packages/pg/test/integration/gh-issues/2064-tests.js b/packages/pg/test/integration/gh-issues/2064-tests.js index 6118ca2f4..0878b7941 100644 --- a/packages/pg/test/integration/gh-issues/2064-tests.js +++ b/packages/pg/test/integration/gh-issues/2064-tests.js @@ -25,7 +25,6 @@ suite.test('Password should not exist in util.inspect output', () => { suite.test('Password should not exist in json.stringfy output', () => { const pool = new helper.pg.Pool({ password }) const client = new helper.pg.Client({ password }) - const depth = 20 assert(JSON.stringify(pool).indexOf(password) === -1) assert(JSON.stringify(client).indexOf(password) === -1) }) diff --git a/packages/pg/test/integration/gh-issues/2303-tests.js b/packages/pg/test/integration/gh-issues/2303-tests.js index 7496a6f6c..533ae1645 100644 --- a/packages/pg/test/integration/gh-issues/2303-tests.js +++ b/packages/pg/test/integration/gh-issues/2303-tests.js @@ -25,7 +25,6 @@ suite.test('SSL Key should not exist in util.inspect output', () => { suite.test('SSL Key should not exist in json.stringfy output', () => { const pool = new helper.pg.Pool({ ssl: { key: secret_value } }) const client = new helper.pg.Client({ ssl: { key: secret_value } }) - const depth = 20 assert(JSON.stringify(pool).indexOf(secret_value) === -1) assert(JSON.stringify(client).indexOf(secret_value) === -1) }) diff --git a/packages/pg/test/unit/client/early-disconnect-tests.js b/packages/pg/test/unit/client/early-disconnect-tests.js index 494482845..cd3df3b69 100644 --- a/packages/pg/test/unit/client/early-disconnect-tests.js +++ b/packages/pg/test/unit/client/early-disconnect-tests.js @@ -1,5 +1,5 @@ 'use strict' -var helper = require('./test-helper') +require('./test-helper') var net = require('net') var pg = require('../../../lib/index.js') diff --git a/packages/pg/test/unit/client/prepared-statement-tests.js b/packages/pg/test/unit/client/prepared-statement-tests.js index 2499808f7..8ffc69721 100644 --- a/packages/pg/test/unit/client/prepared-statement-tests.js +++ b/packages/pg/test/unit/client/prepared-statement-tests.js @@ -90,9 +90,7 @@ test('bound command', function () { var portalClient = helper.client() var portalCon = portalClient.connection -var portalParseArg = null portalCon.parse = function (arg) { - portalParseArg = arg process.nextTick(function () { portalCon.emit('parseComplete') }) diff --git a/packages/pg/test/unit/client/query-queue-tests.js b/packages/pg/test/unit/client/query-queue-tests.js index 0b5eaa564..04f18a3e9 100644 --- a/packages/pg/test/unit/client/query-queue-tests.js +++ b/packages/pg/test/unit/client/query-queue-tests.js @@ -1,5 +1,5 @@ 'use strict' -var helper = require('./test-helper') +require('./test-helper') var Connection = require('../../../lib/connection') test('drain', function () { diff --git a/packages/pg/test/unit/client/result-metadata-tests.js b/packages/pg/test/unit/client/result-metadata-tests.js index a5e6542c8..9c69639da 100644 --- a/packages/pg/test/unit/client/result-metadata-tests.js +++ b/packages/pg/test/unit/client/result-metadata-tests.js @@ -6,7 +6,7 @@ var testForTag = function (tagText, callback) { var client = helper.client() client.connection.emit('readyForQuery') - var query = client.query( + client.query( 'whatever', assert.calls((err, result) => { assert.ok(result != null, 'should pass something to this event') diff --git a/packages/pg/test/unit/client/stream-and-query-error-interaction-tests.js b/packages/pg/test/unit/client/stream-and-query-error-interaction-tests.js index 892d2e87a..57b7abcf7 100644 --- a/packages/pg/test/unit/client/stream-and-query-error-interaction-tests.js +++ b/packages/pg/test/unit/client/stream-and-query-error-interaction-tests.js @@ -1,5 +1,5 @@ 'use strict' -var helper = require('./test-helper') +require('./test-helper') var Connection = require('../../../lib/connection') var Client = require('../../../lib/client') diff --git a/packages/pg/test/unit/client/throw-in-type-parser-tests.js b/packages/pg/test/unit/client/throw-in-type-parser-tests.js index 8f71fdc02..8bfdba4e9 100644 --- a/packages/pg/test/unit/client/throw-in-type-parser-tests.js +++ b/packages/pg/test/unit/client/throw-in-type-parser-tests.js @@ -32,7 +32,6 @@ const emitFakeEvents = (con) => { } suite.test('emits error', function (done) { - var handled var client = helper.client() var con = client.connection var query = client.query(new Query('whatever')) @@ -45,14 +44,10 @@ suite.test('emits error', function (done) { }) suite.test('calls callback with error', function (done) { - var handled - - var callbackCalled = 0 - var client = helper.client() var con = client.connection emitFakeEvents(con) - var query = client.query('whatever', function (err) { + client.query('whatever', function (err) { assert.equal(err, typeParserError) done() }) diff --git a/packages/pg/test/unit/connection-parameters/creation-tests.js b/packages/pg/test/unit/connection-parameters/creation-tests.js index a4a837f3b..5225b9773 100644 --- a/packages/pg/test/unit/connection-parameters/creation-tests.js +++ b/packages/pg/test/unit/connection-parameters/creation-tests.js @@ -344,7 +344,6 @@ suite.test('ssl is set on client', function () { sslrootcert: '/path/root.crt', }, } - var Client = require('../../../lib/client') var defaults = require('../../../lib/defaults') defaults.ssl = true var c = new ConnectionParameters(sourceConfig) diff --git a/packages/pg/test/unit/utils-tests.js b/packages/pg/test/unit/utils-tests.js index 5eca7179f..300bbea6e 100644 --- a/packages/pg/test/unit/utils-tests.js +++ b/packages/pg/test/unit/utils-tests.js @@ -183,7 +183,6 @@ test('prepareValue: Uint8Array array prepared properly', function () { }) test('prepareValue: objects with complex toPostgres prepared properly', function () { - var buf = Buffer.from('zomgcustom!') var customType = { toPostgres: function () { return [1, 2] @@ -214,7 +213,6 @@ test('prepareValue: objects with toPostgres receive prepareValue', function () { }) test('prepareValue: objects with circular toPostgres rejected', function () { - var buf = Buffer.from('zomgcustom!') var customType = { toPostgres: function () { return {