Skip to content

Commit 16322c2

Browse files
authored
Fix eslint violations (#3078)
Co-authored-by: alxndrsn <alxndrsn>
1 parent b9a528c commit 16322c2

File tree

15 files changed

+93
-50
lines changed

15 files changed

+93
-50
lines changed

docs/theme.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ export default {
3030
head: (
3131
<>
3232
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
33-
<meta name="description" content="node-postgres is a collection of node.js modules for interfacing with your PostgreSQL database." />
33+
<meta
34+
name="description"
35+
content="node-postgres is a collection of node.js modules for interfacing with your PostgreSQL database."
36+
/>
3437
<meta name="og:title" content="node-postgres" />
3538
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-100138145-1"></script>
3639
<script

packages/pg-cursor/test/error-handling.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,24 @@ describe('error handling', function () {
3030
const queuedRead1 = cursor.read(1)
3131
const queuedRead2 = cursor.read(1)
3232

33-
assert(await immediateRead.then(() => null, (err) => err))
34-
assert(await queuedRead1.then(() => null, (err) => err))
35-
assert(await queuedRead2.then(() => null, (err) => err))
33+
assert(
34+
await immediateRead.then(
35+
() => null,
36+
(err) => err
37+
)
38+
)
39+
assert(
40+
await queuedRead1.then(
41+
() => null,
42+
(err) => err
43+
)
44+
)
45+
assert(
46+
await queuedRead2.then(
47+
() => null,
48+
(err) => err
49+
)
50+
)
3651

3752
client.end()
3853
})

packages/pg-pool/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ function promisify(Promise, callback) {
3939
const result = new Promise(function (resolve, reject) {
4040
res = resolve
4141
rej = reject
42-
}).catch(err => {
42+
}).catch((err) => {
4343
// replace the stack trace that leads to `TCP.onStreamRead` with one that leads back to the
4444
// application that created the query
45-
Error.captureStackTrace(err);
46-
throw err;
45+
Error.captureStackTrace(err)
46+
throw err
4747
})
4848
return { callback: cb, result: result }
4949
}

packages/pg-pool/test/idle-timeout-exit.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ if (module === require.main) {
33
const allowExitOnIdle = process.env.ALLOW_EXIT_ON_IDLE === '1'
44
const Pool = require('../index')
55

6-
const pool = new Pool({ maxLifetimeSeconds: 2, idleTimeoutMillis: 200, ...(allowExitOnIdle ? { allowExitOnIdle: true } : {}) })
6+
const pool = new Pool({
7+
maxLifetimeSeconds: 2,
8+
idleTimeoutMillis: 200,
9+
...(allowExitOnIdle ? { allowExitOnIdle: true } : {}),
10+
})
711
pool.query('SELECT NOW()', (err, res) => console.log('completed first'))
812
pool.on('remove', () => {
913
console.log('removed')

packages/pg/bench.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
const pg = require('./lib')
22

33
const params = {
4-
text:
5-
'select typname, typnamespace, typowner, typlen, typbyval, typcategory, typispreferred, typisdefined, typdelim, typrelid, typelem, typarray from pg_type where typtypmod = $1 and typisdefined = $2',
4+
text: 'select typname, typnamespace, typowner, typlen, typbyval, typcategory, typispreferred, typisdefined, typdelim, typrelid, typelem, typarray from pg_type where typtypmod = $1 and typisdefined = $2',
65
values: [-1, true],
76
}
87

packages/pg/lib/client.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -520,11 +520,11 @@ class Client extends EventEmitter {
520520
if (!query.callback) {
521521
result = new this._Promise((resolve, reject) => {
522522
query.callback = (err, res) => (err ? reject(err) : resolve(res))
523-
}).catch(err => {
523+
}).catch((err) => {
524524
// replace the stack trace that leads to `TCP.onStreamRead` with one that leads back to the
525525
// application that created the query
526-
Error.captureStackTrace(err);
527-
throw err;
526+
Error.captureStackTrace(err)
527+
throw err
528528
})
529529
}
530530
}

packages/pg/lib/crypto/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ if (useLegacyCrypto) {
55
// We are on an old version of Node.js that requires legacy crypto utilities.
66
module.exports = require('./utils-legacy')
77
} else {
8-
module.exports = require('./utils-webcrypto');
8+
module.exports = require('./utils-webcrypto')
99
}

packages/pg/lib/native/client.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,9 @@ Client.prototype.query = function (config, values, callback) {
174174
result = new this._Promise((resolve, reject) => {
175175
resolveOut = resolve
176176
rejectOut = reject
177-
}).catch(err => {
178-
Error.captureStackTrace(err);
179-
throw err;
177+
}).catch((err) => {
178+
Error.captureStackTrace(err)
179+
throw err
180180
})
181181
query.callback = (err, res) => (err ? rejectOut(err) : resolveOut(res))
182182
}

packages/pg/lib/query.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,7 @@ class Query extends EventEmitter {
137137
if (this.callback) {
138138
try {
139139
this.callback(null, this._results)
140-
}
141-
catch(err) {
140+
} catch (err) {
142141
process.nextTick(() => {
143142
throw err
144143
})

packages/pg/test/integration/client/async-stack-trace-tests.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,42 +10,42 @@ process.on('unhandledRejection', function (e) {
1010
const suite = new helper.Suite()
1111

1212
// these tests will only work for if --async-stack-traces is on, which is the default starting in node 16.
13-
const NODE_MAJOR_VERSION = +process.versions.node.split('.')[0];
13+
const NODE_MAJOR_VERSION = +process.versions.node.split('.')[0]
1414
if (NODE_MAJOR_VERSION >= 16) {
1515
suite.testAsync('promise API async stack trace in pool', async function outerFunction() {
1616
async function innerFunction() {
1717
const pool = new pg.Pool()
18-
await pool.query('SELECT test from nonexistent');
18+
await pool.query('SELECT test from nonexistent')
1919
}
2020
try {
21-
await innerFunction();
22-
throw Error("should have errored");
21+
await innerFunction()
22+
throw Error('should have errored')
2323
} catch (e) {
24-
const stack = e.stack;
25-
if(!e.stack.includes("innerFunction") || !e.stack.includes("outerFunction")) {
26-
throw Error("async stack trace does not contain wanted values: " + stack);
24+
const stack = e.stack
25+
if (!e.stack.includes('innerFunction') || !e.stack.includes('outerFunction')) {
26+
throw Error('async stack trace does not contain wanted values: ' + stack)
2727
}
2828
}
2929
})
3030

3131
suite.testAsync('promise API async stack trace in client', async function outerFunction() {
3232
async function innerFunction() {
3333
const client = new pg.Client()
34-
await client.connect();
34+
await client.connect()
3535
try {
36-
await client.query('SELECT test from nonexistent');
36+
await client.query('SELECT test from nonexistent')
3737
} finally {
38-
client.end();
38+
client.end()
3939
}
4040
}
4141
try {
42-
await innerFunction();
43-
throw Error("should have errored");
42+
await innerFunction()
43+
throw Error('should have errored')
4444
} catch (e) {
45-
const stack = e.stack;
46-
if(!e.stack.includes("innerFunction") || !e.stack.includes("outerFunction")) {
47-
throw Error("async stack trace does not contain wanted values: " + stack);
45+
const stack = e.stack
46+
if (!e.stack.includes('innerFunction') || !e.stack.includes('outerFunction')) {
47+
throw Error('async stack trace does not contain wanted values: ' + stack)
4848
}
4949
}
5050
})
51-
}
51+
}

0 commit comments

Comments
 (0)