Skip to content

Commit 5427625

Browse files
committed
chore(lint): resolve oxlint warnings
- Turn off `no-base-to-string`, as we rely on casting things to strings in many places after verifying that they are simple not-falsey. It could be worthwhile to impose better type safety on all these things at some point, but that is unlikely to be worth doing in the near term. - Remove several unused variables. We could consider disabling this rule in tests specifically, since that is where it's most common to leave scaffolding and debugging values behind. - Cast as types in a few cases to make our intention clear, where the values were actually being used safely, but not explicitly. - Disable `require-array-sort-compare` in one case where we benefit with a smaller code footprint by using the implicit numeric comparison on `Array.sort()`.
1 parent ffe00a7 commit 5427625

File tree

10 files changed

+10
-10
lines changed

10 files changed

+10
-10
lines changed

.oxlintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
"typescript/no-redundant-type-constituents": "off",
6767
"typescript/restrict-template-expressions": "off",
6868
"typescript/await-thenable": "warn",
69-
"typescript/no-base-to-string": "warn"
69+
"typescript/no-base-to-string": "off"
7070
}
7171
},
7272
{

dev-packages/node-overhead-gh-action/lib/getOverheadMeasurements.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ async function getMeasurements(instrumentFile, autocannonCommand = 'yarn test:ge
2828
await killAppProcess();
2929
return result;
3030
} catch (error) {
31+
//oxlint-disable-next-line restrict-template-expressions
3132
log(`Error running autocannon: ${error}`);
3233
await killAppProcess();
3334
throw error;

packages/effect/test/layer.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describe, expect, it } from '@effect/vitest';
22
import * as sentryCore from '@sentry/core';
3-
import { getClient, getCurrentScope, getIsolationScope, SDK_VERSION, SentrySpan } from '@sentry/core';
3+
import { getClient, getCurrentScope, getIsolationScope, SDK_VERSION } from '@sentry/core';
44
import { Effect, Layer, Logger, LogLevel } from 'effect';
55
import { afterEach, beforeEach, vi } from 'vitest';
66
import * as sentryClient from '../src/index.client';

packages/nextjs/test/utils/dropMiddlewareTunnelRequests.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ describe('dropMiddlewareTunnelRequests', () => {
138138
describe('skipOpenTelemetrySetup', () => {
139139
it('does not process spans when skipOpenTelemetrySetup is true', async () => {
140140
const core = await import('@sentry/core');
141-
const originalGetClient = core.getClient;
142141
vi.spyOn(core, 'getClient').mockReturnValueOnce({
143142
getOptions: () => ({ skipOpenTelemetrySetup: true }),
144143
} as any);

packages/node-core/src/integrations/systemError.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export const systemErrorIntegration = defineIntegration((options: Options = {})
4646
const error = hint.originalException;
4747

4848
const errorContext: SystemErrorContext = {
49-
...error,
49+
...(error as SystemErrorContext),
5050
};
5151

5252
if (!client.getOptions().sendDefaultPii && options.includePaths !== true) {

packages/nuxt/src/vite/sentryVitePlugin.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import type { Nuxt } from '@nuxt/schema';
2-
import { sentryVitePlugin } from '@sentry/vite-plugin';
32
import type { ConfigEnv, Plugin, UserConfig } from 'vite';
43
import type { SentryNuxtModuleOptions } from '../common/types';
5-
import { extractNuxtSourceMapSetting, getPluginOptions, validateDifferentSourceMapSettings } from './sourceMaps';
4+
import { extractNuxtSourceMapSetting, validateDifferentSourceMapSettings } from './sourceMaps';
65

76
/**
87
* Creates a Vite plugin that adds the Sentry Vite plugin and validates source map settings.

packages/nuxt/test/vite/sourceMaps-nuxtHooks.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ describe('setupSourceMaps hooks', () => {
112112
it.each([
113113
{ label: 'server (SSR) build', buildConfig: { build: { ssr: true }, plugins: [] } },
114114
{ label: 'client build', buildConfig: { build: { ssr: false }, plugins: [] } },
115-
])('adds sentry vite plugin to vite config for $label in production', async ({ buildConfig }) => {
115+
])('adds sentry vite plugin to vite config for $label in production', async () => {
116116
const { setupSourceMaps } = await import('../../src/vite/sourceMaps');
117117
const mockNuxt = createMockNuxt({ _prepare: false, dev: false });
118118
const { mockAddVitePlugin, getCapturedPlugins } = createMockAddVitePlugin();

packages/remix/src/server/serverTimingTracePropagation.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { Span } from '@sentry/core';
21
import { debug, getTraceData, isNodeEnv } from '@sentry/core';
32
import { DEBUG_BUILD } from '../utils/debug-build';
43
import { isCloudflareEnv } from '../utils/utils';

packages/remix/test/server/serverTimingTracePropagation.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
import { getActiveSpan, getTraceData, isNodeEnv, spanToBaggageHeader, spanToTraceHeader } from '@sentry/core';
1+
import { getActiveSpan, getTraceData, isNodeEnv } from '@sentry/core';
22
import { beforeEach, describe, expect, it, vi } from 'vitest';
33
import {
44
generateSentryServerTimingHeader,
55
injectServerTimingHeaderValue,
66
} from '../../src/server/serverTimingTracePropagation';
7+
import type { Span } from '@sentry/core';
78

89
const mockSpan = {
910
spanId: 'test-span-id',
1011
spanContext: () => ({ traceId: '12345678901234567890123456789012' }),
11-
};
12+
} as unknown as Span;
1213
const mockRootSpan = {
1314
spanId: 'root-span-id',
1415
spanContext: () => ({ traceId: '12345678901234567890123456789012' }),

packages/replay-internal/src/eventBuffer/EventBufferArray.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ export class EventBufferArray implements EventBuffer {
7373

7474
/** @inheritdoc */
7575
public getEarliestTimestamp(): number | null {
76+
//oxlint-disable-next-line require-array-sort-compare
7677
const timestamp = this.events.map(event => event.timestamp).sort()[0];
7778

7879
if (!timestamp) {

0 commit comments

Comments
 (0)