>,
): React.FC {
const componentDisplayName =
- (options && options.name) || WrappedComponent.displayName || WrappedComponent.name || UNKNOWN_COMPONENT;
+ options?.name || WrappedComponent.displayName || WrappedComponent.name || UNKNOWN_COMPONENT;
const Wrapped: React.FC
= (props: P) => (
@@ -189,7 +189,7 @@ function useProfiler(
},
): void {
const [mountSpan] = React.useState(() => {
- if (options && options.disabled) {
+ if (options?.disabled) {
return undefined;
}
diff --git a/packages/react/src/reactrouter.tsx b/packages/react/src/reactrouter.tsx
index 9f02f69cff06..42acef91522b 100644
--- a/packages/react/src/reactrouter.tsx
+++ b/packages/react/src/reactrouter.tsx
@@ -121,11 +121,11 @@ function instrumentReactRouter(
matchPath?: MatchPath,
): void {
function getInitPathName(): string | undefined {
- if (history && history.location) {
+ if (history.location) {
return history.location.pathname;
}
- if (WINDOW && WINDOW.location) {
+ if (WINDOW.location) {
return WINDOW.location.pathname;
}
@@ -226,7 +226,7 @@ export function withSentryRouting, R extends React
const componentDisplayName = Route.displayName || Route.name;
const WrappedRoute: React.FC
= (props: P) => {
- if (props && props.computedMatch && props.computedMatch.isExact) {
+ if (props?.computedMatch?.isExact) {
const route = props.computedMatch.path;
const activeRootSpan = getActiveRootSpan();
diff --git a/packages/react/src/reactrouterv3.ts b/packages/react/src/reactrouterv3.ts
index 75868340d56e..ad3696b306d1 100644
--- a/packages/react/src/reactrouterv3.ts
+++ b/packages/react/src/reactrouterv3.ts
@@ -57,7 +57,7 @@ export function reactRouterV3BrowserTracingIntegration(
afterAllSetup(client) {
integration.afterAllSetup(client);
- if (instrumentPageLoad && WINDOW && WINDOW.location) {
+ if (instrumentPageLoad && WINDOW.location) {
normalizeTransactionName(
routes,
WINDOW.location as unknown as Location,
diff --git a/packages/react/src/reactrouterv6-compat-utils.tsx b/packages/react/src/reactrouterv6-compat-utils.tsx
index 47416e5c55d8..17ce3753bdbd 100644
--- a/packages/react/src/reactrouterv6-compat-utils.tsx
+++ b/packages/react/src/reactrouterv6-compat-utils.tsx
@@ -85,7 +85,7 @@ export function createV6CompatibleWrapCreateBrowserRouter<
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return function (routes: RouteObject[], opts?: Record & { basename?: string }): TRouter {
const router = createRouterFunction(routes, opts);
- const basename = opts && opts.basename;
+ const basename = opts?.basename;
const activeRootSpan = getActiveRootSpan();
@@ -150,7 +150,7 @@ export function createReactRouterV6CompatibleTracingIntegration(
afterAllSetup(client) {
integration.afterAllSetup(client);
- const initPathName = WINDOW && WINDOW.location && WINDOW.location.pathname;
+ const initPathName = WINDOW.location?.pathname;
if (instrumentPageLoad && initPathName) {
startBrowserTracingPageLoadSpan(client, {
name: initPathName,
@@ -196,9 +196,7 @@ export function createV6CompatibleWrapUseRoutes(origUseRoutes: UseRoutes, versio
// A value with stable identity to either pick `locationArg` if available or `location` if not
const stableLocationParam =
- typeof locationArg === 'string' || (locationArg && locationArg.pathname)
- ? (locationArg as { pathname: string })
- : location;
+ typeof locationArg === 'string' || locationArg?.pathname ? (locationArg as { pathname: string }) : location;
_useEffect(() => {
const normalizedLocation =
diff --git a/packages/react/src/redux.ts b/packages/react/src/redux.ts
index 47830b384a15..ce70c6f075b2 100644
--- a/packages/react/src/redux.ts
+++ b/packages/react/src/redux.ts
@@ -131,8 +131,8 @@ function createReduxEnhancer(enhancerOptions?: Partial):
const transformedState = options.stateTransformer(newState);
if (typeof transformedState !== 'undefined' && transformedState !== null) {
const client = getClient();
- const options = client && client.getOptions();
- const normalizationDepth = (options && options.normalizeDepth) || 3; // default state normalization depth to 3
+ const options = client?.getOptions();
+ const normalizationDepth = options?.normalizeDepth || 3; // default state normalization depth to 3
// Set the normalization depth of the redux state to the configured `normalizeDepth` option or a sane number as a fallback
const newStateContext = { state: { type: 'redux', value: transformedState } };
diff --git a/packages/remix/src/client/performance.tsx b/packages/remix/src/client/performance.tsx
index c9518cdf5352..32c6226e463e 100644
--- a/packages/remix/src/client/performance.tsx
+++ b/packages/remix/src/client/performance.tsx
@@ -59,7 +59,7 @@ let _useMatches: UseMatches | undefined;
let _instrumentNavigation: boolean | undefined;
function getInitPathName(): string | undefined {
- if (WINDOW && WINDOW.location) {
+ if (WINDOW.location) {
return WINDOW.location.pathname;
}
@@ -177,7 +177,7 @@ export function withSentry, R extends React.Co
return;
}
- if (_instrumentNavigation && matches && matches.length) {
+ if (_instrumentNavigation && matches?.length) {
if (activeRootSpan) {
activeRootSpan.end();
}
diff --git a/packages/remix/test/integration/common/routes/action-json-response.$id.tsx b/packages/remix/test/integration/common/routes/action-json-response.$id.tsx
index 1cd4d65df54e..67c89279388c 100644
--- a/packages/remix/test/integration/common/routes/action-json-response.$id.tsx
+++ b/packages/remix/test/integration/common/routes/action-json-response.$id.tsx
@@ -43,7 +43,7 @@ export default function ActionJSONResponse() {
return (
-
{data && data.test ? data.test : 'Not Found'}
+ {data?.test ? data.test : 'Not Found'}
);
}
diff --git a/packages/remix/test/integration/common/routes/loader-defer-response.$id.tsx b/packages/remix/test/integration/common/routes/loader-defer-response.$id.tsx
index 1888a6d5ee30..48e2a55caaf4 100644
--- a/packages/remix/test/integration/common/routes/loader-defer-response.$id.tsx
+++ b/packages/remix/test/integration/common/routes/loader-defer-response.$id.tsx
@@ -14,7 +14,7 @@ export default function LoaderJSONResponse() {
return (
-
{data && data.id ? data.id : 'Not Found'}
+ {data?.id ? data.id : 'Not Found'}
);
}
diff --git a/packages/remix/test/integration/common/routes/loader-json-response.$id.tsx b/packages/remix/test/integration/common/routes/loader-json-response.$id.tsx
index dd8a1812ecc4..3c7aa2cd5e5d 100644
--- a/packages/remix/test/integration/common/routes/loader-json-response.$id.tsx
+++ b/packages/remix/test/integration/common/routes/loader-json-response.$id.tsx
@@ -22,7 +22,7 @@ export default function LoaderJSONResponse() {
return (
-
{data && data.id ? data.id : 'Not Found'}
+ {data?.id ? data.id : 'Not Found'}
);
}
diff --git a/packages/remix/test/integration/common/routes/server-side-unexpected-errors.$id.tsx b/packages/remix/test/integration/common/routes/server-side-unexpected-errors.$id.tsx
index a6dbf6cfb0f0..0e0a46205e37 100644
--- a/packages/remix/test/integration/common/routes/server-side-unexpected-errors.$id.tsx
+++ b/packages/remix/test/integration/common/routes/server-side-unexpected-errors.$id.tsx
@@ -21,7 +21,7 @@ export default function ActionJSONResponse() {
return (
-
{data && data.test ? data.test : 'Not Found'}
+ {data?.test ? data.test : 'Not Found'}
);
}
diff --git a/packages/replay-internal/src/coreHandlers/handleAfterSendEvent.ts b/packages/replay-internal/src/coreHandlers/handleAfterSendEvent.ts
index e84c8fb95b62..8a9d1518185f 100644
--- a/packages/replay-internal/src/coreHandlers/handleAfterSendEvent.ts
+++ b/packages/replay-internal/src/coreHandlers/handleAfterSendEvent.ts
@@ -15,7 +15,7 @@ export function handleAfterSendEvent(replay: ReplayContainer): AfterSendEventCal
return;
}
- const statusCode = sendResponse && sendResponse.statusCode;
+ const statusCode = sendResponse?.statusCode;
// We only want to do stuff on successful error sending, otherwise you get error replays without errors attached
// If not using the base transport, we allow `undefined` response (as a custom transport may not implement this correctly yet)
diff --git a/packages/replay-internal/src/coreHandlers/handleNetworkBreadcrumbs.ts b/packages/replay-internal/src/coreHandlers/handleNetworkBreadcrumbs.ts
index 3b3da66284d0..3b3e52d985c1 100644
--- a/packages/replay-internal/src/coreHandlers/handleNetworkBreadcrumbs.ts
+++ b/packages/replay-internal/src/coreHandlers/handleNetworkBreadcrumbs.ts
@@ -92,9 +92,9 @@ function _isFetchBreadcrumb(breadcrumb: Breadcrumb): breadcrumb is Breadcrumb &
}
function _isXhrHint(hint?: BreadcrumbHint): hint is XhrHint {
- return hint && hint.xhr;
+ return hint?.xhr;
}
function _isFetchHint(hint?: BreadcrumbHint): hint is FetchHint {
- return hint && hint.response;
+ return hint?.response;
}
diff --git a/packages/replay-internal/src/coreHandlers/util/fetchUtils.ts b/packages/replay-internal/src/coreHandlers/util/fetchUtils.ts
index d52af5c8526c..fe7b5656baa9 100644
--- a/packages/replay-internal/src/coreHandlers/util/fetchUtils.ts
+++ b/packages/replay-internal/src/coreHandlers/util/fetchUtils.ts
@@ -179,8 +179,7 @@ function getResponseData(
},
): ReplayNetworkRequestOrResponse | undefined {
try {
- const size =
- bodyText && bodyText.length && responseBodySize === undefined ? getBodySize(bodyText) : responseBodySize;
+ const size = bodyText?.length && responseBodySize === undefined ? getBodySize(bodyText) : responseBodySize;
if (!captureDetails) {
return buildSkippedNetworkRequestOrResponse(size);
diff --git a/packages/replay-internal/src/coreHandlers/util/networkUtils.ts b/packages/replay-internal/src/coreHandlers/util/networkUtils.ts
index 22f98fc2bee7..3197b6839e74 100644
--- a/packages/replay-internal/src/coreHandlers/util/networkUtils.ts
+++ b/packages/replay-internal/src/coreHandlers/util/networkUtils.ts
@@ -179,7 +179,7 @@ export function buildNetworkRequestOrResponse(
const { body: normalizedBody, warnings } = normalizeNetworkBody(body);
info.body = normalizedBody;
- if (warnings && warnings.length > 0) {
+ if (warnings?.length) {
info._meta = {
warnings,
};
diff --git a/packages/replay-internal/src/util/addGlobalListeners.ts b/packages/replay-internal/src/util/addGlobalListeners.ts
index cfc765e1b383..df1c4475369e 100644
--- a/packages/replay-internal/src/util/addGlobalListeners.ts
+++ b/packages/replay-internal/src/util/addGlobalListeners.ts
@@ -60,7 +60,7 @@ export function addGlobalListeners(replay: ReplayContainer): void {
// We want to flush replay
client.on('beforeSendFeedback', (feedbackEvent, options) => {
const replayId = replay.getSessionId();
- if (options && options.includeReplay && replay.isEnabled() && replayId) {
+ if (options?.includeReplay && replay.isEnabled() && replayId) {
// This should never reject
if (feedbackEvent.contexts && feedbackEvent.contexts.feedback) {
feedbackEvent.contexts.feedback.replay_id = replayId;
diff --git a/packages/replay-internal/src/util/createPerformanceEntries.ts b/packages/replay-internal/src/util/createPerformanceEntries.ts
index f4efad050750..6d2fc726f5d4 100644
--- a/packages/replay-internal/src/util/createPerformanceEntries.ts
+++ b/packages/replay-internal/src/util/createPerformanceEntries.ts
@@ -189,7 +189,7 @@ function createResourceEntry(
*/
export function getLargestContentfulPaint(metric: Metric): ReplayPerformanceEntry {
const lastEntry = metric.entries[metric.entries.length - 1] as (PerformanceEntry & { element?: Node }) | undefined;
- const node = lastEntry && lastEntry.element ? [lastEntry.element] : undefined;
+ const node = lastEntry?.element ? [lastEntry.element] : undefined;
return getWebVital(metric, 'largest-contentful-paint', node);
}
@@ -227,7 +227,7 @@ export function getCumulativeLayoutShift(metric: Metric): ReplayPerformanceEntry
*/
export function getFirstInputDelay(metric: Metric): ReplayPerformanceEntry {
const lastEntry = metric.entries[metric.entries.length - 1] as (PerformanceEntry & { target?: Node }) | undefined;
- const node = lastEntry && lastEntry.target ? [lastEntry.target] : undefined;
+ const node = lastEntry?.target ? [lastEntry.target] : undefined;
return getWebVital(metric, 'first-input-delay', node);
}
@@ -236,7 +236,7 @@ export function getFirstInputDelay(metric: Metric): ReplayPerformanceEntry {
const lastEntry = metric.entries[metric.entries.length - 1] as (PerformanceEntry & { target?: Node }) | undefined;
- const node = lastEntry && lastEntry.target ? [lastEntry.target] : undefined;
+ const node = lastEntry?.target ? [lastEntry.target] : undefined;
return getWebVital(metric, 'interaction-to-next-paint', node);
}
diff --git a/packages/replay-internal/src/util/debounce.ts b/packages/replay-internal/src/util/debounce.ts
index 78437b7d9403..8948b937febd 100644
--- a/packages/replay-internal/src/util/debounce.ts
+++ b/packages/replay-internal/src/util/debounce.ts
@@ -32,7 +32,7 @@ export function debounce(func: CallbackFunction, wait: number, options?: Debounc
let timerId: ReturnType | undefined;
let maxTimerId: ReturnType | undefined;
- const maxWait = options && options.maxWait ? Math.max(options.maxWait, wait) : 0;
+ const maxWait = options?.maxWait ? Math.max(options.maxWait, wait) : 0;
function invokeFunc(): unknown {
cancelTimers();
diff --git a/packages/replay-internal/src/util/getReplay.ts b/packages/replay-internal/src/util/getReplay.ts
index 0d09def81585..654d3bcae5db 100644
--- a/packages/replay-internal/src/util/getReplay.ts
+++ b/packages/replay-internal/src/util/getReplay.ts
@@ -6,5 +6,5 @@ import type { replayIntegration } from '../integration';
*/
export function getReplay(): ReturnType | undefined {
const client = getClient();
- return client && client.getIntegrationByName>('Replay');
+ return client?.getIntegrationByName>('Replay');
}
diff --git a/packages/replay-internal/src/util/handleRecordingEmit.ts b/packages/replay-internal/src/util/handleRecordingEmit.ts
index 4f4637276116..f3c5e1a45d1e 100644
--- a/packages/replay-internal/src/util/handleRecordingEmit.ts
+++ b/packages/replay-internal/src/util/handleRecordingEmit.ts
@@ -93,7 +93,7 @@ export function getHandleRecordingEmit(replay: ReplayContainer): RecordingEmitCa
// of the previous session. Do not immediately flush in this case
// to avoid capturing only the checkout and instead the replay will
// be captured if they perform any follow-up actions.
- if (session && session.previousSessionId) {
+ if (session?.previousSessionId) {
return true;
}
diff --git a/packages/replay-internal/src/util/prepareReplayEvent.ts b/packages/replay-internal/src/util/prepareReplayEvent.ts
index 2a1a41b7f332..b881ce6d7e84 100644
--- a/packages/replay-internal/src/util/prepareReplayEvent.ts
+++ b/packages/replay-internal/src/util/prepareReplayEvent.ts
@@ -47,7 +47,7 @@ export async function prepareReplayEvent({
// extract the SDK name because `client._prepareEvent` doesn't add it to the event
const metadata = client.getSdkMetadata();
- const { name, version } = (metadata && metadata.sdk) || {};
+ const { name, version } = metadata?.sdk || {};
preparedEvent.sdk = {
...preparedEvent.sdk,
diff --git a/packages/replay-internal/src/util/sendReplayRequest.ts b/packages/replay-internal/src/util/sendReplayRequest.ts
index 5ab25228b486..fb881f5160ae 100644
--- a/packages/replay-internal/src/util/sendReplayRequest.ts
+++ b/packages/replay-internal/src/util/sendReplayRequest.ts
@@ -30,8 +30,8 @@ export async function sendReplayRequest({
const client = getClient();
const scope = getCurrentScope();
- const transport = client && client.getTransport();
- const dsn = client && client.getDsn();
+ const transport = client?.getTransport();
+ const dsn = client?.getDsn();
if (!client || !transport || !dsn || !session.sampled) {
return resolvedSyncPromise({});
diff --git a/packages/replay-internal/test/integration/beforeAddRecordingEvent.test.ts b/packages/replay-internal/test/integration/beforeAddRecordingEvent.test.ts
index dd0d98783893..de15f1de9530 100644
--- a/packages/replay-internal/test/integration/beforeAddRecordingEvent.test.ts
+++ b/packages/replay-internal/test/integration/beforeAddRecordingEvent.test.ts
@@ -99,7 +99,7 @@ describe('Integration | beforeAddRecordingEvent', () => {
});
afterAll(() => {
- integration && integration.stop();
+ integration?.stop();
});
it('changes click breadcrumbs message', async () => {
diff --git a/packages/replay-internal/test/integration/flush.test.ts b/packages/replay-internal/test/integration/flush.test.ts
index a56731cf85c3..11bb57a58b32 100644
--- a/packages/replay-internal/test/integration/flush.test.ts
+++ b/packages/replay-internal/test/integration/flush.test.ts
@@ -113,7 +113,7 @@ describe('Integration | flush', () => {
});
afterAll(() => {
- replay && replay.stop();
+ replay?.stop();
});
it('flushes twice after multiple flush() calls)', async () => {
diff --git a/packages/replay-internal/test/integration/rateLimiting.test.ts b/packages/replay-internal/test/integration/rateLimiting.test.ts
index f75ab257b9f5..711781e3d2ee 100644
--- a/packages/replay-internal/test/integration/rateLimiting.test.ts
+++ b/packages/replay-internal/test/integration/rateLimiting.test.ts
@@ -44,7 +44,7 @@ describe('Integration | rate-limiting behaviour', () => {
clearSession(replay);
vi.clearAllMocks();
- replay && replay.stop();
+ replay?.stop();
});
it.each([
diff --git a/packages/replay-internal/test/integration/sendReplayEvent.test.ts b/packages/replay-internal/test/integration/sendReplayEvent.test.ts
index bc58d463cf66..993e6623f5c9 100644
--- a/packages/replay-internal/test/integration/sendReplayEvent.test.ts
+++ b/packages/replay-internal/test/integration/sendReplayEvent.test.ts
@@ -78,7 +78,7 @@ describe('Integration | sendReplayEvent', () => {
});
afterAll(() => {
- replay && replay.stop();
+ replay?.stop();
});
it('uploads a replay event when document becomes hidden', async () => {
diff --git a/packages/solid/src/solidrouter.ts b/packages/solid/src/solidrouter.ts
index c2641ac1acf9..aa0a75854d4d 100644
--- a/packages/solid/src/solidrouter.ts
+++ b/packages/solid/src/solidrouter.ts
@@ -37,8 +37,8 @@ function handleNavigation(location: string): void {
// To avoid increasing the api surface with internal properties, we look at
// the sdk metadata.
const metaData = client.getSdkMetadata();
- const { name } = (metaData && metaData.sdk) || {};
- const framework = name && name.includes('solidstart') ? 'solidstart' : 'solid';
+ const { name } = metaData?.sdk || {};
+ const framework = name?.includes('solidstart') ? 'solidstart' : 'solid';
startBrowserTracingNavigationSpan(client, {
name: location,
diff --git a/packages/solidstart/src/server/middleware.ts b/packages/solidstart/src/server/middleware.ts
index ad8ea9502b32..05377363bd71 100644
--- a/packages/solidstart/src/server/middleware.ts
+++ b/packages/solidstart/src/server/middleware.ts
@@ -33,7 +33,7 @@ export function sentryBeforeResponseMiddleware() {
addNonEnumerableProperty(response, '__sentry_wrapped__', true);
const contentType = event.response.headers.get('content-type');
- const isPageloadRequest = contentType && contentType.startsWith('text/html');
+ const isPageloadRequest = contentType?.startsWith('text/html');
if (!isPageloadRequest) {
return;
diff --git a/packages/sveltekit/src/client/browserTracingIntegration.ts b/packages/sveltekit/src/client/browserTracingIntegration.ts
index 800911118ec3..9148bb3bcd29 100644
--- a/packages/sveltekit/src/client/browserTracingIntegration.ts
+++ b/packages/sveltekit/src/client/browserTracingIntegration.ts
@@ -41,7 +41,7 @@ export function browserTracingIntegration(
}
function _instrumentPageload(client: Client): void {
- const initialPath = WINDOW && WINDOW.location && WINDOW.location.pathname;
+ const initialPath = WINDOW.location?.pathname;
const pageloadSpan = startBrowserTracingPageLoadSpan(client, {
name: initialPath,
@@ -92,9 +92,9 @@ function _instrumentNavigations(client: Client): void {
const to = navigation.to;
// for the origin we can fall back to window.location.pathname because in this emission, it still is set to the origin path
- const rawRouteOrigin = (from && from.url.pathname) || (WINDOW && WINDOW.location && WINDOW.location.pathname);
+ const rawRouteOrigin = from?.url.pathname || WINDOW.location?.pathname;
- const rawRouteDestination = to && to.url.pathname;
+ const rawRouteDestination = to?.url.pathname;
// We don't want to create transactions for navigations of same origin and destination.
// We need to look at the raw URL here because parameterized routes can still differ in their raw parameters.
@@ -102,8 +102,8 @@ function _instrumentNavigations(client: Client): void {
return;
}
- const parameterizedRouteOrigin = from && from.route.id;
- const parameterizedRouteDestination = to && to.route.id;
+ const parameterizedRouteOrigin = from?.route.id;
+ const parameterizedRouteDestination = to?.route.id;
if (routingSpan) {
// If a routing span is still open from a previous navigation, we finish it.
diff --git a/packages/sveltekit/src/server/handleError.ts b/packages/sveltekit/src/server/handleError.ts
index 7f6a8cd0b0cb..41605c014e51 100644
--- a/packages/sveltekit/src/server/handleError.ts
+++ b/packages/sveltekit/src/server/handleError.ts
@@ -9,7 +9,7 @@ import { flushIfServerless } from './utils';
function defaultErrorHandler({ error }: Parameters[0]): ReturnType {
// @ts-expect-error this conforms to the default implementation (including this ts-expect-error)
// eslint-disable-next-line no-console
- consoleSandbox(() => console.error(error && error.stack));
+ consoleSandbox(() => console.error(error?.stack));
}
type HandleServerErrorInput = Parameters[0];
diff --git a/packages/vercel-edge/src/integrations/wintercg-fetch.ts b/packages/vercel-edge/src/integrations/wintercg-fetch.ts
index c7d8860c4f0b..0940afecb6f2 100644
--- a/packages/vercel-edge/src/integrations/wintercg-fetch.ts
+++ b/packages/vercel-edge/src/integrations/wintercg-fetch.ts
@@ -157,7 +157,7 @@ function createBreadcrumb(handlerData: HandlerDataFetch): void {
breadcrumbData.request_body_size = handlerData.fetchData.request_body_size;
breadcrumbData.response_body_size = handlerData.fetchData.response_body_size;
- breadcrumbData.status_code = response && response.status;
+ breadcrumbData.status_code = response?.status;
const hint: FetchBreadcrumbHint = {
input: handlerData.args,
diff --git a/packages/vue/src/errorhandler.ts b/packages/vue/src/errorhandler.ts
index 6a3951cc1855..3f011d281095 100644
--- a/packages/vue/src/errorhandler.ts
+++ b/packages/vue/src/errorhandler.ts
@@ -41,7 +41,7 @@ export const attachErrorHandler = (app: Vue, options: VueOptions): void => {
if (options.logErrors) {
const hasConsole = typeof console !== 'undefined';
- const message = `Error in ${lifecycleHook}: "${error && error.toString()}"`;
+ const message = `Error in ${lifecycleHook}: "${error?.toString()}"`;
if (warnHandler) {
(warnHandler as UnknownFunc).call(null, message, vm, trace);
diff --git a/packages/vue/src/pinia.ts b/packages/vue/src/pinia.ts
index 031f0f5f110b..f6731afcd6ce 100644
--- a/packages/vue/src/pinia.ts
+++ b/packages/vue/src/pinia.ts
@@ -71,8 +71,8 @@ export const createSentryPiniaPlugin: (options?: SentryPiniaPluginOptions) => Pi
if (typeof transformedState !== 'undefined' && transformedState !== null) {
const client = getClient();
- const options = client && client.getOptions();
- const normalizationDepth = (options && options.normalizeDepth) || 3; // default state normalization depth to 3
+ const options = client?.getOptions();
+ const normalizationDepth = options?.normalizeDepth || 3; // default state normalization depth to 3
const piniaStateContext = { type: 'pinia', value: transformedState };
const newState = {
diff --git a/scripts/normalize-e2e-test-dump-transaction-events.js b/scripts/normalize-e2e-test-dump-transaction-events.js
index 771dcccd8f87..9b775e62a381 100644
--- a/scripts/normalize-e2e-test-dump-transaction-events.js
+++ b/scripts/normalize-e2e-test-dump-transaction-events.js
@@ -56,7 +56,7 @@ glob.glob(
transaction.spans.forEach(span => {
const node = spanMap.get(span.span_id);
- if (node && node.parent_span_id) {
+ if (node?.parent_span_id) {
const parentNode = spanMap.get(node.parent_span_id);
parentNode.children.push(node);
}