Skip to content

Commit 92e951f

Browse files
authored
build: Update @typescript-eslint packages & fix resulting linting issues (#6657)
1 parent 0f9a3df commit 92e951f

File tree

21 files changed

+141
-76
lines changed

21 files changed

+141
-76
lines changed

packages/browser/.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tmp.js

packages/browser/src/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,5 +179,5 @@ export interface ReportDialogOptions {
179179
errorFormEntry?: string;
180180
successMessage?: string;
181181
/** Callback after reportDialog showed up */
182-
onLoad?(): void;
182+
onLoad?(this: void): void;
183183
}

packages/browser/src/sdk.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ export function showReportDialog(options: ReportDialogOptions = {}, hub: Hub = g
164164
script.src = getReportDialogEndpoint(dsn, options);
165165

166166
if (options.onLoad) {
167-
// eslint-disable-next-line @typescript-eslint/unbound-method
168167
script.onload = options.onLoad;
169168
}
170169

packages/browser/test/unit/sdk.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
/* eslint-disable @typescript-eslint/unbound-method */
2-
import { Scope } from '@sentry/core';
3-
import { createTransport } from '@sentry/core';
2+
import { createTransport, Scope } from '@sentry/core';
43
import { MockIntegration } from '@sentry/core/test/lib/sdk.test';
54
import { Client, Integration } from '@sentry/types';
65
import { resolvedSyncPromise } from '@sentry/utils';
76

87
import { BrowserOptions } from '../../src';
98
import { init } from '../../src/sdk';
10-
// eslint-disable-next-line no-var
11-
declare var global: any;
129

1310
const PUBLIC_DSN = 'https://username@domain/123';
1411

packages/core/src/hub.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,6 @@ export class Hub implements HubInterface {
258258

259259
if (!scope || !client) return;
260260

261-
// eslint-disable-next-line @typescript-eslint/unbound-method
262261
const { beforeBreadcrumb = null, maxBreadcrumbs = DEFAULT_BREADCRUMBS } =
263262
(client.getOptions && client.getOptions()) || {};
264263

packages/eslint-config-sdk/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
"dependencies": {
2222
"@sentry-internal/eslint-plugin-sdk": "7.29.0",
2323
"@sentry-internal/typescript": "7.29.0",
24-
"@typescript-eslint/eslint-plugin": "^3.9.0",
25-
"@typescript-eslint/parser": "^3.9.0",
24+
"@typescript-eslint/eslint-plugin": "^5.48.0",
25+
"@typescript-eslint/parser": "^5.48.0",
2626
"eslint-config-prettier": "^6.11.0",
2727
"eslint-plugin-deprecation": "^1.1.0",
2828
"eslint-plugin-import": "^2.22.0",

packages/nextjs/src/config/wrappers/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ import type { NextApiRequest, NextApiResponse } from 'next';
2323
// wrapped route from being wrapped again by the auto-wrapper.
2424

2525
export type NextApiHandler = {
26-
__sentry_route__?: string;
2726
(req: NextApiRequest, res: NextApiResponse): void | Promise<void> | unknown | Promise<unknown>;
27+
__sentry_route__?: string;
2828
};
2929

3030
export type WrappedNextApiHandler = {
31+
(req: NextApiRequest, res: NextApiResponse): Promise<void> | Promise<unknown>;
3132
__sentry_route__?: string;
3233
__sentry_wrapped__?: boolean;
33-
(req: NextApiRequest, res: NextApiResponse): Promise<void> | Promise<unknown>;
3434
};
3535

3636
export type AugmentedNextApiRequest = NextApiRequest & {

packages/node/src/handlers.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ export function errorHandler(options?: {
256256
* Callback method deciding whether error should be captured and sent to Sentry
257257
* @param error Captured middleware error
258258
*/
259-
shouldHandleError?(error: MiddlewareError): boolean;
259+
shouldHandleError?(this: void, error: MiddlewareError): boolean;
260260
}): (
261261
error: MiddlewareError,
262262
req: http.IncomingMessage,
@@ -269,7 +269,6 @@ export function errorHandler(options?: {
269269
res: http.ServerResponse,
270270
next: (error: MiddlewareError) => void,
271271
): void {
272-
// eslint-disable-next-line @typescript-eslint/unbound-method
273272
const shouldHandleError = (options && options.shouldHandleError) || defaultShouldHandleError;
274273

275274
if (shouldHandleError(error)) {

packages/node/src/integrations/onuncaughtexception.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ interface OnUncaughtExceptionOptions {
2929
* `onFatalError` itself threw, or because an independent error happened somewhere else while `onFatalError`
3030
* was running.
3131
*/
32-
onFatalError?(firstError: Error, secondError?: Error): void;
32+
onFatalError?(this: void, firstError: Error, secondError?: Error): void;
3333
}
3434

3535
/** Global Exception handler */
@@ -84,10 +84,8 @@ export class OnUncaughtException implements Integration {
8484
const client = getCurrentHub().getClient<NodeClient>();
8585

8686
if (this._options.onFatalError) {
87-
// eslint-disable-next-line @typescript-eslint/unbound-method
8887
onFatalError = this._options.onFatalError;
8988
} else if (client && client.getOptions().onFatalError) {
90-
// eslint-disable-next-line @typescript-eslint/unbound-method
9189
onFatalError = client.getOptions().onFatalError as OnFatalErrorHandler;
9290
}
9391

packages/node/src/transports/http.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ export function makeNodeTransport(options: NodeTransportOptions): Transport {
7474
// TODO(v7): Evaluate if we can set keepAlive to true. This would involve testing for memory leaks in older node
7575
// versions(>= 8) as they had memory leaks when using it: #2555
7676
const agent = proxy
77-
? (new (require('https-proxy-agent'))(proxy) as http.Agent)
77+
? // eslint-disable-next-line @typescript-eslint/no-var-requires
78+
(new (require('https-proxy-agent'))(proxy) as http.Agent)
7879
: new nativeHttpModule.Agent({ keepAlive, maxSockets: 30, timeout: 2000 });
7980

8081
const requestExecutor = createRequestExecutor(options, options.httpModule ?? nativeHttpModule, agent);

packages/node/src/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ export interface BaseNodeOptions {
4545
* });
4646
* ```
4747
*/
48-
shouldCreateSpanForRequest?(url: string): boolean;
48+
shouldCreateSpanForRequest?(this: void, url: string): boolean;
4949

5050
/** Callback that is executed when a fatal global error occurs. */
51-
onFatalError?(error: Error): void;
51+
onFatalError?(this: void, error: Error): void;
5252
}
5353

5454
/**

packages/react/src/redux.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ function createReduxEnhancer(enhancerOptions?: Partial<SentryEnhancerOptions>):
111111
}
112112

113113
/* Allow user to configure scope with latest state */
114-
// eslint-disable-next-line @typescript-eslint/unbound-method
115114
const { configureScopeWithState } = options;
116115
if (typeof configureScopeWithState === 'function') {
117116
configureScopeWithState(scope, newState);

packages/replay/src/eventBuffer.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ class EventBufferArray implements EventBuffer {
4343
this._events = [];
4444
}
4545

46-
public destroy(): void {
47-
this._events = [];
48-
}
49-
5046
public get length(): number {
5147
return this._events.length;
5248
}
5349

50+
public destroy(): void {
51+
this._events = [];
52+
}
53+
5454
public addEvent(event: RecordingEvent, isCheckout?: boolean): void {
5555
if (isCheckout) {
5656
this._events = [event];
@@ -82,12 +82,6 @@ export class EventBufferCompressionWorker implements EventBuffer {
8282
this._worker = worker;
8383
}
8484

85-
public destroy(): void {
86-
__DEBUG_BUILD__ && logger.log('[Replay] Destroying compression worker');
87-
this._worker?.terminate();
88-
this._worker = null;
89-
}
90-
9185
/**
9286
* Note that this may not reflect what is actually in the event buffer. This
9387
* is only a local count of the buffer size since `addEvent` is async.
@@ -96,6 +90,12 @@ export class EventBufferCompressionWorker implements EventBuffer {
9690
return this._eventBufferItemLength;
9791
}
9892

93+
public destroy(): void {
94+
__DEBUG_BUILD__ && logger.log('[Replay] Destroying compression worker');
95+
this._worker?.terminate();
96+
this._worker = null;
97+
}
98+
9999
public async addEvent(event: RecordingEvent, isCheckout?: boolean): Promise<ReplayRecordingData> {
100100
if (isCheckout) {
101101
// This event is a checkout, make sure worker buffer is cleared before

packages/replay/src/integration.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,6 @@ export class Replay implements Integration {
3636

3737
readonly options: ReplayPluginOptions;
3838

39-
protected get _isInitialized(): boolean {
40-
return _initialized;
41-
}
42-
43-
protected set _isInitialized(value: boolean) {
44-
_initialized = value;
45-
}
46-
4739
private _replay?: ReplayContainer;
4840

4941
constructor({
@@ -134,6 +126,14 @@ Sentry.init({ replaysOnErrorSampleRate: ${errorSampleRate} })`,
134126
this._isInitialized = true;
135127
}
136128

129+
protected get _isInitialized(): boolean {
130+
return _initialized;
131+
}
132+
133+
protected set _isInitialized(value: boolean) {
134+
_initialized = value;
135+
}
136+
137137
/**
138138
* We previously used to create a transaction in `setupOnce` and it would
139139
* potentially create a transaction before some native SDK integrations have run

packages/replay/src/util/debounce.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
type DebouncedCallback = {
2+
(): void | unknown;
23
flush: () => void | unknown;
34
cancel: () => void;
4-
(): void | unknown;
55
};
66
type CallbackFunction = () => unknown;
77
type DebounceOptions = { maxWait?: number };

packages/tracing/src/browser/browsertracing.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,14 @@ export interface BrowserTracingOptions extends RequestInstrumentationOptions {
109109
*
110110
* @returns A (potentially) modified context object, with `sampled = false` if the transaction should be dropped.
111111
*/
112-
beforeNavigate?(context: TransactionContext): TransactionContext | undefined;
112+
beforeNavigate?(this: void, context: TransactionContext): TransactionContext | undefined;
113113

114114
/**
115115
* Instrumentation that creates routing change transactions. By default creates
116116
* pageload and navigation transactions.
117117
*/
118118
routingInstrumentation<T extends Transaction>(
119+
this: void,
119120
customStartTransaction: (context: TransactionContext) => T | undefined,
120121
startTransactionOnPageLoad?: boolean,
121122
startTransactionOnLocationChange?: boolean,
@@ -187,7 +188,6 @@ export class BrowserTracing implements Integration {
187188
public setupOnce(_: (callback: EventProcessor) => void, getCurrentHub: () => Hub): void {
188189
this._getCurrentHub = getCurrentHub;
189190

190-
// eslint-disable-next-line @typescript-eslint/unbound-method
191191
const {
192192
routingInstrumentation: instrumentRouting,
193193
startTransactionOnLocationChange,
@@ -230,7 +230,6 @@ export class BrowserTracing implements Integration {
230230
return undefined;
231231
}
232232

233-
// eslint-disable-next-line @typescript-eslint/unbound-method
234233
const { beforeNavigate, idleTimeout, finalTimeout, heartbeatInterval } = this.options;
235234

236235
const isPageloadTransaction = context.op === 'pageload';

packages/tracing/src/browser/request.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export interface RequestInstrumentationOptions {
4949
*
5050
* Default: (url: string) => true
5151
*/
52-
shouldCreateSpanForRequest?(url: string): boolean;
52+
shouldCreateSpanForRequest?(this: void, url: string): boolean;
5353
}
5454

5555
/** Data returned from fetch callback */

packages/types/src/envelope.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export type BaseEnvelopeItemHeaders = {
4444
length?: number;
4545
};
4646

47-
type BaseEnvelopeItem<ItemHeader, P extends unknown> = [ItemHeader & BaseEnvelopeItemHeaders, P]; // P is for payload
47+
type BaseEnvelopeItem<ItemHeader, P> = [ItemHeader & BaseEnvelopeItemHeaders, P]; // P is for payload
4848

4949
type BaseEnvelope<EnvelopeHeader, Item> = [
5050
EnvelopeHeader & BaseEnvelopeHeaders,

packages/types/src/eventprocessor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ import { Event, EventHint } from './event';
77
* Event processing will be deferred until your Promise is resolved.
88
*/
99
export interface EventProcessor {
10-
id?: string; // This field can't be named "name" because functions already have this field natively
1110
(event: Event, hint: EventHint): PromiseLike<Event | null> | Event | null;
11+
id?: string; // This field can't be named "name" because functions already have this field natively
1212
}

packages/utils/src/object.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,7 @@ export function urlEncode(object: { [key: string]: any }): string {
9999
* @returns An Event or Error turned into an object - or the value argurment itself, when value is neither an Event nor
100100
* an Error.
101101
*/
102-
export function convertToPlainObject<V extends unknown>(
103-
value: V,
104-
):
102+
export function convertToPlainObject<V>(value: V):
105103
| {
106104
[ownProps: string]: unknown;
107105
type: string;

0 commit comments

Comments
 (0)