diff --git a/packages/browser-integration-tests/utils/replayHelpers.ts b/packages/browser-integration-tests/utils/replayHelpers.ts index b487342f5593..613bd5b447f1 100644 --- a/packages/browser-integration-tests/utils/replayHelpers.ts +++ b/packages/browser-integration-tests/utils/replayHelpers.ts @@ -105,40 +105,35 @@ export function waitForReplayRequest( * Wait until a callback returns true, collecting all replay responses along the way. * This can be useful when you don't know if stuff will be in one or multiple replay requests. */ -export function waitForReplayRequests( +export async function waitForReplayRequests( page: Page, callback: (event: ReplayEvent, res: Response) => boolean, timeout?: number, ): Promise { const responses: Response[] = []; - return new Promise(resolve => { - void page.waitForResponse( - res => { - const req = res.request(); + await page.waitForResponse( + res => { + const req = res.request(); - const event = getReplayEventFromRequest(req); + const event = getReplayEventFromRequest(req); - if (!event) { - return false; - } + if (!event) { + return false; + } - responses.push(res); + responses.push(res); - try { - if (callback(event, res)) { - resolve(responses); - return true; - } + try { + return callback(event, res); + } catch { + return false; + } + }, + timeout ? { timeout } : undefined, + ); - return false; - } catch { - return false; - } - }, - timeout ? { timeout } : undefined, - ); - }); + return responses; } export function isReplayEvent(event: Event): event is ReplayEvent { diff --git a/packages/browser/src/client.ts b/packages/browser/src/client.ts index 4e46314f6711..c8d4e4ce2f08 100644 --- a/packages/browser/src/client.ts +++ b/packages/browser/src/client.ts @@ -106,7 +106,10 @@ export class BrowserClient extends BaseClient { dsn: this.getDsn(), tunnel: this.getOptions().tunnel, }); - void this._sendEnvelope(envelope); + + // _sendEnvelope should not throw + // eslint-disable-next-line @typescript-eslint/no-floating-promises + this._sendEnvelope(envelope); } /** @@ -137,6 +140,9 @@ export class BrowserClient extends BaseClient { DEBUG_BUILD && logger.log('Sending outcomes:', outcomes); const envelope = createClientReportEnvelope(outcomes, this._options.tunnel && dsnToString(this._dsn)); - void this._sendEnvelope(envelope); + + // _sendEnvelope should not throw + // eslint-disable-next-line @typescript-eslint/no-floating-promises + this._sendEnvelope(envelope); } } diff --git a/packages/browser/src/profiling/hubextensions.ts b/packages/browser/src/profiling/hubextensions.ts index 99e2772c8f25..f042ae016609 100644 --- a/packages/browser/src/profiling/hubextensions.ts +++ b/packages/browser/src/profiling/hubextensions.ts @@ -139,7 +139,8 @@ export function startProfileForTransaction(transaction: Transaction): Transactio ); } // If the timeout exceeds, we want to stop profiling, but not finish the transaction - void onProfileHandler(); + // eslint-disable-next-line @typescript-eslint/no-floating-promises + onProfileHandler(); }, MAX_PROFILE_DURATION_MS); // We need to reference the original finish call to avoid creating an infinite loop diff --git a/packages/core/src/baseclient.ts b/packages/core/src/baseclient.ts index 3fbdd13250f8..fc0258167530 100644 --- a/packages/core/src/baseclient.ts +++ b/packages/core/src/baseclient.ts @@ -375,7 +375,10 @@ export abstract class BaseClient implements Client { */ public sendSession(session: Session | SessionAggregates): void { const env = createSessionEnvelope(session, this._dsn, this._options._metadata, this._options.tunnel); - void this._sendEnvelope(env); + + // _sendEnvelope should not throw + // eslint-disable-next-line @typescript-eslint/no-floating-promises + this._sendEnvelope(env); } /** @@ -409,7 +412,10 @@ export abstract class BaseClient implements Client { this._options._metadata, this._options.tunnel, ); - void this._sendEnvelope(metricsEnvelope); + + // _sendEnvelope should not throw + // eslint-disable-next-line @typescript-eslint/no-floating-promises + this._sendEnvelope(metricsEnvelope); } // Keep on() & emit() signatures in sync with types' client.ts interface diff --git a/packages/core/src/server-runtime-client.ts b/packages/core/src/server-runtime-client.ts index 719e2b81f086..9cffaca15faf 100644 --- a/packages/core/src/server-runtime-client.ts +++ b/packages/core/src/server-runtime-client.ts @@ -193,7 +193,11 @@ export class ServerRuntimeClient< ); DEBUG_BUILD && logger.info('Sending checkin:', checkIn.monitorSlug, checkIn.status); - void this._sendEnvelope(envelope); + + // _sendEnvelope should not throw + // eslint-disable-next-line @typescript-eslint/no-floating-promises + this._sendEnvelope(envelope); + return id; } diff --git a/packages/deno/src/integrations/globalhandlers.ts b/packages/deno/src/integrations/globalhandlers.ts index 27745d6d6765..4160e3f4b3c6 100644 --- a/packages/deno/src/integrations/globalhandlers.ts +++ b/packages/deno/src/integrations/globalhandlers.ts @@ -79,10 +79,16 @@ function installGlobalErrorHandler(client: Client): void { data.preventDefault(); isExiting = true; - void flush().then(() => { - // rethrow to replicate Deno default behavior - throw error; - }); + flush().then( + () => { + // rethrow to replicate Deno default behavior + throw error; + }, + () => { + // rethrow to replicate Deno default behavior + throw error; + }, + ); }); } @@ -122,10 +128,16 @@ function installGlobalUnhandledRejectionHandler(client: Client): void { e.preventDefault(); isExiting = true; - void flush().then(() => { - // rethrow to replicate Deno default behavior - throw error; - }); + flush().then( + () => { + // rethrow to replicate Deno default behavior + throw error; + }, + () => { + // rethrow to replicate Deno default behavior + throw error; + }, + ); }); } diff --git a/packages/e2e-tests/prepare.ts b/packages/e2e-tests/prepare.ts index 7fee7677bf94..9d9c233f580d 100644 --- a/packages/e2e-tests/prepare.ts +++ b/packages/e2e-tests/prepare.ts @@ -21,4 +21,5 @@ async function run(): Promise { } } -void run(); +// eslint-disable-next-line @typescript-eslint/no-floating-promises +run(); diff --git a/packages/e2e-tests/run.ts b/packages/e2e-tests/run.ts index bdc269a867a8..a5002d7bcff9 100644 --- a/packages/e2e-tests/run.ts +++ b/packages/e2e-tests/run.ts @@ -80,4 +80,5 @@ async function run(): Promise { } } -void run(); +// eslint-disable-next-line @typescript-eslint/no-floating-promises +run(); diff --git a/packages/eslint-config-sdk/src/base.js b/packages/eslint-config-sdk/src/base.js index 982d5887c51d..a76af21e7a51 100644 --- a/packages/eslint-config-sdk/src/base.js +++ b/packages/eslint-config-sdk/src/base.js @@ -84,7 +84,7 @@ module.exports = { '@typescript-eslint/no-unused-expressions': ['error', { allowShortCircuit: true }], // Make sure Promises are handled appropriately - '@typescript-eslint/no-floating-promises': 'error', + '@typescript-eslint/no-floating-promises': ['error', { ignoreVoid: false }], // Disallow delete operator. We should make this operation opt in (by disabling this rule). '@typescript-eslint/no-dynamic-delete': 'error', @@ -158,7 +158,17 @@ module.exports = { env: { jest: true, }, - files: ['test.ts', '*.test.ts', '*.test.tsx', '*.test.js', '*.test.jsx', 'test/**/*.ts', 'test/**/*.js'], + files: [ + 'test.ts', + '*.test.ts', + '*.test.tsx', + '*.test.js', + '*.test.jsx', + 'test/**/*.ts', + 'test/**/*.js', + 'tests/**/*.ts', + 'tests/**/*.js', + ], rules: { 'max-lines': 'off', '@typescript-eslint/explicit-function-return-type': 'off', @@ -171,6 +181,7 @@ module.exports = { '@typescript-eslint/no-empty-function': 'off', '@sentry-internal/sdk/no-optional-chaining': 'off', '@sentry-internal/sdk/no-nullish-coalescing': 'off', + '@typescript-eslint/no-floating-promises': 'off', }, }, { diff --git a/packages/integrations/scripts/buildBundles.ts b/packages/integrations/scripts/buildBundles.ts index 98a2a3456300..c3c61ed66ef3 100644 --- a/packages/integrations/scripts/buildBundles.ts +++ b/packages/integrations/scripts/buildBundles.ts @@ -47,7 +47,8 @@ if (runParallel) { process.exit(1); }); } else { - void (async () => { + // eslint-disable-next-line @typescript-eslint/no-floating-promises + (async () => { for (const integration of getIntegrations()) { await buildBundle(integration, 'es5'); await buildBundle(integration, 'es6'); diff --git a/packages/nextjs/src/common/utils/responseEnd.ts b/packages/nextjs/src/common/utils/responseEnd.ts index 4d0fc40082ec..64a3d2c59c52 100644 --- a/packages/nextjs/src/common/utils/responseEnd.ts +++ b/packages/nextjs/src/common/utils/responseEnd.ts @@ -26,7 +26,7 @@ import type { ResponseEndMethod, WrappedResponseEndMethod } from '../types'; export function autoEndTransactionOnResponseEnd(transaction: Transaction, res: ServerResponse): void { const wrapEndMethod = (origEnd: ResponseEndMethod): WrappedResponseEndMethod => { return function sentryWrappedEnd(this: ServerResponse, ...args: unknown[]) { - void finishTransaction(transaction, this); + finishTransaction(transaction, this); return origEnd.call(this, ...args); }; }; @@ -39,7 +39,7 @@ export function autoEndTransactionOnResponseEnd(transaction: Transaction, res: S } /** Finish the given response's transaction and set HTTP status data */ -export async function finishTransaction(transaction: Transaction | undefined, res: ServerResponse): Promise { +export function finishTransaction(transaction: Transaction | undefined, res: ServerResponse): void { if (transaction) { transaction.setHttpStatus(res.statusCode); transaction.finish(); diff --git a/packages/nextjs/src/common/withServerActionInstrumentation.ts b/packages/nextjs/src/common/withServerActionInstrumentation.ts index d87429ad528c..d850b3e362f9 100644 --- a/packages/nextjs/src/common/withServerActionInstrumentation.ts +++ b/packages/nextjs/src/common/withServerActionInstrumentation.ts @@ -129,7 +129,9 @@ async function withServerActionInstrumentationImplementation any> } }, () => { - void flushQueue(); + // flushQueue should not throw + // eslint-disable-next-line @typescript-eslint/no-floating-promises + flushQueue(); }, ); diff --git a/packages/node-integration-tests/suites/tracing-new/apollo-graphql/scenario.ts b/packages/node-integration-tests/suites/tracing-new/apollo-graphql/scenario.ts index 7fdbfce0351c..0c53294d1f4f 100644 --- a/packages/node-integration-tests/suites/tracing-new/apollo-graphql/scenario.ts +++ b/packages/node-integration-tests/suites/tracing-new/apollo-graphql/scenario.ts @@ -31,7 +31,8 @@ const transaction = Sentry.startTransaction({ name: 'test_transaction', op: 'tra Sentry.getCurrentScope().setSpan(transaction); -void (async () => { +// eslint-disable-next-line @typescript-eslint/no-floating-promises +(async () => { // Ref: https://www.apollographql.com/docs/apollo-server/testing/testing/#testing-using-executeoperation await server.executeOperation({ query: '{hello}', diff --git a/packages/node-integration-tests/suites/tracing-new/auto-instrument/mongodb/scenario.ts b/packages/node-integration-tests/suites/tracing-new/auto-instrument/mongodb/scenario.ts index cae4627e7096..9d747e2eff4b 100644 --- a/packages/node-integration-tests/suites/tracing-new/auto-instrument/mongodb/scenario.ts +++ b/packages/node-integration-tests/suites/tracing-new/auto-instrument/mongodb/scenario.ts @@ -41,4 +41,5 @@ async function run(): Promise { } } -void run(); +// eslint-disable-next-line @typescript-eslint/no-floating-promises +run(); diff --git a/packages/node-integration-tests/suites/tracing-new/prisma-orm/scenario.ts b/packages/node-integration-tests/suites/tracing-new/prisma-orm/scenario.ts index c7a5ef761a82..ee73dc922747 100644 --- a/packages/node-integration-tests/suites/tracing-new/prisma-orm/scenario.ts +++ b/packages/node-integration-tests/suites/tracing-new/prisma-orm/scenario.ts @@ -42,4 +42,5 @@ async function run(): Promise { } } -void run(); +// eslint-disable-next-line @typescript-eslint/no-floating-promises +run(); diff --git a/packages/node-integration-tests/suites/tracing/apollo-graphql/scenario.ts b/packages/node-integration-tests/suites/tracing/apollo-graphql/scenario.ts index 4a4d5a989227..0e5e0bd9edd0 100644 --- a/packages/node-integration-tests/suites/tracing/apollo-graphql/scenario.ts +++ b/packages/node-integration-tests/suites/tracing/apollo-graphql/scenario.ts @@ -33,7 +33,8 @@ const transaction = Sentry.startTransaction({ name: 'test_transaction', op: 'tra Sentry.getCurrentScope().setSpan(transaction); -void (async () => { +// eslint-disable-next-line @typescript-eslint/no-floating-promises +(async () => { // Ref: https://www.apollographql.com/docs/apollo-server/testing/testing/#testing-using-executeoperation await server.executeOperation({ query: '{hello}', diff --git a/packages/node-integration-tests/suites/tracing/auto-instrument/mongodb/scenario.ts b/packages/node-integration-tests/suites/tracing/auto-instrument/mongodb/scenario.ts index 5bd16772d50f..7979ea57483b 100644 --- a/packages/node-integration-tests/suites/tracing/auto-instrument/mongodb/scenario.ts +++ b/packages/node-integration-tests/suites/tracing/auto-instrument/mongodb/scenario.ts @@ -42,4 +42,5 @@ async function run(): Promise { } } -void run(); +// eslint-disable-next-line @typescript-eslint/no-floating-promises +run(); diff --git a/packages/node-integration-tests/suites/tracing/prisma-orm/scenario.ts b/packages/node-integration-tests/suites/tracing/prisma-orm/scenario.ts index 0014717b5fc4..578c5802fea0 100644 --- a/packages/node-integration-tests/suites/tracing/prisma-orm/scenario.ts +++ b/packages/node-integration-tests/suites/tracing/prisma-orm/scenario.ts @@ -44,4 +44,5 @@ async function run(): Promise { } } -void run(); +// eslint-disable-next-line @typescript-eslint/no-floating-promises +run(); diff --git a/packages/node-integration-tests/utils/index.ts b/packages/node-integration-tests/utils/index.ts index ced5b2475aee..b2b81361c0ea 100644 --- a/packages/node-integration-tests/utils/index.ts +++ b/packages/node-integration-tests/utils/index.ts @@ -184,7 +184,8 @@ export class TestEnv { envelopeTypeArray, ); - void makeRequest(options.method, options.url || this.url, this._axiosConfig); + // eslint-disable-next-line @typescript-eslint/no-floating-promises + makeRequest(options.method, options.url || this.url, this._axiosConfig); return resProm; } @@ -305,7 +306,8 @@ export class TestEnv { nock.cleanAll(); - void this._closeServer().then(() => { + // eslint-disable-next-line @typescript-eslint/no-floating-promises + this._closeServer().then(() => { resolve(reqCount); }); }, diff --git a/packages/node-integration-tests/utils/run-tests.ts b/packages/node-integration-tests/utils/run-tests.ts index 3ff976e18443..90b78bf2521c 100644 --- a/packages/node-integration-tests/utils/run-tests.ts +++ b/packages/node-integration-tests/utils/run-tests.ts @@ -70,7 +70,8 @@ const workers = os.cpus().map(async (_, i) => { } }); -void Promise.all(workers).then(() => { +// eslint-disable-next-line @typescript-eslint/no-floating-promises +Promise.all(workers).then(() => { console.log('-------------------'); console.log(`Successfully ran ${numTests} tests.`); if (fails.length > 0) { diff --git a/packages/node/src/integrations/anr/worker.ts b/packages/node/src/integrations/anr/worker.ts index fd333314e3eb..142fe0d608e7 100644 --- a/packages/node/src/integrations/anr/worker.ts +++ b/packages/node/src/integrations/anr/worker.ts @@ -152,7 +152,9 @@ if (options.captureStackTrace) { session.post('Debugger.disable'); const context = trace_id?.length && span_id?.length ? { trace_id, span_id, parent_span_id } : undefined; - void sendAnrEvent(stackFrames, context); + sendAnrEvent(stackFrames, context).then(null, () => { + log('Sending ANR event failed.'); + }); }, ); } catch (e) { @@ -196,7 +198,9 @@ function watchdogTimeout(): void { debuggerPause(); } else { log('Capturing event without a stack trace'); - void sendAnrEvent(); + sendAnrEvent().then(null, () => { + log('Sending ANR event failed on watchdog timeout.'); + }); } } diff --git a/packages/overhead-metrics/src/perf/network.ts b/packages/overhead-metrics/src/perf/network.ts index c6755f091ebf..03b76d2fcc4d 100644 --- a/packages/overhead-metrics/src/perf/network.ts +++ b/packages/overhead-metrics/src/perf/network.ts @@ -71,11 +71,13 @@ export class NetworkUsageCollector { this._events.push(event); // Note: playwright would error out on file:/// requests. They are used to access local test app resources. if (url.startsWith('file:///')) { - void route.continue(); + // eslint-disable-next-line @typescript-eslint/no-floating-promises + route.continue(); } else { const response = await route.fetch(); const body = await response.body(); - void route.fulfill({ response, body }); + // eslint-disable-next-line @typescript-eslint/no-floating-promises + route.fulfill({ response, body }); event.responseTimeNs = process.hrtime.bigint(); event.responseSize = body.length; } diff --git a/packages/remix/src/utils/instrumentServer.ts b/packages/remix/src/utils/instrumentServer.ts index ea87b961493c..36f41968edb5 100644 --- a/packages/remix/src/utils/instrumentServer.ts +++ b/packages/remix/src/utils/instrumentServer.ts @@ -91,7 +91,9 @@ export function wrapRemixHandleError(err: unknown, { request }: DataFunctionArgs return; } - void captureRemixServerException(err, 'remix.server.handleError', request); + captureRemixServerException(err, 'remix.server.handleError', request).then(null, e => { + DEBUG_BUILD && logger.warn('Failed to capture Remix Server exception.', e); + }); } /** diff --git a/packages/replay/src/coreHandlers/handleAfterSendEvent.ts b/packages/replay/src/coreHandlers/handleAfterSendEvent.ts index 5cc2adf77a59..28e112e736f0 100644 --- a/packages/replay/src/coreHandlers/handleAfterSendEvent.ts +++ b/packages/replay/src/coreHandlers/handleAfterSendEvent.ts @@ -74,7 +74,9 @@ function handleErrorEvent(replay: ReplayContainer, event: ErrorEvent): void { setTimeout(() => { // Capture current event buffer as new replay - void replay.sendBufferedReplayOrFlush(); + // This should never reject + // eslint-disable-next-line @typescript-eslint/no-floating-promises + replay.sendBufferedReplayOrFlush(); }); } diff --git a/packages/replay/src/coreHandlers/handleGlobalEvent.ts b/packages/replay/src/coreHandlers/handleGlobalEvent.ts index 3dbe1498f987..39983a85d72e 100644 --- a/packages/replay/src/coreHandlers/handleGlobalEvent.ts +++ b/packages/replay/src/coreHandlers/handleGlobalEvent.ts @@ -44,7 +44,9 @@ export function handleGlobalEventListener( } if (isFeedbackEvent(event)) { - void replay.flush(); + // This should never reject + // eslint-disable-next-line @typescript-eslint/no-floating-promises + replay.flush(); event.contexts.feedback.replay_id = replay.getSessionId(); // Add a replay breadcrumb for this piece of feedback addFeedbackBreadcrumb(replay, event); diff --git a/packages/replay/src/coreHandlers/handleNetworkBreadcrumbs.ts b/packages/replay/src/coreHandlers/handleNetworkBreadcrumbs.ts index 1ee12c7f5fe0..4a201ae9b65e 100644 --- a/packages/replay/src/coreHandlers/handleNetworkBreadcrumbs.ts +++ b/packages/replay/src/coreHandlers/handleNetworkBreadcrumbs.ts @@ -79,7 +79,9 @@ export function beforeAddNetworkBreadcrumb( // So any async mutations to it will not be reflected in the final breadcrumb enrichXhrBreadcrumb(breadcrumb, hint, options); - void captureXhrBreadcrumbToReplay(breadcrumb, hint, options); + // This call should not reject + // eslint-disable-next-line @typescript-eslint/no-floating-promises + captureXhrBreadcrumbToReplay(breadcrumb, hint, options); } if (_isFetchBreadcrumb(breadcrumb) && _isFetchHint(hint)) { @@ -88,7 +90,9 @@ export function beforeAddNetworkBreadcrumb( // So any async mutations to it will not be reflected in the final breadcrumb enrichFetchBreadcrumb(breadcrumb, hint, options); - void captureFetchBreadcrumbToReplay(breadcrumb, hint, options); + // This call should not reject + // eslint-disable-next-line @typescript-eslint/no-floating-promises + captureFetchBreadcrumbToReplay(breadcrumb, hint, options); } } catch (e) { DEBUG_BUILD && logger.warn('Error when enriching network breadcrumb'); diff --git a/packages/replay/src/coreHandlers/util/addBreadcrumbEvent.ts b/packages/replay/src/coreHandlers/util/addBreadcrumbEvent.ts index 947fb12f1ae4..a324e5b24b25 100644 --- a/packages/replay/src/coreHandlers/util/addBreadcrumbEvent.ts +++ b/packages/replay/src/coreHandlers/util/addBreadcrumbEvent.ts @@ -19,7 +19,9 @@ export function addBreadcrumbEvent(replay: ReplayContainer, breadcrumb: Breadcru } replay.addUpdate(() => { - void replay.throttledAddEvent({ + // This should never reject + // eslint-disable-next-line @typescript-eslint/no-floating-promises + replay.throttledAddEvent({ type: EventType.Custom, // TODO: We were converting from ms to seconds for breadcrumbs, spans, // but maybe we should just keep them as milliseconds diff --git a/packages/replay/src/coreHandlers/util/addFeedbackBreadcrumb.ts b/packages/replay/src/coreHandlers/util/addFeedbackBreadcrumb.ts index 5f2808d9b57d..0e08b459d3ca 100644 --- a/packages/replay/src/coreHandlers/util/addFeedbackBreadcrumb.ts +++ b/packages/replay/src/coreHandlers/util/addFeedbackBreadcrumb.ts @@ -15,7 +15,9 @@ export function addFeedbackBreadcrumb(replay: ReplayContainer, event: FeedbackEv return true; } - void replay.throttledAddEvent({ + // This should never reject + // eslint-disable-next-line @typescript-eslint/no-floating-promises + replay.throttledAddEvent({ type: EventType.Custom, timestamp: event.timestamp * 1000, data: { diff --git a/packages/replay/src/eventBuffer/EventBufferCompressionWorker.ts b/packages/replay/src/eventBuffer/EventBufferCompressionWorker.ts index 6e707638386f..21206ea652ac 100644 --- a/packages/replay/src/eventBuffer/EventBufferCompressionWorker.ts +++ b/packages/replay/src/eventBuffer/EventBufferCompressionWorker.ts @@ -1,6 +1,8 @@ import type { ReplayRecordingData } from '@sentry/types'; +import { logger } from '@sentry/utils'; import { REPLAY_MAX_EVENT_BUFFER_SIZE } from '../constants'; +import { DEBUG_BUILD } from '../debug-build'; import type { AddEventResult, EventBuffer, EventBufferType, RecordingEvent } from '../types'; import { timestampToMs } from '../util/timestamp'; import { WorkerHandler } from './WorkerHandler'; @@ -85,7 +87,9 @@ export class EventBufferCompressionWorker implements EventBuffer { this.hasCheckout = false; // We do not wait on this, as we assume the order of messages is consistent for the worker - void this._worker.postMessage('clear'); + this._worker.postMessage('clear').then(null, e => { + DEBUG_BUILD && logger.warn('[Replay] Sending "clear" message to worker failed', e); + }); } /** @inheritdoc */ diff --git a/packages/replay/src/replay.ts b/packages/replay/src/replay.ts index 87c71dddec3e..75ec17f3627e 100644 --- a/packages/replay/src/replay.ts +++ b/packages/replay/src/replay.ts @@ -786,7 +786,9 @@ export class ReplayContainer implements ReplayContainerInterface { maxReplayDuration: this._options.maxReplayDuration, }) ) { - void this._refreshSession(currentSession); + // This should never reject + // eslint-disable-next-line @typescript-eslint/no-floating-promises + this._refreshSession(currentSession); return false; } @@ -925,6 +927,8 @@ export class ReplayContainer implements ReplayContainerInterface { // Send replay when the page/tab becomes hidden. There is no reason to send // replay if it becomes visible, since no actions we care about were done // while it was hidden + // This should never reject + // eslint-disable-next-line @typescript-eslint/no-floating-promises void this.conditionalFlush(); } @@ -973,7 +977,9 @@ export class ReplayContainer implements ReplayContainerInterface { */ private _createCustomBreadcrumb(breadcrumb: ReplayBreadcrumbFrame): void { this.addUpdate(() => { - void this.throttledAddEvent({ + // This should never reject + // eslint-disable-next-line @typescript-eslint/no-floating-promises + this.throttledAddEvent({ type: EventType.Custom, timestamp: breadcrumb.timestamp || 0, data: { @@ -1114,7 +1120,9 @@ export class ReplayContainer implements ReplayContainerInterface { // This means we retried 3 times and all of them failed, // or we ran into a problem we don't want to retry, like rate limiting. // In this case, we want to completely stop the replay - otherwise, we may get inconsistent segments - void this.stop({ reason: 'sendReplay' }); + // This should never reject + // eslint-disable-next-line @typescript-eslint/no-floating-promises + this.stop({ reason: 'sendReplay' }); const client = getClient(); @@ -1238,7 +1246,9 @@ export class ReplayContainer implements ReplayContainerInterface { // Stop replay if over the mutation limit if (overMutationLimit) { - void this.stop({ reason: 'mutationLimit', forceFlush: this.recordingMode === 'session' }); + // This should never reject + // eslint-disable-next-line @typescript-eslint/no-floating-promises + this.stop({ reason: 'mutationLimit', forceFlush: this.recordingMode === 'session' }); return false; } diff --git a/packages/replay/src/util/addEvent.ts b/packages/replay/src/util/addEvent.ts index 7ea5d165eac5..893c6b7d01a4 100644 --- a/packages/replay/src/util/addEvent.ts +++ b/packages/replay/src/util/addEvent.ts @@ -25,7 +25,9 @@ export function addEventSync(replay: ReplayContainer, event: RecordingEvent, isC return false; } - void _addEvent(replay, event, isCheckout); + // This should never reject + // eslint-disable-next-line @typescript-eslint/no-floating-promises + _addEvent(replay, event, isCheckout); return true; } diff --git a/packages/replay/src/util/addGlobalListeners.ts b/packages/replay/src/util/addGlobalListeners.ts index 1824e1fa606c..85f253363c7a 100644 --- a/packages/replay/src/util/addGlobalListeners.ts +++ b/packages/replay/src/util/addGlobalListeners.ts @@ -65,7 +65,9 @@ export function addGlobalListeners(replay: ReplayContainer): void { client.on('beforeSendFeedback', (feedbackEvent, options) => { const replayId = replay.getSessionId(); if (options && options.includeReplay && replay.isEnabled() && replayId) { - void replay.flush(); + // This should never reject + // eslint-disable-next-line @typescript-eslint/no-floating-promises + replay.flush(); if (feedbackEvent.contexts && feedbackEvent.contexts.feedback) { feedbackEvent.contexts.feedback.replay_id = replayId; } diff --git a/packages/replay/src/util/handleRecordingEmit.ts b/packages/replay/src/util/handleRecordingEmit.ts index 3ab420a717b1..1d0fd10d0aa3 100644 --- a/packages/replay/src/util/handleRecordingEmit.ts +++ b/packages/replay/src/util/handleRecordingEmit.ts @@ -100,6 +100,9 @@ export function getHandleRecordingEmit(replay: ReplayContainer): RecordingEmitCa // a previous session ID. In this case, we want to buffer events // for a set amount of time before flushing. This can help avoid // capturing replays of users that immediately close the window. + + // This should never reject + // eslint-disable-next-line @typescript-eslint/no-floating-promises void replay.flush(); } diff --git a/packages/serverless/scripts/buildLambdaLayer.ts b/packages/serverless/scripts/buildLambdaLayer.ts index 99140ccb0513..540a1cab7451 100644 --- a/packages/serverless/scripts/buildLambdaLayer.ts +++ b/packages/serverless/scripts/buildLambdaLayer.ts @@ -54,7 +54,8 @@ async function buildLambdaLayer(): Promise { run(`zip -r -y ${zipFilename} .`, { cwd: 'build/aws/dist-serverless' }); } -void buildLambdaLayer(); +// eslint-disable-next-line @typescript-eslint/no-floating-promises +buildLambdaLayer(); /** * Make a directory synchronously, overwriting the old directory if necessary. diff --git a/packages/serverless/src/gcpfunction/cloud_events.ts b/packages/serverless/src/gcpfunction/cloud_events.ts index 63303470d9e9..0e89216a2fd7 100644 --- a/packages/serverless/src/gcpfunction/cloud_events.ts +++ b/packages/serverless/src/gcpfunction/cloud_events.ts @@ -54,7 +54,8 @@ function _wrapCloudEventFunction( } transaction?.finish(); - void flush(options.flushTimeout) + // eslint-disable-next-line @typescript-eslint/no-floating-promises + flush(options.flushTimeout) .then(null, e => { DEBUG_BUILD && logger.error(e); }) diff --git a/packages/serverless/src/gcpfunction/events.ts b/packages/serverless/src/gcpfunction/events.ts index 29d151593990..b69335b272d7 100644 --- a/packages/serverless/src/gcpfunction/events.ts +++ b/packages/serverless/src/gcpfunction/events.ts @@ -56,7 +56,8 @@ function _wrapEventFunction } transaction?.finish(); - void flush(options.flushTimeout) + // eslint-disable-next-line @typescript-eslint/no-floating-promises + flush(options.flushTimeout) .then(null, e => { DEBUG_BUILD && logger.error(e); }) diff --git a/packages/serverless/src/gcpfunction/http.ts b/packages/serverless/src/gcpfunction/http.ts index 95c84cafeb80..726f56c91a52 100644 --- a/packages/serverless/src/gcpfunction/http.ts +++ b/packages/serverless/src/gcpfunction/http.ts @@ -110,7 +110,8 @@ function _wrapHttpFunction(fn: HttpFunction, wrapOptions: Partial { DEBUG_BUILD && logger.error(e); }) diff --git a/packages/vercel-edge/src/transports/index.ts b/packages/vercel-edge/src/transports/index.ts index d73e7fd4341b..b2b899ecdb42 100644 --- a/packages/vercel-edge/src/transports/index.ts +++ b/packages/vercel-edge/src/transports/index.ts @@ -60,7 +60,9 @@ export class IsolatedPromiseBuffer { } }, timeout); - void Promise.all( + // This cannot reject + // eslint-disable-next-line @typescript-eslint/no-floating-promises + Promise.all( oldTaskProducers.map(taskProducer => taskProducer().then(null, () => { // catch all failed requests