From 9ac07a48a851fae6cca57981c381d72259d923e2 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Mon, 18 Dec 2023 11:46:17 -0500 Subject: [PATCH 01/10] chore(biome): enable noUnusedImports rule --- biome.json | 3 +++ packages/angular/test/tracing.test.ts | 1 - packages/astro/test/server/middleware.test.ts | 2 +- .../suites/public-api/startTransaction/init.js | 3 +-- packages/core/src/metrics/utils.ts | 2 +- packages/deno/src/integrations/deno-cron.ts | 1 - packages/deno/src/integrations/globalhandlers.ts | 2 +- .../create-remix-app-v2/app/entry.server.tsx | 2 +- .../create-remix-app/app/entry.server.tsx | 2 +- .../test-applications/generic-ts3.8/index.ts | 11 ----------- .../nextjs-app-dir/tests/async-context-edge.test.ts | 2 +- .../node-hapi-app/tests/server.test.ts | 2 +- .../react-create-hash-router/src/pages/Index.tsx | 3 ++- .../react-create-hash-router/src/pages/User.tsx | 1 + .../react-router-6-use-routes/src/pages/Index.tsx | 1 + .../react-router-6-use-routes/src/pages/User.tsx | 1 + .../src/pages/Index.tsx | 1 + .../src/pages/User.tsx | 1 + .../standard-frontend-react/src/pages/Index.tsx | 1 + .../standard-frontend-react/src/pages/User.tsx | 1 + packages/gatsby/test/integration.test.tsx | 2 +- packages/nextjs/src/common/_error.ts | 2 +- .../config/templates/routeHandlerWrapperTemplate.ts | 2 ++ .../templates/serverComponentWrapperTemplate.ts | 2 ++ packages/nextjs/src/edge/wrapApiHandlerWithSentry.ts | 2 +- .../nextjs/test/integration/components/Layout.tsx | 2 +- packages/nextjs/test/integration/components/List.tsx | 1 + .../nextjs/test/integration/components/ListDetail.tsx | 1 + .../nextjs/test/integration/components/ListItem.tsx | 1 + packages/node-experimental/src/integrations/http.ts | 2 +- packages/react/test/profiler.test.tsx | 1 + packages/react/test/reactrouterv4.test.tsx | 1 + packages/react/test/reactrouterv5.test.tsx | 1 + packages/react/test/redux.test.ts | 1 - .../remix/test/integration/app_v2/entry.server.tsx | 2 +- .../routes/server-side-unexpected-errors.$id.tsx | 2 +- packages/vue/src/tracing.ts | 2 +- 37 files changed, 38 insertions(+), 32 deletions(-) diff --git a/biome.json b/biome.json index 8e8155f8d6d8..52f6d6728bf4 100644 --- a/biome.json +++ b/biome.json @@ -20,6 +20,9 @@ "suspicious": { "all": false, "noControlCharactersInRegex": "error" + }, + "nursery": { + "noUnusedImports": "error" } }, "ignore": [".vscode/*", "**/*.json"] diff --git a/packages/angular/test/tracing.test.ts b/packages/angular/test/tracing.test.ts index 635c8847b9bf..69689dbf6ec3 100644 --- a/packages/angular/test/tracing.test.ts +++ b/packages/angular/test/tracing.test.ts @@ -1,6 +1,5 @@ import { Component } from '@angular/core'; import type { ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot } from '@angular/router'; -import type { Hub } from '@sentry/types'; import { TraceClassDecorator, TraceDirective, TraceMethodDecorator, instrumentAngularRouting } from '../src'; import { getParameterizedRouteFromSnapshot } from '../src/tracing'; diff --git a/packages/astro/test/server/middleware.test.ts b/packages/astro/test/server/middleware.test.ts index 5e56c6bd70ed..13508cebf057 100644 --- a/packages/astro/test/server/middleware.test.ts +++ b/packages/astro/test/server/middleware.test.ts @@ -1,6 +1,6 @@ import * as SentryNode from '@sentry/node'; import type { Client } from '@sentry/types'; -import { SpyInstance, vi } from 'vitest'; +import { vi } from 'vitest'; import { handleRequest, interpolateRouteFromUrlAndParams } from '../../src/server/middleware'; diff --git a/packages/browser-integration-tests/suites/public-api/startTransaction/init.js b/packages/browser-integration-tests/suites/public-api/startTransaction/init.js index 0aadc7c39b84..7a572891050b 100644 --- a/packages/browser-integration-tests/suites/public-api/startTransaction/init.js +++ b/packages/browser-integration-tests/suites/public-api/startTransaction/init.js @@ -1,6 +1,5 @@ import * as Sentry from '@sentry/browser'; -// eslint-disable-next-line no-unused-vars -import * as _ from '@sentry/tracing'; +import '@sentry/tracing'; window.Sentry = Sentry; diff --git a/packages/core/src/metrics/utils.ts b/packages/core/src/metrics/utils.ts index 27c49d144523..6e4d75fee5f6 100644 --- a/packages/core/src/metrics/utils.ts +++ b/packages/core/src/metrics/utils.ts @@ -1,6 +1,6 @@ import type { MeasurementUnit, MetricBucketItem } from '@sentry/types'; import { dropUndefinedKeys } from '@sentry/utils'; -import type { MetricType, SimpleMetricBucket } from './types'; +import type { MetricType } from './types'; /** * Generate bucket key from metric properties. diff --git a/packages/deno/src/integrations/deno-cron.ts b/packages/deno/src/integrations/deno-cron.ts index 475d3e9131b7..0d66bf2975ab 100644 --- a/packages/deno/src/integrations/deno-cron.ts +++ b/packages/deno/src/integrations/deno-cron.ts @@ -1,6 +1,5 @@ import { withMonitor } from '@sentry/core'; import type { Integration } from '@sentry/types'; -import type { DenoClient } from '../client'; import { parseScheduleToString } from './deno-cron-format'; type CronOptions = { backoffSchedule?: number[]; signal?: AbortSignal }; diff --git a/packages/deno/src/integrations/globalhandlers.ts b/packages/deno/src/integrations/globalhandlers.ts index 9914764d4c45..ff82d0257176 100644 --- a/packages/deno/src/integrations/globalhandlers.ts +++ b/packages/deno/src/integrations/globalhandlers.ts @@ -1,5 +1,5 @@ import type { ServerRuntimeClient } from '@sentry/core'; -import { getClient, getCurrentHub, getCurrentScope } from '@sentry/core'; +import { getClient, getCurrentHub } from '@sentry/core'; import { flush } from '@sentry/core'; import type { Event, Hub, Integration, Primitive, StackParser } from '@sentry/types'; import { eventFromUnknownInput, isPrimitive } from '@sentry/utils'; diff --git a/packages/e2e-tests/test-applications/create-remix-app-v2/app/entry.server.tsx b/packages/e2e-tests/test-applications/create-remix-app-v2/app/entry.server.tsx index 78e0e8940eb5..c2e0a480acab 100644 --- a/packages/e2e-tests/test-applications/create-remix-app-v2/app/entry.server.tsx +++ b/packages/e2e-tests/test-applications/create-remix-app-v2/app/entry.server.tsx @@ -6,7 +6,7 @@ import { PassThrough } from 'node:stream'; -import type { AppLoadContext, DataFunctionArgs, EntryContext } from '@remix-run/node'; +import type { AppLoadContext, EntryContext } from '@remix-run/node'; import { createReadableStreamFromReadable } from '@remix-run/node'; import { installGlobals } from '@remix-run/node'; import { RemixServer } from '@remix-run/react'; diff --git a/packages/e2e-tests/test-applications/create-remix-app/app/entry.server.tsx b/packages/e2e-tests/test-applications/create-remix-app/app/entry.server.tsx index f0c451dcaf55..6d137ec92d53 100644 --- a/packages/e2e-tests/test-applications/create-remix-app/app/entry.server.tsx +++ b/packages/e2e-tests/test-applications/create-remix-app/app/entry.server.tsx @@ -6,7 +6,7 @@ import { PassThrough } from 'node:stream'; -import type { AppLoadContext, DataFunctionArgs, EntryContext } from '@remix-run/node'; +import type { AppLoadContext, EntryContext } from '@remix-run/node'; import { Response } from '@remix-run/node'; import { RemixServer } from '@remix-run/react'; import * as Sentry from '@sentry/remix'; diff --git a/packages/e2e-tests/test-applications/generic-ts3.8/index.ts b/packages/e2e-tests/test-applications/generic-ts3.8/index.ts index 823bd62fe09c..60e8debad344 100644 --- a/packages/e2e-tests/test-applications/generic-ts3.8/index.ts +++ b/packages/e2e-tests/test-applications/generic-ts3.8/index.ts @@ -1,13 +1,2 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ // we need to import the SDK to ensure tsc check the types -import * as _SentryBrowser from '@sentry/browser'; -import * as _SentryCore from '@sentry/core'; -import * as _SentryHub from '@sentry/hub'; -import * as _SentryIntegrations from '@sentry/integrations'; -import * as _SentryNode from '@sentry/node'; -import * as _SentryOpentelemetry from '@sentry/opentelemetry-node'; -import * as _SentryReplay from '@sentry/replay'; -import * as _SentryTracing from '@sentry/tracing'; -import * as _SentryTypes from '@sentry/types'; -import * as _SentryUtils from '@sentry/utils'; -import * as _SentryWasm from '@sentry/wasm'; diff --git a/packages/e2e-tests/test-applications/nextjs-app-dir/tests/async-context-edge.test.ts b/packages/e2e-tests/test-applications/nextjs-app-dir/tests/async-context-edge.test.ts index 7ff7116af5d9..1465c560a36c 100644 --- a/packages/e2e-tests/test-applications/nextjs-app-dir/tests/async-context-edge.test.ts +++ b/packages/e2e-tests/test-applications/nextjs-app-dir/tests/async-context-edge.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { waitForError, waitForTransaction } from '../event-proxy-server'; +import { waitForTransaction } from '../event-proxy-server'; test('Should allow for async context isolation in the edge SDK', async ({ request }) => { // test.skip(process.env.TEST_ENV === 'development', "Doesn't work in dev mode."); diff --git a/packages/e2e-tests/test-applications/node-hapi-app/tests/server.test.ts b/packages/e2e-tests/test-applications/node-hapi-app/tests/server.test.ts index cbcd99e756d7..061278dded50 100644 --- a/packages/e2e-tests/test-applications/node-hapi-app/tests/server.test.ts +++ b/packages/e2e-tests/test-applications/node-hapi-app/tests/server.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import axios, { AxiosError, AxiosResponse } from 'axios'; +import axios, { AxiosError } from 'axios'; import { waitForError, waitForTransaction } from '../event-proxy-server'; const authToken = process.env.E2E_TEST_AUTH_TOKEN; diff --git a/packages/e2e-tests/test-applications/react-create-hash-router/src/pages/Index.tsx b/packages/e2e-tests/test-applications/react-create-hash-router/src/pages/Index.tsx index f339eb867d6c..767c8829664f 100644 --- a/packages/e2e-tests/test-applications/react-create-hash-router/src/pages/Index.tsx +++ b/packages/e2e-tests/test-applications/react-create-hash-router/src/pages/Index.tsx @@ -1,5 +1,6 @@ import * as Sentry from '@sentry/react'; -import * as React from 'react'; +// biome-ignore lint/nursery/noUnusedImports: Need React import for JSX +import * as React from 'react'; import { Link } from 'react-router-dom'; const Index = () => { diff --git a/packages/e2e-tests/test-applications/react-create-hash-router/src/pages/User.tsx b/packages/e2e-tests/test-applications/react-create-hash-router/src/pages/User.tsx index 671455a92fff..62f0c2d17533 100644 --- a/packages/e2e-tests/test-applications/react-create-hash-router/src/pages/User.tsx +++ b/packages/e2e-tests/test-applications/react-create-hash-router/src/pages/User.tsx @@ -1,3 +1,4 @@ +// biome-ignore lint/nursery/noUnusedImports: Need React import for JSX import * as React from 'react'; const User = () => { diff --git a/packages/e2e-tests/test-applications/react-router-6-use-routes/src/pages/Index.tsx b/packages/e2e-tests/test-applications/react-router-6-use-routes/src/pages/Index.tsx index f339eb867d6c..7789a2773224 100644 --- a/packages/e2e-tests/test-applications/react-router-6-use-routes/src/pages/Index.tsx +++ b/packages/e2e-tests/test-applications/react-router-6-use-routes/src/pages/Index.tsx @@ -1,4 +1,5 @@ import * as Sentry from '@sentry/react'; +// biome-ignore lint/nursery/noUnusedImports: Need React import for JSX import * as React from 'react'; import { Link } from 'react-router-dom'; diff --git a/packages/e2e-tests/test-applications/react-router-6-use-routes/src/pages/User.tsx b/packages/e2e-tests/test-applications/react-router-6-use-routes/src/pages/User.tsx index 671455a92fff..62f0c2d17533 100644 --- a/packages/e2e-tests/test-applications/react-router-6-use-routes/src/pages/User.tsx +++ b/packages/e2e-tests/test-applications/react-router-6-use-routes/src/pages/User.tsx @@ -1,3 +1,4 @@ +// biome-ignore lint/nursery/noUnusedImports: Need React import for JSX import * as React from 'react'; const User = () => { diff --git a/packages/e2e-tests/test-applications/standard-frontend-react-tracing-import/src/pages/Index.tsx b/packages/e2e-tests/test-applications/standard-frontend-react-tracing-import/src/pages/Index.tsx index f339eb867d6c..7789a2773224 100644 --- a/packages/e2e-tests/test-applications/standard-frontend-react-tracing-import/src/pages/Index.tsx +++ b/packages/e2e-tests/test-applications/standard-frontend-react-tracing-import/src/pages/Index.tsx @@ -1,4 +1,5 @@ import * as Sentry from '@sentry/react'; +// biome-ignore lint/nursery/noUnusedImports: Need React import for JSX import * as React from 'react'; import { Link } from 'react-router-dom'; diff --git a/packages/e2e-tests/test-applications/standard-frontend-react-tracing-import/src/pages/User.tsx b/packages/e2e-tests/test-applications/standard-frontend-react-tracing-import/src/pages/User.tsx index 671455a92fff..62f0c2d17533 100644 --- a/packages/e2e-tests/test-applications/standard-frontend-react-tracing-import/src/pages/User.tsx +++ b/packages/e2e-tests/test-applications/standard-frontend-react-tracing-import/src/pages/User.tsx @@ -1,3 +1,4 @@ +// biome-ignore lint/nursery/noUnusedImports: Need React import for JSX import * as React from 'react'; const User = () => { diff --git a/packages/e2e-tests/test-applications/standard-frontend-react/src/pages/Index.tsx b/packages/e2e-tests/test-applications/standard-frontend-react/src/pages/Index.tsx index f339eb867d6c..7789a2773224 100644 --- a/packages/e2e-tests/test-applications/standard-frontend-react/src/pages/Index.tsx +++ b/packages/e2e-tests/test-applications/standard-frontend-react/src/pages/Index.tsx @@ -1,4 +1,5 @@ import * as Sentry from '@sentry/react'; +// biome-ignore lint/nursery/noUnusedImports: Need React import for JSX import * as React from 'react'; import { Link } from 'react-router-dom'; diff --git a/packages/e2e-tests/test-applications/standard-frontend-react/src/pages/User.tsx b/packages/e2e-tests/test-applications/standard-frontend-react/src/pages/User.tsx index 671455a92fff..62f0c2d17533 100644 --- a/packages/e2e-tests/test-applications/standard-frontend-react/src/pages/User.tsx +++ b/packages/e2e-tests/test-applications/standard-frontend-react/src/pages/User.tsx @@ -1,3 +1,4 @@ +// biome-ignore lint/nursery/noUnusedImports: Need React import for JSX import * as React from 'react'; const User = () => { diff --git a/packages/gatsby/test/integration.test.tsx b/packages/gatsby/test/integration.test.tsx index 88a736ceee75..dbe10d9a3fbb 100644 --- a/packages/gatsby/test/integration.test.tsx +++ b/packages/gatsby/test/integration.test.tsx @@ -2,7 +2,7 @@ import { TextDecoder, TextEncoder } from 'util'; /* eslint-disable @typescript-eslint/no-explicit-any */ import { render } from '@testing-library/react'; import { useEffect } from 'react'; -// eslint-disable-next-line @typescript-eslint/no-unused-vars +// biome-ignore lint/nursery/noUnusedImports: Need React import for JSX import * as React from 'react'; import { onClientEntry } from '../gatsby-browser'; diff --git a/packages/nextjs/src/common/_error.ts b/packages/nextjs/src/common/_error.ts index 1f114494567b..f79c844adba7 100644 --- a/packages/nextjs/src/common/_error.ts +++ b/packages/nextjs/src/common/_error.ts @@ -1,4 +1,4 @@ -import { captureException, getClient, withScope } from '@sentry/core'; +import { captureException, withScope } from '@sentry/core'; import type { NextPageContext } from 'next'; import { flushQueue } from './utils/responseEnd'; diff --git a/packages/nextjs/src/config/templates/routeHandlerWrapperTemplate.ts b/packages/nextjs/src/config/templates/routeHandlerWrapperTemplate.ts index e8fafc18139d..532f566c30c5 100644 --- a/packages/nextjs/src/config/templates/routeHandlerWrapperTemplate.ts +++ b/packages/nextjs/src/config/templates/routeHandlerWrapperTemplate.ts @@ -2,8 +2,10 @@ import * as Sentry from '@sentry/nextjs'; import type { WebFetchHeaders } from '@sentry/types'; // @ts-expect-error Because we cannot be sure if the RequestAsyncStorage module exists (it is not part of the Next.js public // API) we use a shim if it doesn't exist. The logic for this is in the wrapping loader. +// biome-ignore lint/nursery/noUnusedImports: Biome doesn't understand the shim with variable import path import { requestAsyncStorage } from '__SENTRY_NEXTJS_REQUEST_ASYNC_STORAGE_SHIM__'; // @ts-expect-error See above +// biome-ignore lint/nursery/noUnusedImports: Biome doesn't understand the shim with variable import path import * as routeModule from '__SENTRY_WRAPPING_TARGET_FILE__'; import type { RequestAsyncStorage } from './requestAsyncStorageShim'; diff --git a/packages/nextjs/src/config/templates/serverComponentWrapperTemplate.ts b/packages/nextjs/src/config/templates/serverComponentWrapperTemplate.ts index 56b9853fa1af..717826e3a081 100644 --- a/packages/nextjs/src/config/templates/serverComponentWrapperTemplate.ts +++ b/packages/nextjs/src/config/templates/serverComponentWrapperTemplate.ts @@ -2,8 +2,10 @@ import * as Sentry from '@sentry/nextjs'; import type { WebFetchHeaders } from '@sentry/types'; // @ts-expect-error Because we cannot be sure if the RequestAsyncStorage module exists (it is not part of the Next.js public // API) we use a shim if it doesn't exist. The logic for this is in the wrapping loader. +// biome-ignore lint/nursery/noUnusedImports: Biome doesn't understand the shim with variable import path import { requestAsyncStorage } from '__SENTRY_NEXTJS_REQUEST_ASYNC_STORAGE_SHIM__'; // @ts-expect-error We use `__SENTRY_WRAPPING_TARGET_FILE__` as a placeholder for the path to the file being wrapped. +// biome-ignore lint/nursery/noUnusedImports: Biome doesn't understand the shim with variable import path import * as serverComponentModule from '__SENTRY_WRAPPING_TARGET_FILE__'; import type { RequestAsyncStorage } from './requestAsyncStorageShim'; diff --git a/packages/nextjs/src/edge/wrapApiHandlerWithSentry.ts b/packages/nextjs/src/edge/wrapApiHandlerWithSentry.ts index 5a9398319ae2..dabba7741e01 100644 --- a/packages/nextjs/src/edge/wrapApiHandlerWithSentry.ts +++ b/packages/nextjs/src/edge/wrapApiHandlerWithSentry.ts @@ -1,4 +1,4 @@ -import { getCurrentHub, getCurrentScope } from '@sentry/core'; +import { getCurrentScope } from '@sentry/core'; import { withEdgeWrapping } from '../common/utils/edgeWrapperUtils'; import type { EdgeRouteHandler } from './types'; diff --git a/packages/nextjs/test/integration/components/Layout.tsx b/packages/nextjs/test/integration/components/Layout.tsx index 25db194506fa..36b99f04720f 100644 --- a/packages/nextjs/test/integration/components/Layout.tsx +++ b/packages/nextjs/test/integration/components/Layout.tsx @@ -1,6 +1,6 @@ import Head from 'next/head'; import Link from 'next/link'; -import React, { ReactNode } from 'react'; +import { ReactNode } from 'react'; type Props = { children?: ReactNode; diff --git a/packages/nextjs/test/integration/components/List.tsx b/packages/nextjs/test/integration/components/List.tsx index e5c88d3e4b42..fbcdfeb504c9 100644 --- a/packages/nextjs/test/integration/components/List.tsx +++ b/packages/nextjs/test/integration/components/List.tsx @@ -1,3 +1,4 @@ +// biome-ignore lint/nursery/noUnusedImports: Need React import for JSX import * as React from 'react'; import { User } from '../interfaces'; import ListItem from './ListItem'; diff --git a/packages/nextjs/test/integration/components/ListDetail.tsx b/packages/nextjs/test/integration/components/ListDetail.tsx index 0443bb33d317..9b1417333c9f 100644 --- a/packages/nextjs/test/integration/components/ListDetail.tsx +++ b/packages/nextjs/test/integration/components/ListDetail.tsx @@ -1,3 +1,4 @@ +// biome-ignore lint/nursery/noUnusedImports: Need React import for JSX import * as React from 'react'; import { User } from '../interfaces'; diff --git a/packages/nextjs/test/integration/components/ListItem.tsx b/packages/nextjs/test/integration/components/ListItem.tsx index 2f5d131ae3ad..9de97d32c7fb 100644 --- a/packages/nextjs/test/integration/components/ListItem.tsx +++ b/packages/nextjs/test/integration/components/ListItem.tsx @@ -1,4 +1,5 @@ import Link from 'next/link'; +// biome-ignore lint/nursery/noUnusedImports: Need React import for JSX import React from 'react'; import { User } from '../interfaces'; diff --git a/packages/node-experimental/src/integrations/http.ts b/packages/node-experimental/src/integrations/http.ts index 860169c6a43e..5be99314b0c6 100644 --- a/packages/node-experimental/src/integrations/http.ts +++ b/packages/node-experimental/src/integrations/http.ts @@ -4,7 +4,7 @@ import { SpanKind } from '@opentelemetry/api'; import { registerInstrumentations } from '@opentelemetry/instrumentation'; import { HttpInstrumentation } from '@opentelemetry/instrumentation-http'; import { addBreadcrumb, hasTracingEnabled, isSentryRequestUrl } from '@sentry/core'; -import { _INTERNAL, getClient, getCurrentHub, getSpanKind, setSpanMetadata } from '@sentry/opentelemetry'; +import { _INTERNAL, getClient, getSpanKind, setSpanMetadata } from '@sentry/opentelemetry'; import type { EventProcessor, Hub, Integration } from '@sentry/types'; import { stringMatchesSomePattern } from '@sentry/utils'; diff --git a/packages/react/test/profiler.test.tsx b/packages/react/test/profiler.test.tsx index 70eaff2d2c8b..6f528f92f83b 100644 --- a/packages/react/test/profiler.test.tsx +++ b/packages/react/test/profiler.test.tsx @@ -1,6 +1,7 @@ import type { SpanContext } from '@sentry/types'; import { render } from '@testing-library/react'; import { renderHook } from '@testing-library/react-hooks'; +// biome-ignore lint/nursery/noUnusedImports: Need React import for JSXq import * as React from 'react'; import { REACT_MOUNT_OP, REACT_RENDER_OP, REACT_UPDATE_OP } from '../src/constants'; diff --git a/packages/react/test/reactrouterv4.test.tsx b/packages/react/test/reactrouterv4.test.tsx index e1c8a71e66b0..6bf1dd8311e5 100644 --- a/packages/react/test/reactrouterv4.test.tsx +++ b/packages/react/test/reactrouterv4.test.tsx @@ -1,5 +1,6 @@ import { act, render } from '@testing-library/react'; import { createMemoryHistory } from 'history-4'; +// biome-ignore lint/nursery/noUnusedImports: Need React import for JSX import * as React from 'react'; import { Route, Router, Switch, matchPath } from 'react-router-4'; diff --git a/packages/react/test/reactrouterv5.test.tsx b/packages/react/test/reactrouterv5.test.tsx index 3ab94aea0401..0f0adb803d87 100644 --- a/packages/react/test/reactrouterv5.test.tsx +++ b/packages/react/test/reactrouterv5.test.tsx @@ -1,5 +1,6 @@ import { act, render } from '@testing-library/react'; import { createMemoryHistory } from 'history-4'; +// biome-ignore lint/nursery/noUnusedImports: Need React import for JSX import * as React from 'react'; import { Route, Router, Switch, matchPath } from 'react-router-5'; diff --git a/packages/react/test/redux.test.ts b/packages/react/test/redux.test.ts index 60cf59abd74e..0ce064365eeb 100644 --- a/packages/react/test/redux.test.ts +++ b/packages/react/test/redux.test.ts @@ -1,5 +1,4 @@ import * as Sentry from '@sentry/browser'; -import type { Scope } from '@sentry/types'; import * as Redux from 'redux'; import { createReduxEnhancer } from '../src/redux'; diff --git a/packages/remix/test/integration/app_v2/entry.server.tsx b/packages/remix/test/integration/app_v2/entry.server.tsx index f9205ecf89b2..bba366801092 100644 --- a/packages/remix/test/integration/app_v2/entry.server.tsx +++ b/packages/remix/test/integration/app_v2/entry.server.tsx @@ -1,4 +1,4 @@ -import type { DataFunctionArgs, EntryContext } from '@remix-run/node'; +import type { EntryContext } from '@remix-run/node'; import { RemixServer } from '@remix-run/react'; import * as Sentry from '@sentry/remix'; import { renderToString } from 'react-dom/server'; 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 a7d73e29a4ff..a6dbf6cfb0f0 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 @@ -1,4 +1,4 @@ -import { ActionFunction, LoaderFunction, json, redirect } from '@remix-run/node'; +import { ActionFunction } from '@remix-run/node'; import { useActionData } from '@remix-run/react'; export const action: ActionFunction = async ({ params: { id } }) => { diff --git a/packages/vue/src/tracing.ts b/packages/vue/src/tracing.ts index ef509dcdb406..d24deeea5f04 100644 --- a/packages/vue/src/tracing.ts +++ b/packages/vue/src/tracing.ts @@ -1,4 +1,4 @@ -import { getCurrentHub, getCurrentScope } from '@sentry/browser'; +import { getCurrentScope } from '@sentry/browser'; import type { Span, Transaction } from '@sentry/types'; import { logger, timestampInSeconds } from '@sentry/utils'; From f4b116978f7ce95764df30ef03149f4c6c626e11 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Wed, 20 Dec 2023 13:28:44 -0500 Subject: [PATCH 02/10] update biome fix to not be unsafe --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f8bdaced8cbe..de8c53d09137 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "codecov": "codecov", "fix": "run-s fix:lerna fix:biome", "fix:lerna": "lerna run fix", - "fix:biome": "biome check --apply-unsafe .", + "fix:biome": "biome check --apply .", "changelog": "ts-node ./scripts/get-commit-list.ts", "link:yarn": "lerna exec yarn link", "lint": "run-s lint:lerna lint:biome", From 51830a5c2f87df43d39cf947a4f63c6980f67aeb Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Wed, 20 Dec 2023 13:31:17 -0500 Subject: [PATCH 03/10] fix ts3.8 test --- .../test-applications/generic-ts3.8/index.ts | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/packages/e2e-tests/test-applications/generic-ts3.8/index.ts b/packages/e2e-tests/test-applications/generic-ts3.8/index.ts index 60e8debad344..46c0608d641d 100644 --- a/packages/e2e-tests/test-applications/generic-ts3.8/index.ts +++ b/packages/e2e-tests/test-applications/generic-ts3.8/index.ts @@ -1,2 +1,22 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ -// we need to import the SDK to ensure tsc check the types +// biome-ignore lint/nursery/noUnusedImports: we need to import the SDK to ensure tsc check the types +import * as _SentryBrowser from '@sentry/browser'; +// biome-ignore lint/nursery/noUnusedImports: +import * as _SentryCore from '@sentry/core'; +// biome-ignore lint/nursery/noUnusedImports: +import * as _SentryHub from '@sentry/hub'; +// biome-ignore lint/nursery/noUnusedImports: +import * as _SentryIntegrations from '@sentry/integrations'; +// biome-ignore lint/nursery/noUnusedImports: +import * as _SentryNode from '@sentry/node'; +// biome-ignore lint/nursery/noUnusedImports: +import * as _SentryOpentelemetry from '@sentry/opentelemetry-node'; +// biome-ignore lint/nursery/noUnusedImports: +import * as _SentryReplay from '@sentry/replay'; +// biome-ignore lint/nursery/noUnusedImports: +import * as _SentryTracing from '@sentry/tracing'; +// biome-ignore lint/nursery/noUnusedImports: +import * as _SentryTypes from '@sentry/types'; +// biome-ignore lint/nursery/noUnusedImports: +import * as _SentryUtils from '@sentry/utils'; +// biome-ignore lint/nursery/noUnusedImports: +import * as _SentryWasm from '@sentry/wasm'; From 9249efed4f33be0105491b8f7721e21d8c3ba47b Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Wed, 20 Dec 2023 13:40:17 -0500 Subject: [PATCH 04/10] fix JSX spelling --- packages/react/test/profiler.test.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react/test/profiler.test.tsx b/packages/react/test/profiler.test.tsx index 6f528f92f83b..037785f32b22 100644 --- a/packages/react/test/profiler.test.tsx +++ b/packages/react/test/profiler.test.tsx @@ -1,7 +1,7 @@ import type { SpanContext } from '@sentry/types'; import { render } from '@testing-library/react'; import { renderHook } from '@testing-library/react-hooks'; -// biome-ignore lint/nursery/noUnusedImports: Need React import for JSXq +// biome-ignore lint/nursery/noUnusedImports: Need React import for JSX import * as React from 'react'; import { REACT_MOUNT_OP, REACT_RENDER_OP, REACT_UPDATE_OP } from '../src/constants'; From b7f3093fc3a2017ecb2dc3d2e7f4316226985a21 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Wed, 20 Dec 2023 13:40:34 -0500 Subject: [PATCH 05/10] cleanup --- .../react-create-hash-router/src/pages/Index.tsx | 2 +- .../src/config/templates/routeHandlerWrapperTemplate.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/e2e-tests/test-applications/react-create-hash-router/src/pages/Index.tsx b/packages/e2e-tests/test-applications/react-create-hash-router/src/pages/Index.tsx index 767c8829664f..7789a2773224 100644 --- a/packages/e2e-tests/test-applications/react-create-hash-router/src/pages/Index.tsx +++ b/packages/e2e-tests/test-applications/react-create-hash-router/src/pages/Index.tsx @@ -1,6 +1,6 @@ import * as Sentry from '@sentry/react'; // biome-ignore lint/nursery/noUnusedImports: Need React import for JSX -import * as React from 'react'; +import * as React from 'react'; import { Link } from 'react-router-dom'; const Index = () => { diff --git a/packages/nextjs/src/config/templates/routeHandlerWrapperTemplate.ts b/packages/nextjs/src/config/templates/routeHandlerWrapperTemplate.ts index 532f566c30c5..6b5075ef9003 100644 --- a/packages/nextjs/src/config/templates/routeHandlerWrapperTemplate.ts +++ b/packages/nextjs/src/config/templates/routeHandlerWrapperTemplate.ts @@ -2,10 +2,10 @@ import * as Sentry from '@sentry/nextjs'; import type { WebFetchHeaders } from '@sentry/types'; // @ts-expect-error Because we cannot be sure if the RequestAsyncStorage module exists (it is not part of the Next.js public // API) we use a shim if it doesn't exist. The logic for this is in the wrapping loader. -// biome-ignore lint/nursery/noUnusedImports: Biome doesn't understand the shim with variable import path +// biome-ignore lint/nursery/noUnusedImports: Biome doesn't understand declare const import { requestAsyncStorage } from '__SENTRY_NEXTJS_REQUEST_ASYNC_STORAGE_SHIM__'; // @ts-expect-error See above -// biome-ignore lint/nursery/noUnusedImports: Biome doesn't understand the shim with variable import path +// biome-ignore lint/nursery/noUnusedImports: Biome doesn't understand declare const import * as routeModule from '__SENTRY_WRAPPING_TARGET_FILE__'; import type { RequestAsyncStorage } from './requestAsyncStorageShim'; From f49ba0dcd178d73721efc0332819a33e1d1f69b3 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Wed, 20 Dec 2023 13:42:21 -0500 Subject: [PATCH 06/10] more biome cleanup from fix --- packages/browser/src/integrations/breadcrumbs.ts | 1 - packages/browser/src/integrations/trycatch.ts | 2 +- packages/core/src/integrations/metadata.ts | 2 +- packages/core/src/scope.ts | 2 +- packages/integrations/test/debug.test.ts | 2 +- packages/node-experimental/src/integrations/http.ts | 1 - packages/node-experimental/src/otel/contextManager.ts | 1 - packages/node-experimental/src/sdk/api.ts | 1 - packages/node-experimental/src/sdk/hub.ts | 3 --- .../node-experimental/test/integration/transactions.test.ts | 1 - packages/node/test/integrations/localvariables.test.ts | 1 - packages/opentelemetry/src/spanExporter.ts | 2 -- packages/replay/test/integration/rrweb.test.ts | 1 - packages/sveltekit/src/client/handleError.ts | 2 +- packages/sveltekit/test/common/utils.test.ts | 2 -- 15 files changed, 5 insertions(+), 19 deletions(-) diff --git a/packages/browser/src/integrations/breadcrumbs.ts b/packages/browser/src/integrations/breadcrumbs.ts index 102d1d7e500d..09ac468027da 100644 --- a/packages/browser/src/integrations/breadcrumbs.ts +++ b/packages/browser/src/integrations/breadcrumbs.ts @@ -1,4 +1,3 @@ -import { get } from 'http'; /* eslint-disable max-lines */ import { addBreadcrumb, convertIntegrationFnToClass, getClient } from '@sentry/core'; import type { diff --git a/packages/browser/src/integrations/trycatch.ts b/packages/browser/src/integrations/trycatch.ts index e65190d02b3f..f555acfcdc9c 100644 --- a/packages/browser/src/integrations/trycatch.ts +++ b/packages/browser/src/integrations/trycatch.ts @@ -1,5 +1,5 @@ import { convertIntegrationFnToClass } from '@sentry/core'; -import type { Client, IntegrationFn, WrappedFunction } from '@sentry/types'; +import type { IntegrationFn, WrappedFunction } from '@sentry/types'; import { fill, getFunctionName, getOriginalFunction } from '@sentry/utils'; import { WINDOW, wrap } from '../helpers'; diff --git a/packages/core/src/integrations/metadata.ts b/packages/core/src/integrations/metadata.ts index b94f252b5ce0..e89cffbc8a0a 100644 --- a/packages/core/src/integrations/metadata.ts +++ b/packages/core/src/integrations/metadata.ts @@ -1,4 +1,4 @@ -import type { Event, EventItem, IntegrationFn } from '@sentry/types'; +import type { EventItem, IntegrationFn } from '@sentry/types'; import { forEachEnvelopeItem } from '@sentry/utils'; import { convertIntegrationFnToClass } from '../integration'; diff --git a/packages/core/src/scope.ts b/packages/core/src/scope.ts index 599b5c0f8d57..a742ab1c91e7 100644 --- a/packages/core/src/scope.ts +++ b/packages/core/src/scope.ts @@ -23,7 +23,7 @@ import type { Transaction, User, } from '@sentry/types'; -import { arrayify, dateTimestampInSeconds, isPlainObject, uuid4 } from '@sentry/utils'; +import { dateTimestampInSeconds, isPlainObject, uuid4 } from '@sentry/utils'; import { getGlobalEventProcessors, notifyEventProcessors } from './eventProcessors'; import { updateSession } from './session'; diff --git a/packages/integrations/test/debug.test.ts b/packages/integrations/test/debug.test.ts index eefd9c8b9240..e8bc3719e7f1 100644 --- a/packages/integrations/test/debug.test.ts +++ b/packages/integrations/test/debug.test.ts @@ -1,4 +1,4 @@ -import type { Client, Event, EventHint, Hub, Integration } from '@sentry/types'; +import type { Client, Event, EventHint } from '@sentry/types'; import { Debug } from '../src/debug'; diff --git a/packages/node-experimental/src/integrations/http.ts b/packages/node-experimental/src/integrations/http.ts index 4de28247eda9..66606bbf8258 100644 --- a/packages/node-experimental/src/integrations/http.ts +++ b/packages/node-experimental/src/integrations/http.ts @@ -9,7 +9,6 @@ import type { EventProcessor, Hub, Integration } from '@sentry/types'; import { stringMatchesSomePattern } from '@sentry/utils'; import { getIsolationScope, setIsolationScope } from '../sdk/api'; -import { Scope } from '../sdk/scope'; import type { NodeExperimentalClient } from '../types'; import { addOriginToSpan } from '../utils/addOriginToSpan'; import { getRequestUrl } from '../utils/getRequestUrl'; diff --git a/packages/node-experimental/src/otel/contextManager.ts b/packages/node-experimental/src/otel/contextManager.ts index 4ba4f0642b16..a7154fb96390 100644 --- a/packages/node-experimental/src/otel/contextManager.ts +++ b/packages/node-experimental/src/otel/contextManager.ts @@ -4,7 +4,6 @@ import { setHubOnContext } from '@sentry/opentelemetry'; import { getCurrentHub } from '../sdk/hub'; import { getCurrentScope, getIsolationScope } from './../sdk/api'; -import { Scope } from './../sdk/scope'; import type { CurrentScopes } from './../sdk/types'; import { getScopesFromContext, setScopesOnContext } from './../utils/contextData'; diff --git a/packages/node-experimental/src/sdk/api.ts b/packages/node-experimental/src/sdk/api.ts index 1a7ddfd52ad5..9ef8862aa88b 100644 --- a/packages/node-experimental/src/sdk/api.ts +++ b/packages/node-experimental/src/sdk/api.ts @@ -6,7 +6,6 @@ import type { Breadcrumb, BreadcrumbHint, CaptureContext, - Client, Event, EventHint, EventProcessor, diff --git a/packages/node-experimental/src/sdk/hub.ts b/packages/node-experimental/src/sdk/hub.ts index 21e1c83a34bb..3622b1848d5d 100644 --- a/packages/node-experimental/src/sdk/hub.ts +++ b/packages/node-experimental/src/sdk/hub.ts @@ -5,7 +5,6 @@ import type { Hub, Integration, IntegrationClass, - Session, Severity, SeverityLevel, TransactionContext, @@ -14,8 +13,6 @@ import type { import { addBreadcrumb, captureEvent, - captureException, - captureMessage, configureScope, endSession, getClient, diff --git a/packages/node-experimental/test/integration/transactions.test.ts b/packages/node-experimental/test/integration/transactions.test.ts index 1a09b3234d92..be48f5f9e6b5 100644 --- a/packages/node-experimental/test/integration/transactions.test.ts +++ b/packages/node-experimental/test/integration/transactions.test.ts @@ -8,7 +8,6 @@ import { logger } from '@sentry/utils'; import * as Sentry from '../../src'; import { startSpan } from '../../src'; import type { Http, NodeFetch } from '../../src/integrations'; -import { getIsolationScope } from '../../src/sdk/api'; import type { NodeExperimentalClient } from '../../src/types'; import { cleanupOtel, getProvider, mockSdkInit } from '../helpers/mockSdkInit'; diff --git a/packages/node/test/integrations/localvariables.test.ts b/packages/node/test/integrations/localvariables.test.ts index 6a09111370a8..027ccc391c6d 100644 --- a/packages/node/test/integrations/localvariables.test.ts +++ b/packages/node/test/integrations/localvariables.test.ts @@ -1,4 +1,3 @@ -import type { ClientOptions, EventProcessor } from '@sentry/types'; import type { LRUMap } from '@sentry/utils'; import type { Debugger, InspectorNotification } from 'inspector'; diff --git a/packages/opentelemetry/src/spanExporter.ts b/packages/opentelemetry/src/spanExporter.ts index c15bd4483a9b..b9a9d306603c 100644 --- a/packages/opentelemetry/src/spanExporter.ts +++ b/packages/opentelemetry/src/spanExporter.ts @@ -1,4 +1,3 @@ -import type { Span } from '@opentelemetry/api'; import { SpanKind } from '@opentelemetry/api'; import type { ExportResult } from '@opentelemetry/core'; import { ExportResultCode } from '@opentelemetry/core'; @@ -9,7 +8,6 @@ import type { DynamicSamplingContext, Span as SentrySpan, SpanOrigin, Transactio import { logger } from '@sentry/utils'; import { getCurrentHub } from './custom/hub'; -import { OpenTelemetryScope } from './custom/scope'; import type { OpenTelemetryTransaction } from './custom/transaction'; import { startTransaction } from './custom/transaction'; import { DEBUG_BUILD } from './debug-build'; diff --git a/packages/replay/test/integration/rrweb.test.ts b/packages/replay/test/integration/rrweb.test.ts index 3543a6771ce4..2e648358ffe3 100644 --- a/packages/replay/test/integration/rrweb.test.ts +++ b/packages/replay/test/integration/rrweb.test.ts @@ -1,4 +1,3 @@ -import type { CanvasManagerInterface } from '../../src/types'; import { resetSdkMock } from '../mocks/resetSdkMock'; import { useFakeTimers } from '../utils/use-fake-timers'; diff --git a/packages/sveltekit/src/client/handleError.ts b/packages/sveltekit/src/client/handleError.ts index 799e6e36db72..0880d93a59ef 100644 --- a/packages/sveltekit/src/client/handleError.ts +++ b/packages/sveltekit/src/client/handleError.ts @@ -1,6 +1,6 @@ import { captureException } from '@sentry/svelte'; import { consoleSandbox } from '@sentry/utils'; -import type { HandleClientError, NavigationEvent } from '@sveltejs/kit'; +import type { HandleClientError } from '@sveltejs/kit'; // The SvelteKit default error handler just logs the error to the console // see: https://github.com/sveltejs/kit/blob/369e7d6851f543a40c947e033bfc4a9506fdc0a8/packages/kit/src/core/sync/write_client_manifest.js#LL127C2-L127C2 diff --git a/packages/sveltekit/test/common/utils.test.ts b/packages/sveltekit/test/common/utils.test.ts index f048494881ec..0b0352042164 100644 --- a/packages/sveltekit/test/common/utils.test.ts +++ b/packages/sveltekit/test/common/utils.test.ts @@ -1,5 +1,3 @@ -import { redirect } from '@sveltejs/kit'; - import { isHttpError, isRedirect } from '../../src/common/utils'; describe('isRedirect', () => { From 44de5153b85351a346ee25c7f112f23c12c4e349 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Thu, 21 Dec 2023 12:05:12 -0500 Subject: [PATCH 07/10] stop using declare const to merge namespace --- .../templates/routeHandlerWrapperTemplate.ts | 42 +++++++++---------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/packages/nextjs/src/config/templates/routeHandlerWrapperTemplate.ts b/packages/nextjs/src/config/templates/routeHandlerWrapperTemplate.ts index 6b5075ef9003..346b2c29a784 100644 --- a/packages/nextjs/src/config/templates/routeHandlerWrapperTemplate.ts +++ b/packages/nextjs/src/config/templates/routeHandlerWrapperTemplate.ts @@ -2,26 +2,12 @@ import * as Sentry from '@sentry/nextjs'; import type { WebFetchHeaders } from '@sentry/types'; // @ts-expect-error Because we cannot be sure if the RequestAsyncStorage module exists (it is not part of the Next.js public // API) we use a shim if it doesn't exist. The logic for this is in the wrapping loader. -// biome-ignore lint/nursery/noUnusedImports: Biome doesn't understand declare const import { requestAsyncStorage } from '__SENTRY_NEXTJS_REQUEST_ASYNC_STORAGE_SHIM__'; // @ts-expect-error See above -// biome-ignore lint/nursery/noUnusedImports: Biome doesn't understand declare const import * as routeModule from '__SENTRY_WRAPPING_TARGET_FILE__'; import type { RequestAsyncStorage } from './requestAsyncStorageShim'; -declare const requestAsyncStorage: RequestAsyncStorage; - -declare const routeModule: { - GET?: (...args: unknown[]) => unknown; - POST?: (...args: unknown[]) => unknown; - PUT?: (...args: unknown[]) => unknown; - PATCH?: (...args: unknown[]) => unknown; - DELETE?: (...args: unknown[]) => unknown; - HEAD?: (...args: unknown[]) => unknown; - OPTIONS?: (...args: unknown[]) => unknown; -}; - function wrapHandler(handler: T, method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS'): T { // Running the instrumentation code during the build phase will mark any function as "dynamic" because we're accessing // the Request object. We do not want to turn handlers dynamic so we skip instrumentation in the build phase. @@ -41,7 +27,8 @@ function wrapHandler(handler: T, method: 'GET' | 'POST' | 'PUT' | 'PATCH' | ' // We try-catch here just in case the API around `requestAsyncStorage` changes unexpectedly since it is not public API try { - const requestAsyncStore = requestAsyncStorage.getStore(); + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access + const requestAsyncStore = requestAsyncStorage.getStore() as ReturnType; sentryTraceHeader = requestAsyncStore?.headers.get('sentry-trace') ?? undefined; baggageHeader = requestAsyncStore?.headers.get('baggage') ?? undefined; headers = requestAsyncStore?.headers; @@ -67,10 +54,21 @@ export * from '__SENTRY_WRAPPING_TARGET_FILE__'; // @ts-expect-error This is the file we're wrapping export { default } from '__SENTRY_WRAPPING_TARGET_FILE__'; -export const GET = wrapHandler(routeModule.GET, 'GET'); -export const POST = wrapHandler(routeModule.POST, 'POST'); -export const PUT = wrapHandler(routeModule.PUT, 'PUT'); -export const PATCH = wrapHandler(routeModule.PATCH, 'PATCH'); -export const DELETE = wrapHandler(routeModule.DELETE, 'DELETE'); -export const HEAD = wrapHandler(routeModule.HEAD, 'HEAD'); -export const OPTIONS = wrapHandler(routeModule.OPTIONS, 'OPTIONS'); +declare const requestAsyncStorage: RequestAsyncStorage; + +type RouteHandler = (...args: unknown[]) => unknown; + +// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access +export const GET = wrapHandler(routeModule.GET as RouteHandler, 'GET'); +// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access +export const POST = wrapHandler(routeModule.POST as RouteHandler, 'POST'); +// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access +export const PUT = wrapHandler(routeModule.PUT as RouteHandler, 'PUT'); +// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access +export const PATCH = wrapHandler(routeModule.PATCH as RouteHandler, 'PATCH'); +// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access +export const DELETE = wrapHandler(routeModule.DELETE as RouteHandler, 'DELETE'); +// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access +export const HEAD = wrapHandler(routeModule.HEAD as RouteHandler, 'HEAD'); +// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access +export const OPTIONS = wrapHandler(routeModule.OPTIONS as RouteHandler, 'OPTIONS'); From bf656824678037381398b623caf23d707ad10b34 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Thu, 21 Dec 2023 12:06:27 -0500 Subject: [PATCH 08/10] more cleanup --- packages/core/src/integration.ts | 12 +----------- packages/node-experimental/src/sdk/scope.ts | 2 +- packages/node-experimental/test/sdk/scope.test.ts | 2 +- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/packages/core/src/integration.ts b/packages/core/src/integration.ts index f867ad1d032a..d587ddb55ce8 100644 --- a/packages/core/src/integration.ts +++ b/packages/core/src/integration.ts @@ -1,14 +1,4 @@ -import type { - Client, - Event, - EventHint, - EventProcessor, - Hub, - Integration, - IntegrationClass, - IntegrationFn, - Options, -} from '@sentry/types'; +import type { Client, Event, EventHint, EventProcessor, Hub, Integration, IntegrationFn, Options } from '@sentry/types'; import { arrayify, logger } from '@sentry/utils'; import { DEBUG_BUILD } from './debug-build'; diff --git a/packages/node-experimental/src/sdk/scope.ts b/packages/node-experimental/src/sdk/scope.ts index 86bad56e932e..5b9d56dc4b84 100644 --- a/packages/node-experimental/src/sdk/scope.ts +++ b/packages/node-experimental/src/sdk/scope.ts @@ -1,4 +1,4 @@ -import { getGlobalScope as _getGlobalScope, mergeScopeData, setGlobalScope } from '@sentry/core'; +import { getGlobalScope as _getGlobalScope, setGlobalScope } from '@sentry/core'; import { OpenTelemetryScope } from '@sentry/opentelemetry'; import type { Breadcrumb, Client, Event, EventHint, Severity, SeverityLevel } from '@sentry/types'; import { uuid4 } from '@sentry/utils'; diff --git a/packages/node-experimental/test/sdk/scope.test.ts b/packages/node-experimental/test/sdk/scope.test.ts index 6e1245c35aed..e3919654e920 100644 --- a/packages/node-experimental/test/sdk/scope.test.ts +++ b/packages/node-experimental/test/sdk/scope.test.ts @@ -2,7 +2,7 @@ import { prepareEvent } from '@sentry/core'; import type { Attachment, Breadcrumb, Client, ClientOptions, EventProcessor } from '@sentry/types'; import { Scope, getIsolationScope } from '../../src'; import { getGlobalScope } from '../../src/sdk/scope'; -import { mockSdkInit, resetGlobals } from '../helpers/mockSdkInit'; +import { mockSdkInit } from '../helpers/mockSdkInit'; describe('Unit | Scope', () => { it('allows to create & update a scope', () => { From 1442d605ac5ce581260cd1d646430d511dc03130 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Thu, 21 Dec 2023 12:08:17 -0500 Subject: [PATCH 09/10] add back import --- .../suites/public-api/startTransaction/init.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/browser-integration-tests/suites/public-api/startTransaction/init.js b/packages/browser-integration-tests/suites/public-api/startTransaction/init.js index 7a572891050b..d9626afb5cb8 100644 --- a/packages/browser-integration-tests/suites/public-api/startTransaction/init.js +++ b/packages/browser-integration-tests/suites/public-api/startTransaction/init.js @@ -1,5 +1,7 @@ +/* eslint-disable no-unused-vars */ import * as Sentry from '@sentry/browser'; -import '@sentry/tracing'; +// biome-ignore lint/nursery/noUnusedImports: +import * as _ from '@sentry/tracing'; window.Sentry = Sentry; From 03708d0cc10c866bd334b357c1e3aeb3a20d7c0a Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Thu, 21 Dec 2023 12:27:40 -0500 Subject: [PATCH 10/10] fix lint issue --- .../suites/public-api/startTransaction/init.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/browser-integration-tests/suites/public-api/startTransaction/init.js b/packages/browser-integration-tests/suites/public-api/startTransaction/init.js index d9626afb5cb8..e1903e2cc268 100644 --- a/packages/browser-integration-tests/suites/public-api/startTransaction/init.js +++ b/packages/browser-integration-tests/suites/public-api/startTransaction/init.js @@ -1,7 +1,7 @@ /* eslint-disable no-unused-vars */ import * as Sentry from '@sentry/browser'; -// biome-ignore lint/nursery/noUnusedImports: -import * as _ from '@sentry/tracing'; +// biome-ignore lint/nursery/noUnusedImports: Need to import tracing for side effect +import * as _ from '@sentry/tracing'; window.Sentry = Sentry;