Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["typescript", "import", "jsdoc", "jest", "vitest"],
"plugins": ["typescript", "import", "jsdoc", "vitest"],
"jsPlugins": [
{
"name": "sdk",
Expand All @@ -9,6 +9,11 @@
],
"categories": {},
"rules": {
"no-unused-vars": [
"warn",
{ "argsIgnorePattern": "^_", "varsIgnorePattern": "^_", "caughtErrorsIgnorePattern": "^_" }
],

// === Base rules from eslint-config-sdk/base.js ===
"no-console": "error",
"no-alert": "error",
Expand All @@ -27,28 +32,18 @@
"import/namespace": "off",
"import/no-unresolved": "off",

// === Jest/Vitest rules ===
"jest/no-focused-tests": "error",
"jest/no-disabled-tests": "error",

// === Rules turned off (not enforced in ESLint or causing false positives) ===
"no-control-regex": "off",
"jsdoc/check-tag-names": "off",
"jsdoc/require-yields": "off",
"no-useless-rename": "off",
"no-constant-binary-expression": "off",
"jest/no-conditional-expect": "off",
"jest/expect-expect": "off",
"jest/no-standalone-expect": "off",
"jest/require-to-throw-message": "off",
"jest/valid-title": "off",
"jest/no-export": "off",
"jest/valid-describe-callback": "off",
"vitest/hoisted-apis-on-top": "off",
"vitest/no-conditional-tests": "off",
"no-unsafe-optional-chaining": "off",
"no-eval": "off",
"no-import-assign": "off",
"typescript/no-duplicate-type-constituents": "off",

// === Custom SDK rules (via JS plugin) ===
"sdk/no-eq-empty": "error"
Expand All @@ -61,17 +56,17 @@
"typescript/consistent-type-imports": "error",
"typescript/no-unnecessary-type-assertion": "error",
"typescript/prefer-for-of": "error",
// "typescript/no-floating-promises": ["error", { "ignoreVoid": false }],
"typescript/no-floating-promises": ["error", { "ignoreVoid": true }],
"typescript/no-dynamic-delete": "error",
// "typescript/no-unsafe-member-access": "error",
"typescript/no-unsafe-member-access": "error",
"typescript/unbound-method": "error",
"typescript/no-explicit-any": "error",
"typescript/no-empty-function": "off",

// === FIXME: Rules to turn back as error ===
"typescript/prefer-optional-chain": "warn",
"typescript/no-floating-promises": "warn",
"typescript/no-unsafe-member-access": "warn"
"typescript/prefer-optional-chain": ["error"],
"typescript/no-redundant-type-constituents": "off",
"typescript/restrict-template-expressions": "off",
"typescript/await-thenable": "warn",
"typescript/no-base-to-string": "warn"
}
},
{
Expand Down Expand Up @@ -111,7 +106,12 @@
"typescript/no-floating-promises": "off",
"typescript/unbound-method": "off",
"max-lines": "off",
"complexity": "off"
"complexity": "off",
"typescript/prefer-optional-chain": "off",
"typescript/no-misused-spread": "off",
"typescript/require-array-sort-compare": "off",
"typescript/no-base-to-string": "off",
"typescript/await-thenable": "off"
}
},
{
Expand Down
6 changes: 5 additions & 1 deletion dev-packages/.oxlintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
"rules": {
"typescript/no-explicit-any": "off",
"max-lines": "off",
"no-unused-expressions": "off"
"no-unused-expressions": "off",
"typescript/require-array-sort-compare": "off",
"typescript/no-misused-spread": "off",
"typescript/no-base-to-string": "off",
"typescript/await-thenable": "off"
}
}
4 changes: 2 additions & 2 deletions dev-packages/browser-integration-tests/utils/replayHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ export function replayEnvelopeIsCompressed(resOrReq: Request | Response): boolea
const lines: boolean[] = envelopeString.split('\n').map(line => {
try {
JSON.parse(line);
} catch (error) {
} catch {
// If we fail to parse a line, we _might_ have found a compressed payload,
// so let's check if this is actually the case.
// This is quite hacky but we can't go through `line` because the prior operations
Expand Down Expand Up @@ -394,7 +394,7 @@ export const replayEnvelopeParser = (request: Request | null): unknown[] => {
const lines = envelopeString.split('\n').map(line => {
try {
return JSON.parse(line);
} catch (error) {
} catch {
// If we fail to parse a line, we _might_ have found a compressed payload,
// so let's check if this is actually the case.
// This is quite hacky but we can't go through `line` because the prior operations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ async function run() {
},
],
});
} catch (error) {
} catch {
// Expected error
}
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { afterAll, describe, expect, test } from 'vitest';
import { cleanupChildProcesses, createRunner } from '../../../utils/runner';

// eslint-disable-next-line jest/no-disabled-tests
describe.skip('tedious auto instrumentation', { timeout: 75_000 }, () => {
afterAll(() => {
cleanupChildProcesses();
Expand Down
2 changes: 1 addition & 1 deletion dev-packages/node-overhead-gh-action/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ async function run() {
body,
});
}
} catch (error) {
} catch {
core.error(
"Error updating comment. This can happen for PR's originating from a fork without write permissions.",
);
Expand Down
3 changes: 0 additions & 3 deletions dev-packages/rollup-utils/plugins/npmPlugins.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
* Sucrase plugin docs: https://github.com/rollup/plugins/tree/master/packages/sucrase
*/

import * as fs from 'fs';
import * as path from 'path';

import json from '@rollup/plugin-json';
import replace from '@rollup/plugin-replace';
import cleanup from 'rollup-plugin-cleanup';
Expand Down
2 changes: 1 addition & 1 deletion dev-packages/size-limit-gh-action/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ async function run() {
body,
});
}
} catch (error) {
} catch {
core.error(
"Error updating comment. This can happen for PR's originating from a fork without write permissions.",
);
Expand Down
3 changes: 2 additions & 1 deletion packages/angular/src/errorhandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export interface ErrorHandlerOptions {
function tryToUnwrapZonejsError(error: unknown): unknown | Error {
// TODO: once Angular14 is the minimum requirement ERROR_ORIGINAL_ERROR and
// getOriginalError from error.ts can be used directly.
return error && (error as { ngOriginalError: Error }).ngOriginalError
return (error as { ngOriginalError?: Error })?.ngOriginalError
? (error as { ngOriginalError: Error }).ngOriginalError
: error;
}
Expand All @@ -39,6 +39,7 @@ function extractHttpModuleError(error: HttpErrorResponse): string | Error {

// ... or an`ErrorEvent`, which can provide us with the message but no stack...
// guarding `ErrorEvent` against `undefined` as it's not defined in Node environments
// oxlint-disable-next-line typescript/prefer-optional-chain
if (typeof ErrorEvent !== 'undefined' && error.error instanceof ErrorEvent && error.error.message) {
return error.error.message;
}
Expand Down
3 changes: 2 additions & 1 deletion packages/astro/src/server/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,9 +423,10 @@ function getParametrizedRoute(
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
const routesFromManifest = ctx?.[Symbol.for('context.routes')]?.manifest?.routes;

// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
// oxlint-disable-next-line typescript/no-unsafe-member-access
const matchedRouteSegmentsFromManifest = routesFromManifest?.find(
(route: { routeData?: { route?: string } }) => route?.routeData?.route === rawRoutePattern,
// oxlint-disable-next-line typescript/no-unsafe-member-access
)?.routeData?.segments;

return (
Expand Down
1 change: 0 additions & 1 deletion packages/browser-utils/src/metrics/browserMetrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,6 @@ type StartEventName =
| 'loadEvent';

type EndEventName =
| 'connectEnd'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m: Why did we remove connectEnd? It's a valid property for resource timing and we reference it below in the code. I suspect it's because this type isn't used there (?).

Copy link
Member Author

@logaretm logaretm Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shows up again in line 581, so its literally duplicated 😆 It's just outside the diff window

| 'domainLookupStart'
| 'domainLookupEnd'
| 'unloadEventEnd'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function initUnique<T>(identityObj: object, ClassObj: new () => T): T {
instanceMap.set(identityObj, new ClassObj());
}
return instanceMap.get(identityObj)! as T;
} catch (e) {
} catch (_e) {
// --- START Sentry-custom code (try/catch wrapping) ---
// Fix for cases where identityObj is not a valid key for WeakMap (sometimes a problem in Safari)
// Just return a new instance without caching it in instanceMap
Expand Down
1 change: 1 addition & 0 deletions packages/browser/src/eventbuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ function getPopFirstTopFrames(ex: Error & { framesToPop?: unknown }): number {
function isWebAssemblyException(exception: unknown): exception is WebAssembly.Exception {
// Check for support
// @ts-expect-error - WebAssembly.Exception is a valid class
// oxlint-disable-next-line typescript/prefer-optional-chain
if (typeof WebAssembly !== 'undefined' && typeof WebAssembly.Exception !== 'undefined') {
// @ts-expect-error - WebAssembly.Exception is a valid class
return exception instanceof WebAssembly.Exception;
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/profiling/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ export function startJSSelfProfile(): JSSelfProfiler | undefined {
// as we risk breaking the user's application, so just disable profiling and log an error.
try {
return new JSProfilerConstructor({ sampleInterval: samplingIntervalMS, maxBufferSize: maxSamples });
} catch (e) {
} catch (_e) {
if (DEBUG_BUILD) {
debug.log(
"[Profiling] Failed to initialize the Profiling constructor, this is likely due to a missing 'Document-Policy': 'js-profiling' header.",
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/stack-parsers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const chromeStackParserFn: StackLineParserFn = line => {
const parts = chromeRegex.exec(line) as null | [string, string, string, string, string];

if (parts) {
const isEval = parts[2] && parts[2].indexOf('eval') === 0; // start of line
const isEval = parts[2]?.indexOf('eval') === 0; // start of line

if (isEval) {
const subMatch = chromeEvalRegex.exec(parts[2]) as null | [string, string, string, string];
Expand Down
3 changes: 1 addition & 2 deletions packages/browser/src/tracing/browserTracingIntegration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -526,8 +526,7 @@ export const browserTracingIntegration = ((options: Partial<BrowserTracingOption
if (
enableLongAnimationFrame &&
GLOBAL_OBJ.PerformanceObserver &&
PerformanceObserver.supportedEntryTypes &&
PerformanceObserver.supportedEntryTypes.includes('long-animation-frame')
PerformanceObserver.supportedEntryTypes?.includes('long-animation-frame')
) {
startTrackingLongAnimationFrames();
} else if (enableLongTask) {
Expand Down
4 changes: 2 additions & 2 deletions packages/browser/src/transports/offline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,15 @@ function createIndexedDbStore(options: BrowserOfflineTransportOptions): OfflineS
return {
push: async (env: Envelope) => {
try {
const serialized = await serializeEnvelope(env);
const serialized = serializeEnvelope(env);
await push(getStore(), serialized, options.maxQueueSize || 30);
} catch {
//
}
},
unshift: async (env: Envelope) => {
try {
const serialized = await serializeEnvelope(env);
const serialized = serializeEnvelope(env);
await unshift(getStore(), serialized, options.maxQueueSize || 30);
} catch {
//
Expand Down
2 changes: 1 addition & 1 deletion packages/bun/scripts/install-bun.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const https = require('https');
const installScriptUrl = 'https://bun.sh/install';

// Check if bun is installed
exec('bun --version', (error, version) => {
exec('bun --version', (error, _version) => {
if (error) {
console.error('bun is not installed. Installing...');
installLatestBun();
Expand Down
2 changes: 1 addition & 1 deletion packages/cloudflare/src/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export function wrapRequestHandler(
statusText: res.statusText,
headers: res.headers,
});
} catch (e) {
} catch (_e) {
// tee() failed (e.g stream already locked) - fall back to non-streaming handling
span.end();
waitUntil?.(flushAndDispose(client));
Expand Down
2 changes: 1 addition & 1 deletion packages/cloudflare/test/workflow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const mockStep: WorkflowStep = {
} else {
return await (maybeCallback ? maybeCallback() : Promise.resolve());
}
} catch (error) {
} catch {
await new Promise(resolve => setTimeout(resolve, 1000));
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1321,7 +1321,7 @@ export abstract class Client<O extends ClientOptions = ClientOptions> {
throw _makeDoNotSendEventError('An event processor returned `null`, will not send event.');
}

const isInternalException = hint.data && (hint.data as { __sentry__: boolean }).__sentry__ === true;
const isInternalException = (hint.data as { __sentry__: boolean })?.__sentry__ === true;
if (isInternalException) {
return prepared;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/integrations/mcp-server/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ function captureHandlerError(error: Error, methodName: keyof MCPServerInstance,
extraData.prompt_name = handlerName;
captureError(error, 'prompt_execution', extraData);
}
} catch (captureErr) {
} catch (_captureErr) {
// noop
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/tracing/openai/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ export function addResponsesApiAttributes(span: Span, response: OpenAIResponseOb
// Filter for function_call type objects in the output array
const functionCalls = responseWithOutput.output.filter(
(item): unknown =>
// oxlint-disable-next-line typescript/prefer-optional-chain
typeof item === 'object' && item !== null && (item as Record<string, unknown>).type === 'function_call',
);

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/tracing/vercel-ai/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ function vercelAiEventProcessor(event: Event): Event {

// Also apply to root when it is the invoke_agent pipeline
const trace = event.contexts?.trace;
if (trace && trace.op === 'gen_ai.invoke_agent') {
if (trace?.op === 'gen_ai.invoke_agent') {
applyAccumulatedTokens(trace, tokenAccumulator);
}
}
Expand Down
9 changes: 1 addition & 8 deletions packages/core/src/types-hoist/polymorphics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,13 @@ export interface PolymorphicEvent {
}

/** A `Request` type compatible with Node, Express, browser, etc., because everything is optional */
export type PolymorphicRequest = BaseRequest &
BrowserRequest &
NodeRequest &
ExpressRequest &
KoaRequest &
NextjsRequest;
export type PolymorphicRequest = BaseRequest & NodeRequest & ExpressRequest & KoaRequest & NextjsRequest;

type BaseRequest = {
method?: string;
url?: string;
};

type BrowserRequest = BaseRequest;

type NodeRequest = BaseRequest & {
headers?: {
[key: string]: string | string[] | undefined;
Expand Down
4 changes: 0 additions & 4 deletions packages/core/src/utils/debug-logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,6 @@ function log(...args: Parameters<typeof console.log>): void {
_maybeLog('log', ...args);
}

function info(...args: Parameters<typeof console.info>): void {
_maybeLog('info', ...args);
}
Comment on lines -88 to -90
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m: Was debug.info unused?

Copy link
Member Author

@logaretm logaretm Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weirdly not, because it was never exported unlike it's friends, so no module had a way of using it.

Happy to put it back and slap an ignore on it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's unused let's remove it :) I was just surprised


function warn(...args: Parameters<typeof console.warn>): void {
_maybeLog('warn', ...args);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/utils/exports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function replaceExports(
// Replace the named export - handle read-only properties
try {
exports[exportName] = wrappedConstructor;
} catch (error) {
} catch {
// If direct assignment fails, override the property descriptor
Object.defineProperty(exports, exportName, {
value: wrappedConstructor,
Expand All @@ -35,7 +35,7 @@ export function replaceExports(
if (exports.default === original) {
try {
exports.default = wrappedConstructor;
} catch (error) {
} catch {
Object.defineProperty(exports, 'default', {
value: wrappedConstructor,
writable: true,
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/utils/prepareEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export function prepareEvent(
];

// Skip event processors for internal exceptions to prevent recursion
// oxlint-disable-next-line typescript/prefer-optional-chain
const isInternalException = hint.data && (hint.data as { __sentry__: boolean }).__sentry__ === true;
Comment on lines +98 to 99
Copy link
Member

@Lms24 Lms24 Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super-l: since we're type-casting anyway already, we could simpify this to

Suggested change
// oxlint-disable-next-line typescript/prefer-optional-chain
const isInternalException = hint.data && (hint.data as { __sentry__: boolean }).__sentry__ === true;
// oxlint-disable-next-line typescript/prefer-optional-chain
const isInternalException = (hint.data as { __sentry__?: boolean })?.__sentry__ === true;

which might cut down bundle size ever so slightly? Again, feel free to disregard

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This rule is a bit buggy it threw me off, yep I can do this!

const result = isInternalException
? resolvedSyncPromise(prepared)
Expand Down
2 changes: 0 additions & 2 deletions packages/core/test/lib/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2816,8 +2816,6 @@ describe('Client', () => {
// We could set "NODE_OPTIONS='--unhandled-rejections=warn' but it
// would affect the entire test suite.
// Maybe this can be re-enabled when switching to vitest.
//
// eslint-disable-next-line jest/no-disabled-tests
test.skip('handles asynchronous errors', async () => {
const error = new Error('Test error');
const callback = vi.fn().mockRejectedValue(error);
Expand Down
Loading
Loading