Skip to content

Commit f6eec1d

Browse files
chore: fix outstanding eslint errors (#377)
* refactor: work around strange eslint rule bug I did a bunch of research on this and I'm fairly confident it's a bug, but I couldn't come up with a minimal repro to open an issue and felt like I couldn't justify spending more time here. This is a valuable rule, so I'd rather not suppress it here or globally. * refactor: remove unused eslint suppressions --------- Co-authored-by: Eduardo Bouças <mail@eduardoboucas.com>
1 parent 4386ac8 commit f6eec1d

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

packages/blobs/src/environment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export const getEnvironment = (): EnvironmentVariables => {
4747
declare global {
4848
// Using `var` so that the declaration is hoisted in such a way that we can
4949
// reference it before it's initialized.
50-
// eslint-disable-next-line no-var
50+
5151
var netlifyBlobsContext: unknown
5252
}
5353

packages/cache/src/fetchwithcache.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,11 @@ export const fetchWithCache: FetchWithCache = async (
134134
if (onCachePut) {
135135
await onCachePut(cachePut)
136136
} else {
137-
const requestContext = (globalThis as GlobalScope).Netlify?.context
137+
// NOTE: when `requestContext` is assigned via a single expression here, we
138+
// hit some `@typescript-eslint/no-unsafe-assignment` bug. TODO(serhalp): try
139+
// to reduce this down to a minimal repro and file an issue.
140+
const netlifyGlobal: NetlifyGlobal | undefined = (globalThis as GlobalScope).Netlify
141+
const requestContext = netlifyGlobal?.context
138142

139143
if (requestContext) {
140144
requestContext.waitUntil(cachePut)

packages/edge-functions/src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { NetlifyGlobal } from '@netlify/types'
33
declare global {
44
// Using `var` so that the declaration is hoisted in such a way that we can
55
// reference it before it's initialized.
6-
// eslint-disable-next-line no-var
6+
77
var Netlify: NetlifyGlobal
88
}
99

packages/runtime/src/lib/globals.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ declare global {
77
// Using `var` so that the declaration is hoisted in such a way that we can
88
// reference it before it's initialized.
99

10-
// eslint-disable-next-line no-var
1110
var Netlify: NetlifyGlobal
1211
}
1312

0 commit comments

Comments
 (0)