Skip to content

Commit a4f3bf9

Browse files
author
alxndrsn
committed
revert eslint ES version changes; add globalThis & navigator exceptions
1 parent 5f071b1 commit a4f3bf9

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

.eslintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44
"extends": ["eslint:recommended", "plugin:prettier/recommended", "prettier"],
55
"ignorePatterns": ["node_modules", "coverage", "packages/pg-protocol/dist/**/*", "packages/pg-query-stream/dist/**/*"],
66
"parserOptions": {
7+
"ecmaVersion": 2017,
78
"sourceType": "module"
89
},
910
"env": {
1011
"node": true,
11-
"es2020": true,
12+
"es6": true,
1213
"mocha": true
1314
},
1415
"rules": {

packages/pg/lib/crypto/utils-webcrypto.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ module.exports = {
1414
* The Web Crypto API - grabbed from the Node.js library or the global
1515
* @type Crypto
1616
*/
17+
// eslint-disable-next-line no-undef
1718
const webCrypto = nodeCrypto.webcrypto || globalThis.crypto
1819
/**
1920
* The SubtleCrypto API for low level crypto operations.

packages/pg/lib/stream.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,10 @@ function getCloudflareStreamFuncs() {
6060
function isCloudflareRuntime() {
6161
// Since 2022-03-21 the `global_navigator` compatibility flag is on for Cloudflare Workers
6262
// which means that `navigator.userAgent` will be defined.
63-
if (
64-
typeof globalThis.navigator === 'object' &&
65-
globalThis.navigator !== null &&
66-
typeof globalThis.navigator.userAgent === 'string'
67-
) {
68-
return globalThis.navigator.userAgent === 'Cloudflare-Workers'
63+
// eslint-disable-next-line no-undef
64+
if (typeof navigator === 'object' && navigator !== null && typeof navigator.userAgent === 'string') {
65+
// eslint-disable-next-line no-undef
66+
return navigator.userAgent === 'Cloudflare-Workers'
6967
}
7068
// In case `navigator` or `navigator.userAgent` is not defined then try a more sneaky approach
7169
if (typeof Response === 'function') {

0 commit comments

Comments
 (0)