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/package.json b/package.json index 080235bde9a9..4fa76ae58198 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", diff --git a/packages/angular/test/tracing.test.ts b/packages/angular/test/tracing.test.ts index a407539026c5..37ef01348699 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..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,5 +1,6 @@ +/* eslint-disable no-unused-vars */ import * as Sentry from '@sentry/browser'; -// eslint-disable-next-line no-unused-vars +// biome-ignore lint/nursery/noUnusedImports: Need to import tracing for side effect import * as _ from '@sentry/tracing'; window.Sentry = Sentry; diff --git a/packages/browser/src/integrations/breadcrumbs.ts b/packages/browser/src/integrations/breadcrumbs.ts index c14465b3448b..831059e97756 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/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/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/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/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..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,13 +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'; 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..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,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-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..346b2c29a784 100644 --- a/packages/nextjs/src/config/templates/routeHandlerWrapperTemplate.ts +++ b/packages/nextjs/src/config/templates/routeHandlerWrapperTemplate.ts @@ -8,18 +8,6 @@ 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. @@ -39,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; @@ -65,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'); 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 4588d1b36b15..66606bbf8258 100644 --- a/packages/node-experimental/src/integrations/http.ts +++ b/packages/node-experimental/src/integrations/http.ts @@ -4,12 +4,11 @@ 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'; 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/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/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-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', () => { 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 fdb63636452f..8c515fc0afc9 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/react/test/profiler.test.tsx b/packages/react/test/profiler.test.tsx index 02a27836beec..03a8c7ed20dd 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 JSX 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 1d3d4df4f170..a17c885b5edf 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 e61306bc8b40..104374201722 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/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', () => { diff --git a/packages/vue/src/tracing.ts b/packages/vue/src/tracing.ts index 810fa40b045d..af93701e74a7 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';