diff --git a/packages/browser/src/transports/fetch.ts b/packages/browser/src/transports/fetch.ts index 588a2e0d8c2f..bb47cc2fa621 100644 --- a/packages/browser/src/transports/fetch.ts +++ b/packages/browser/src/transports/fetch.ts @@ -132,7 +132,7 @@ export class FetchTransport extends BaseTransport { return this._buffer.add( new SyncPromise((resolve, reject) => { - this._fetch(sentryRequest.url, options) + void this._fetch(sentryRequest.url, options) .then(response => { const headers = { 'x-sentry-rate-limits': response.headers.get('X-Sentry-Rate-Limits'), diff --git a/packages/integrations/src/offline.ts b/packages/integrations/src/offline.ts index 654795b018c1..5cf1be2cd069 100644 --- a/packages/integrations/src/offline.ts +++ b/packages/integrations/src/offline.ts @@ -69,7 +69,7 @@ export class Offline implements Integration { if ('addEventListener' in this.global) { this.global.addEventListener('online', () => { - this._sendEvents().catch(() => { + void this._sendEvents().catch(() => { logger.warn('could not send cached events'); }); }); @@ -79,7 +79,7 @@ export class Offline implements Integration { if (this.hub && this.hub.getIntegration(Offline)) { // cache if we are positively offline if ('navigator' in this.global && 'onLine' in this.global.navigator && !this.global.navigator.onLine) { - this._cacheEvent(event) + void this._cacheEvent(event) .then((_event: Event): Promise => this._enforceMaxEvents()) .catch((_error): void => { logger.warn('could not cache event while offline'); @@ -95,7 +95,7 @@ export class Offline implements Integration { // if online now, send any events stored in a previous offline session if ('navigator' in this.global && 'onLine' in this.global.navigator && this.global.navigator.onLine) { - this._sendEvents().catch(() => { + void this._sendEvents().catch(() => { logger.warn('could not send cached events'); }); } @@ -159,7 +159,7 @@ export class Offline implements Integration { if (this.hub) { this.hub.captureEvent(event); - this._purgeEvent(cacheKey).catch((_error): void => { + void this._purgeEvent(cacheKey).catch((_error): void => { logger.warn('could not purge event from cache'); }); } else { diff --git a/packages/node/src/backend.ts b/packages/node/src/backend.ts index 0d2d3d267fc1..606cf78bd948 100644 --- a/packages/node/src/backend.ts +++ b/packages/node/src/backend.ts @@ -109,7 +109,7 @@ export class NodeBackend extends BaseBackend { return new SyncPromise(resolve => { if (this._options.attachStacktrace && hint && hint.syntheticException) { const stack = hint.syntheticException ? extractStackFromError(hint.syntheticException) : []; - parseStack(stack, this._options) + void parseStack(stack, this._options) .then(frames => { event.stacktrace = { frames: prepareFramesForEvent(frames), diff --git a/packages/node/src/handlers.ts b/packages/node/src/handlers.ts index fec2a2846b05..8b57aa5c7db0 100644 --- a/packages/node/src/handlers.ts +++ b/packages/node/src/handlers.ts @@ -397,7 +397,7 @@ export function requestHandler( // eslint-disable-next-line @typescript-eslint/unbound-method const _end = res.end; res.end = function(chunk?: any | (() => void), encoding?: string | (() => void), cb?: () => void): void { - flush(options.flushTimeout) + void flush(options.flushTimeout) .then(() => { _end.call(this, chunk, encoding, cb); }) diff --git a/packages/node/src/integrations/linkederrors.ts b/packages/node/src/integrations/linkederrors.ts index 301b0f15f507..6428ee7f0a46 100644 --- a/packages/node/src/integrations/linkederrors.ts +++ b/packages/node/src/integrations/linkederrors.ts @@ -60,7 +60,7 @@ export class LinkedErrors implements Integration { } return new SyncPromise(resolve => { - this._walkErrorTree(hint.originalException as Error, this._key) + void this._walkErrorTree(hint.originalException as Error, this._key) .then((linkedErrors: Exception[]) => { if (event && event.exception && event.exception.values) { event.exception.values = [...linkedErrors, ...event.exception.values]; @@ -81,9 +81,9 @@ export class LinkedErrors implements Integration { return SyncPromise.resolve(stack); } return new SyncPromise((resolve, reject) => { - getExceptionFromError(error[key]) + void getExceptionFromError(error[key]) .then((exception: Exception) => { - this._walkErrorTree(error[key], key, [exception, ...stack]) + void this._walkErrorTree(error[key], key, [exception, ...stack]) .then(resolve) .then(null, () => { reject(); diff --git a/packages/node/test/parsers.test.ts b/packages/node/test/parsers.test.ts index 53c4b2f682f0..3097b85d33c7 100644 --- a/packages/node/test/parsers.test.ts +++ b/packages/node/test/parsers.test.ts @@ -22,10 +22,10 @@ describe('parsers.ts', () => { test('parseStack with same file', done => { expect.assertions(1); let mockCalls = 0; - Parsers.parseStack(frames) + void Parsers.parseStack(frames) .then(_ => { mockCalls = spy.mock.calls.length; - Parsers.parseStack(frames) + void Parsers.parseStack(frames) .then(_1 => { // Calls to readFile shouldn't increase if there isn't a new error expect(spy).toHaveBeenCalledTimes(mockCalls); @@ -63,14 +63,14 @@ describe('parsers.ts', () => { expect.assertions(2); let mockCalls = 0; let newErrorCalls = 0; - Parsers.parseStack(frames) + void Parsers.parseStack(frames) .then(_ => { mockCalls = spy.mock.calls.length; - Parsers.parseStack(stacktrace.parse(getError())) + void Parsers.parseStack(stacktrace.parse(getError())) .then(_1 => { newErrorCalls = spy.mock.calls.length; expect(newErrorCalls).toBeGreaterThan(mockCalls); - Parsers.parseStack(stacktrace.parse(getError())) + void Parsers.parseStack(stacktrace.parse(getError())) .then(_2 => { expect(spy).toHaveBeenCalledTimes(newErrorCalls); done(); diff --git a/packages/serverless/src/gcpfunction/http.ts b/packages/serverless/src/gcpfunction/http.ts index f1a7fdadc4ed..d9996842b18c 100644 --- a/packages/serverless/src/gcpfunction/http.ts +++ b/packages/serverless/src/gcpfunction/http.ts @@ -89,7 +89,7 @@ function _wrapHttpFunction(fn: HttpFunction, wrapOptions: Partial { _end.call(this, chunk, encoding, cb); }) diff --git a/packages/utils/src/async.ts b/packages/utils/src/async.ts index cff2aab42774..e811fe25c4a6 100644 --- a/packages/utils/src/async.ts +++ b/packages/utils/src/async.ts @@ -4,7 +4,7 @@ */ // eslint-disable-next-line @typescript-eslint/no-explicit-any export function forget(promise: PromiseLike): void { - promise.then(null, e => { + void promise.then(null, e => { // TODO: Use a better logging mechanism // eslint-disable-next-line no-console console.error(e); diff --git a/packages/utils/src/promisebuffer.ts b/packages/utils/src/promisebuffer.ts index 73e00047e49a..ff823048304b 100644 --- a/packages/utils/src/promisebuffer.ts +++ b/packages/utils/src/promisebuffer.ts @@ -28,7 +28,7 @@ export class PromiseBuffer { if (this._buffer.indexOf(task) === -1) { this._buffer.push(task); } - task + void task .then(() => this.remove(task)) .then(null, () => this.remove(task).then(null, () => { @@ -70,7 +70,7 @@ export class PromiseBuffer { resolve(false); } }, timeout); - SyncPromise.all(this._buffer) + void SyncPromise.all(this._buffer) .then(() => { clearTimeout(capturedSetTimeout); resolve(true); diff --git a/packages/utils/src/syncpromise.ts b/packages/utils/src/syncpromise.ts index a13ecb051da1..8612e494c8ca 100644 --- a/packages/utils/src/syncpromise.ts +++ b/packages/utils/src/syncpromise.ts @@ -68,7 +68,7 @@ class SyncPromise implements PromiseLike { const resolvedCollection: U[] = []; collection.forEach((item, index) => { - SyncPromise.resolve(item) + void SyncPromise.resolve(item) .then(value => { resolvedCollection[index] = value; counter -= 1; @@ -184,7 +184,7 @@ class SyncPromise implements PromiseLike { } if (isThenable(value)) { - (value as PromiseLike).then(this._resolve, this._reject); + void (value as PromiseLike).then(this._resolve, this._reject); return; } diff --git a/packages/utils/test/syncpromise.test.ts b/packages/utils/test/syncpromise.test.ts index 4b2e15008b7c..54256acfa4ad 100644 --- a/packages/utils/test/syncpromise.test.ts +++ b/packages/utils/test/syncpromise.test.ts @@ -42,11 +42,13 @@ describe('SyncPromise', () => { const fp = async (s: PromiseLike, prepend: string) => new Promise(resolve => { - s.then(val => { - resolve(prepend + val); - }).then(null, _ => { - // bla - }); + void s + .then(val => { + resolve(prepend + val); + }) + .then(null, _ => { + // bla + }); }); const res = await cp @@ -70,11 +72,13 @@ describe('SyncPromise', () => { const f = (s: SyncPromise, prepend: string) => new SyncPromise(resolve => { - s.then(val => { - resolve(prepend + val); - }).then(null, () => { - // no-empty - }); + void s + .then(val => { + resolve(prepend + val); + }) + .then(null, () => { + // no-empty + }); }); return ( @@ -103,7 +107,7 @@ describe('SyncPromise', () => { expect.assertions(2); return new SyncPromise(done => { - new Promise(resolve => { + void new Promise(resolve => { expect(true).toBe(true); resolve(41); }) @@ -152,17 +156,21 @@ describe('SyncPromise', () => { resolve(2); }), ); - qp.then(value => { - expect(value).toEqual(2); - }).then(null, () => { - // no-empty - }); + void qp + .then(value => { + expect(value).toEqual(2); + }) + .then(null, () => { + // no-empty + }); expect(qp).not.toHaveProperty('_value'); - qp.then(value => { - expect(value).toEqual(2); - }).then(null, () => { - // no-empty - }); + void qp + .then(value => { + expect(value).toEqual(2); + }) + .then(null, () => { + // no-empty + }); jest.runAllTimers(); expect(qp).toHaveProperty('_value'); });