Skip to content

Commit 537b159

Browse files
committed
fix linting issues
1 parent 8ae33df commit 537b159

File tree

9 files changed

+32
-16
lines changed

9 files changed

+32
-16
lines changed

packages/astro/src/client/sdk.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { BrowserOptions } from '@sentry/browser';
22
import {
3-
BrowserTracing,
3+
browserTracingIntegration,
44
getDefaultIntegrations as getBrowserDefaultIntegrations,
55
init as initBrowserSdk,
66
setTag,
@@ -34,7 +34,7 @@ function getDefaultIntegrations(options: BrowserOptions): Integration[] | undefi
3434
// in which case everything inside will get treeshaken away
3535
if (typeof __SENTRY_TRACING__ === 'undefined' || __SENTRY_TRACING__) {
3636
if (hasTracingEnabled(options)) {
37-
return [...getBrowserDefaultIntegrations(options), new BrowserTracing()];
37+
return [...getBrowserDefaultIntegrations(options), browserTracingIntegration()];
3838
}
3939
}
4040

packages/astro/test/client/sdk.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,14 @@ describe('Sentry client SDK', () => {
104104
it('Overrides the automatically default BrowserTracing instance with a a user-provided BrowserTracing instance', () => {
105105
init({
106106
dsn: 'https://[email protected]/1337',
107+
// eslint-disable-next-line deprecation/deprecation
107108
integrations: [new BrowserTracing({ finalTimeout: 10, startTransactionOnLocationChange: false })],
108109
enableTracing: true,
109110
});
110111

111112
const integrationsToInit = browserInit.mock.calls[0][0]?.defaultIntegrations;
112113

114+
// eslint-disable-next-line deprecation/deprecation
113115
const browserTracing = getClient<BrowserClient>()?.getIntegrationByName('BrowserTracing') as BrowserTracing;
114116
const options = browserTracing.options;
115117

packages/ember/addon/instance-initializers/sentry-performance.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,11 @@ export function _instrumentEmberRouter(
109109
return;
110110
}
111111

112-
if (url && browserTracingOptions.startTransactionOnPageLoad !== false) {
112+
if (
113+
url &&
114+
browserTracingOptions.startTransactionOnPageLoad !== false &&
115+
browserTracingOptions.instrumentPageLoad !== false
116+
) {
113117
const routeInfo = routerService.recognize(url);
114118
Sentry.startBrowserTracingPageLoadSpan(client, {
115119
name: `route:${routeInfo.name}`,
@@ -132,7 +136,10 @@ export function _instrumentEmberRouter(
132136
getBackburner().off('end', finishActiveTransaction);
133137
};
134138

135-
if (browserTracingOptions.startTransactionOnLocationChange === false) {
139+
if (
140+
browserTracingOptions.startTransactionOnLocationChange === false &&
141+
browserTracingOptions.instrumentNavigation === false
142+
) {
136143
return;
137144
}
138145

packages/ember/addon/types.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import type { BrowserOptions, BrowserTracing } from '@sentry/browser';
1+
import type { BrowserOptions, BrowserTracing, browserTracingIntegration } from '@sentry/browser';
22
import type { Transaction, TransactionContext } from '@sentry/types';
33

4-
type BrowserTracingOptions = ConstructorParameters<typeof BrowserTracing>[0];
4+
type BrowserTracingOptions = Parameters<typeof browserTracingIntegration>[0] &
5+
// eslint-disable-next-line deprecation/deprecation
6+
ConstructorParameters<typeof BrowserTracing>[0];
57

68
export type EmberSentryConfig = {
79
sentry: BrowserOptions & { browserTracingOptions?: BrowserTracingOptions };

packages/gatsby/src/utils/integrations.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { hasTracingEnabled } from '@sentry/core';
2-
import { BrowserTracing } from '@sentry/react';
2+
import { browserTracingIntegration } from '@sentry/react';
33
import type { Integration } from '@sentry/types';
44

55
import type { GatsbyOptions } from './types';
@@ -31,8 +31,8 @@ export function getIntegrationsFromOptions(options: GatsbyOptions): UserIntegrat
3131
* @param isTracingEnabled Whether the user has enabled tracing.
3232
*/
3333
function getIntegrationsFromArray(userIntegrations: Integration[], isTracingEnabled: boolean): Integration[] {
34-
if (isTracingEnabled && !userIntegrations.some(integration => integration.name === BrowserTracing.name)) {
35-
userIntegrations.push(new BrowserTracing());
34+
if (isTracingEnabled && !userIntegrations.some(integration => integration.name === 'BrowserTracing')) {
35+
userIntegrations.push(browserTracingIntegration());
3636
}
3737
return userIntegrations;
3838
}

packages/gatsby/test/gatsby-browser.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/* eslint-disable @typescript-eslint/no-explicit-any */
33

44
import { onClientEntry } from '../gatsby-browser';
5-
import { BrowserTracing } from '../src/index';
5+
import { browserTracingIntegration } from '../src/index';
66

77
(global as any).__SENTRY_RELEASE__ = '683f3a6ab819d47d23abfca9a914c81f0524d35b';
88
(global as any).__SENTRY_DSN__ = 'https://[email protected]/0';
@@ -141,7 +141,7 @@ describe('onClientEntry', () => {
141141
});
142142

143143
it('only defines a single `BrowserTracing` integration', () => {
144-
const integrations = [new BrowserTracing()];
144+
const integrations = [browserTracingIntegration()];
145145
onClientEntry(undefined, { tracesSampleRate: 0.5, integrations });
146146

147147
expect(sentryInit).toHaveBeenLastCalledWith(

packages/gatsby/test/sdk.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { BrowserTracing, SDK_VERSION, init } from '@sentry/react';
1+
import { SDK_VERSION, browserTracingIntegration, init } from '@sentry/react';
22
import type { Integration } from '@sentry/types';
33

44
import { init as gatsbyInit } from '../src/sdk';
@@ -68,27 +68,27 @@ describe('Integrations from options', () => {
6868
[
6969
'tracing disabled, with BrowserTracing as an array',
7070
[],
71-
{ integrations: [new BrowserTracing()] },
71+
{ integrations: [browserTracingIntegration()] },
7272
['BrowserTracing'],
7373
],
7474
[
7575
'tracing disabled, with BrowserTracing as a function',
7676
[],
7777
{
78-
integrations: () => [new BrowserTracing()],
78+
integrations: () => [browserTracingIntegration()],
7979
},
8080
['BrowserTracing'],
8181
],
8282
[
8383
'tracing enabled, with BrowserTracing as an array',
8484
[],
85-
{ tracesSampleRate: 1, integrations: [new BrowserTracing()] },
85+
{ tracesSampleRate: 1, integrations: [browserTracingIntegration()] },
8686
['BrowserTracing'],
8787
],
8888
[
8989
'tracing enabled, with BrowserTracing as a function',
9090
[],
91-
{ tracesSampleRate: 1, integrations: () => [new BrowserTracing()] },
91+
{ tracesSampleRate: 1, integrations: () => [browserTracingIntegration()] },
9292
['BrowserTracing'],
9393
],
9494
] as TestArgs[])(

packages/sveltekit/src/client/browserTracingIntegration.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ import { svelteKitRoutingInstrumentation } from './router';
1919
* includes SvelteKit-specific routing instrumentation out of the box. Therefore there's no need
2020
* to pass in `svelteKitRoutingInstrumentation` anymore.
2121
*/
22+
// eslint-disable-next-line deprecation/deprecation
2223
export class BrowserTracing extends OriginalBrowserTracing {
24+
// eslint-disable-next-line deprecation/deprecation
2325
public constructor(options?: ConstructorParameters<typeof OriginalBrowserTracing>[0]) {
2426
super({
2527
// eslint-disable-next-line deprecation/deprecation

packages/sveltekit/test/client/sdk.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,12 @@ describe('Sentry client SDK', () => {
9898
it('Merges a user-provided BrowserTracing integration with the automatically added one', () => {
9999
init({
100100
dsn: 'https://[email protected]/1337',
101+
// eslint-disable-next-line deprecation/deprecation
101102
integrations: [new BrowserTracing({ finalTimeout: 10 })],
102103
enableTracing: true,
103104
});
104105

106+
// eslint-disable-next-line deprecation/deprecation
105107
const browserTracing = getClient<BrowserClient>()?.getIntegrationByName('BrowserTracing') as BrowserTracing;
106108
const options = browserTracing.options;
107109

@@ -122,6 +124,7 @@ describe('Sentry client SDK', () => {
122124
enableTracing: true,
123125
});
124126

127+
// eslint-disable-next-line deprecation/deprecation
125128
const browserTracing = getClient<BrowserClient>()?.getIntegrationByName('BrowserTracing') as BrowserTracing;
126129
const options = browserTracing.options;
127130

0 commit comments

Comments
 (0)