X Tutup
Skip to content

chore(lint): Rule adjustments and fix warnings#19612

Open
logaretm wants to merge 16 commits intodevelopfrom
awad/oxlint-rules-cleanup
Open

chore(lint): Rule adjustments and fix warnings#19612
logaretm wants to merge 16 commits intodevelopfrom
awad/oxlint-rules-cleanup

Conversation

@logaretm
Copy link
Member

@logaretm logaretm commented Mar 3, 2026

This is a follow up PR that cleans up our configuration and reverts the downgrade to warning for some of the rules we use. This brings us to a similar level of coverage with eslint.

Some rules have sensitivity issue, especially when it comes to optional chaining and types so we will still have a lot of warnings.

Summary of Changes

Config changes (.oxlintrc.json)

Globally disabled (TS files)

Rule Why
no-redundant-type-constituents Many violations are intentional — AI integration types use 'literal' | string for autocomplete hints, and unknown | X patterns are common throughout the codebase. Low bug-catching value.
restrict-template-expressions 81 violations mostly from OTel span attributes and unknown values in template strings. Would require String() wrappers everywhere for minimal safety gain — the SDK handles these at runtime.
await-thenable await on non-Promises is valid JS — it's a useful pattern for uniformly handling T | Promise<T> without branching. Not a bug.
no-base-to-string Set to warn (not off). Kept visible since [object Object] in strings is a real issue, but not blocking CI while we clean up the 22 remaining source violations.

Disabled in tests + dev-packages only

Rule Why
no-misused-spread Tests intentionally spread class instances to create plain fixture objects.
require-array-sort-compare Test assertions sorting string arrays — .sort() without comparator is fine for strings.
no-base-to-string Tests don't need strict toString safety.

Configured

Rule Why
no-unused-vars Set to warn with _ prefix ignore patterns (argsIgnorePattern, varsIgnorePattern, caughtErrorsIgnorePattern). Standard convention — unused catch params/args prefixed with _ are intentional.

Dev-packages config (dev-packages/.oxlintrc.json)

Added require-array-sort-compare, no-misused-spread, and no-base-to-string as off — these rules aren't worth enforcing in test infrastructure.

Code fixes

Change Count What
Removed | undefined from optional params 19 param?: T | undefinedparam?: T — the ? already implies undefined
Prefixed unused catch params with _ 25 catch (error)catch (_error) — follows the _ convention for intentionally unused variables
Prefixed unused callback param 1 (error, version)(error, _version) in bun/scripts/install-bun.js

Result

373 warnings → 31 (22 of which are the intentional no-base-to-string warnings we kept visible).

Closes #19718 (added automatically)

@logaretm logaretm self-assigned this Mar 3, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2026

size-limit report 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 25.63 kB +0.04% +9 B 🔺
@sentry/browser - with treeshaking flags 24.14 kB +0.02% +4 B 🔺
@sentry/browser (incl. Tracing) 42.44 kB +0.01% +2 B 🔺
@sentry/browser (incl. Tracing, Profiling) 47.1 kB +0.02% +7 B 🔺
@sentry/browser (incl. Tracing, Replay) 81.24 kB -0.01% -7 B 🔽
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 70.86 kB -0.02% -11 B 🔽
@sentry/browser (incl. Tracing, Replay with Canvas) 85.94 kB -0.01% -6 B 🔽
@sentry/browser (incl. Tracing, Replay, Feedback) 98.2 kB -0.02% -11 B 🔽
@sentry/browser (incl. Feedback) 42.44 kB +0.02% +6 B 🔺
@sentry/browser (incl. sendFeedback) 30.31 kB +0.04% +11 B 🔺
@sentry/browser (incl. FeedbackAsync) 35.36 kB +0.03% +9 B 🔺
@sentry/browser (incl. Metrics) 26.8 kB +0.03% +7 B 🔺
@sentry/browser (incl. Logs) 26.94 kB +0.02% +5 B 🔺
@sentry/browser (incl. Metrics & Logs) 27.62 kB +0.03% +6 B 🔺
@sentry/react 27.39 kB +0.03% +6 B 🔺
@sentry/react (incl. Tracing) 44.77 kB +0.01% +3 B 🔺
@sentry/vue 30.08 kB +0.02% +6 B 🔺
@sentry/vue (incl. Tracing) 44.3 kB +0.02% +5 B 🔺
@sentry/svelte 25.66 kB +0.03% +6 B 🔺
CDN Bundle 28.18 kB +0.02% +5 B 🔺
CDN Bundle (incl. Tracing) 43.26 kB +0.01% +1 B 🔺
CDN Bundle (incl. Logs, Metrics) 29.02 kB +0.03% +6 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) 44.1 kB -0.01% -2 B 🔽
CDN Bundle (incl. Replay, Logs, Metrics) 68.08 kB -0.02% -7 B 🔽
CDN Bundle (incl. Tracing, Replay) 80.13 kB -0.02% -12 B 🔽
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 80.99 kB -0.02% -10 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) 85.64 kB -0.02% -12 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 86.52 kB -0.02% -14 B 🔽
CDN Bundle - uncompressed 82.37 kB +0.03% +21 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 128.05 kB -0.02% -19 B 🔽
CDN Bundle (incl. Logs, Metrics) - uncompressed 85.21 kB +0.03% +21 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 130.88 kB -0.02% -19 B 🔽
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 208.84 kB -0.01% -11 B 🔽
CDN Bundle (incl. Tracing, Replay) - uncompressed 244.9 kB -0.03% -51 B 🔽
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 247.72 kB -0.03% -51 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 257.81 kB -0.02% -51 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 260.62 kB -0.02% -51 B 🔽
@sentry/nextjs (client) 47.19 kB +0.02% +5 B 🔺
@sentry/sveltekit (client) 42.9 kB +0.01% +4 B 🔺
@sentry/node-core 52.27 kB +0.07% +33 B 🔺
@sentry/node 174.77 kB +0.04% +64 B 🔺
@sentry/node - without tracing 97.44 kB +0.06% +54 B 🔺
@sentry/aws-serverless 113.24 kB +0.05% +50 B 🔺

View base workflow run

@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2026

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 8,486 - 9,389 -10%
GET With Sentry 1,565 18% 1,709 -8%
GET With Sentry (error only) 5,879 69% 6,041 -3%
POST Baseline 1,145 - 1,208 -5%
POST With Sentry 533 47% 589 -10%
POST With Sentry (error only) 999 87% 1,065 -6%
MYSQL Baseline 3,122 - 3,242 -4%
MYSQL With Sentry 409 13% 436 -6%
MYSQL With Sentry (error only) 2,500 80% 2,650 -6%

View base workflow run

Base automatically changed from awad/oxlint to develop March 6, 2026 21:52
@logaretm logaretm force-pushed the awad/oxlint-rules-cleanup branch 2 times, most recently from e9ad91b to 616ec0f Compare March 9, 2026 14:42
@logaretm logaretm changed the title chore: Enable all Rules and Cleanup Configuration chore(lint): Rule adjustments and fix warnings Mar 9, 2026
@logaretm logaretm force-pushed the awad/oxlint-rules-cleanup branch from 582de79 to 9dfdd14 Compare March 9, 2026 14:48
@logaretm logaretm marked this pull request as ready for review March 9, 2026 17:15
@logaretm logaretm requested a review from a team as a code owner March 9, 2026 17:15
Copilot AI review requested due to automatic review settings March 9, 2026 17:15
@logaretm logaretm requested review from Lms24 and nicohrubec March 9, 2026 17:15
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts the repo’s oxlint configuration and applies a broad set of small code edits to reduce lint warnings (mostly optional chaining simplifications, unused param renames, and inline oxlint suppressions), aiming to restore stricter lint coverage.

Changes:

  • Updated .oxlintrc.json / dev-packages/.oxlintrc.json rule configuration (re-enabling certain rules, tuning no-unused-vars, and scoping rule overrides for tests/dev-packages).
  • Performed mechanical code cleanups across packages (remove redundant | undefined from optional params, prefix unused catch params with _, optional-chaining rewrites).
  • Added targeted oxlint-disable(-next-line) comments where rules produce false positives or are intentionally violated.

Reviewed changes

Copilot reviewed 72 out of 72 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
packages/sveltekit/test/server-common/handle.test.ts Prefix unused catch param to satisfy unused-var conventions.
packages/sveltekit/src/server-common/handle.ts Added oxlint suppression for optional-chain preference in a narrowing pattern.
packages/sveltekit/src/index.types.ts Simplified optional param type (timeout?: number).
packages/svelte/test/components/Dummy.svelte Added oxlint suppression for an intentionally “assigned by framework” prop.
packages/solidstart/src/index.types.ts Simplified optional param type (timeout?: number).
packages/replay-worker/test/unit/Compressor.test.ts Small test cleanup (remove void from throwing expectation wrapper).
packages/replay-internal/src/util/handleRecordingEmit.ts Optional chaining simplification around replay.session.
packages/replay-internal/src/replay.ts Optional chaining simplification around this.session.
packages/replay-internal/src/coreHandlers/util/addNetworkBreadcrumb.ts Added oxlint suppression for floating-promises in fire-and-forget span creation.
packages/replay-internal/src/coreHandlers/handleHistory.ts Added oxlint suppression for floating-promises in fire-and-forget span creation.
packages/replay-internal/src/coreHandlers/handleAfterSendEvent.ts Optional chaining simplification for event.tags.
packages/remix/src/utils/utils.ts Simplified optional param type (formDataKeys?: ...).
packages/remix/src/client/remixRouteParameterization.ts Prefix unused catch param to satisfy unused-var conventions.
packages/remix/src/client/performance.tsx Optional chaining for safe last-match access.
packages/react/src/reactrouter-compat-utils/route-manifest.ts Optional chaining simplification for manifest length check.
packages/react/src/reactrouter-compat-utils/instrumentation.tsx Added oxlint suppression for promise.finally(...) floating promise.
packages/react/src/hoist-non-react-statics.ts Optional chaining + unused catch param prefix.
packages/opentelemetry/src/utils/parseSpanDescription.ts Added oxlint suppression for array sort comparator rule.
packages/nuxt/src/runtime/utils.ts Added oxlint suppression for unsafe member access.
packages/nuxt/src/runtime/plugins/storage.server.ts Prefix unused catch param to satisfy unused-var conventions.
packages/node/src/integrations/tracing/openai/instrumentation.ts Prefix unused catch param to satisfy unused-var conventions.
packages/node/src/integrations/tracing/graphql.ts Added oxlint suppression for array sort comparator rule.
packages/node/src/integrations/tracing/anthropic-ai/instrumentation.ts Prefix unused catch param to satisfy unused-var conventions.
packages/node-core/src/utils/detection.ts Added oxlint suppression for prefer-optional-chain in typeof module guard.
packages/node-core/src/utils/captureRequestBody.ts Prefix unused catch param to satisfy unused-var conventions.
packages/node-core/src/transports/http.ts Prefix unused catch param to satisfy unused-var conventions.
packages/node-core/src/sdk/client.ts Simplified optional param type (timeout?: number).
packages/node-core/src/light/client.ts Simplified optional param type (timeout?: number).
packages/node-core/src/integrations/local-variables/worker.ts Added oxlint suppression for prefer-optional-chain around null/undefined checks.
packages/node-core/src/integrations/local-variables/local-variables-sync.ts Simplified optional param type + added oxlint suppression for prefer-optional-chain around null/undefined checks.
packages/nextjs/src/common/devErrorSymbolicationEventProcessor.ts Added oxlint suppression for prefer-optional-chain in multi-guard narrowing logic.
packages/nextjs/src/client/clientNormalizationIntegration.ts Switched suppression comment to oxlint for global access guard.
packages/google-cloud-serverless/test/gcpfunction/http.test.ts Prefix unused catch param to satisfy unused-var conventions.
packages/deno/src/utils/streaming.ts Prefix unused catch param + added oxlint suppression for reader.closed.finally(...).
packages/deno/src/client.ts Simplified optional param type (timeout?: number).
packages/core/test/lib/utils/object.test.ts Added oxlint suppression for intentionally assigned-by-eval variable.
packages/core/test/lib/transports/base.test.ts Prefix unused catch param to satisfy unused-var conventions.
packages/core/src/utils/url.ts Simplified optional param types for URL parsing helpers.
packages/core/src/utils/prepareEvent.ts Added oxlint suppression for prefer-optional-chain around internal exception marker check.
packages/core/src/utils/hasSpansEnabled.ts Simplified optional param type for options.
packages/core/src/utils/exports.ts Prefix unused catch param to satisfy unused-var conventions.
packages/core/src/utils/debug-logger.ts Removed info helper (logger interface now exposes log/warn/error).
packages/core/src/types-hoist/polymorphics.ts Simplified redundant type intersections.
packages/core/src/tracing/vercel-ai/index.ts Optional chaining simplification.
packages/core/src/tracing/sentrySpan.ts Simplified optional param type for recordException.
packages/core/src/tracing/sentryNonRecordingSpan.ts Simplified optional param type for recordException.
packages/core/src/tracing/openai/utils.ts Added oxlint suppression for prefer-optional-chain in object/type guard.
packages/core/src/tracing/google-genai/index.ts Added oxlint suppression for prefer-optional-chain in in-operator guard.
packages/core/src/integrations/mcp-server/transport.ts Added oxlint suppression for prefer-optional-chain in explicit null/undefined checks.
packages/core/src/integrations/mcp-server/handlers.ts Prefix unused catch param to satisfy unused-var conventions.
packages/core/src/client.ts Simplified optional hint param types + added oxlint suppression for prefer-optional-chain around internal exception marker check.
packages/cloudflare/test/workflow.test.ts Prefix unused catch param to satisfy unused-var conventions.
packages/cloudflare/src/request.ts Prefix unused catch param to satisfy unused-var conventions.
packages/bun/scripts/install-bun.js Prefix unused callback param to satisfy unused-var conventions.
packages/browser/src/tracing/browserTracingIntegration.ts Optional chaining simplification for supportedEntryTypes.
packages/browser/src/stack-parsers.ts Optional chaining simplification for eval detection.
packages/browser/src/profiling/utils.ts Prefix unused catch param to satisfy unused-var conventions.
packages/browser/src/eventbuilder.ts Added oxlint suppression for prefer-optional-chain in typeof WebAssembly guard.
packages/browser-utils/src/metrics/web-vitals/lib/initUnique.ts Prefix unused catch param to satisfy unused-var conventions.
packages/browser-utils/src/metrics/browserMetrics.ts Type union tweak related to navigation timing end event names.
packages/astro/src/server/middleware.ts Replaced eslint suppression with oxlint suppression for unsafe member access (and added one more inline).
packages/astro/src/integration/snippets.ts Temporarily disabled prefer-optional-chain for a block generating snippet logic.
packages/astro/src/index.types.ts Simplified optional param type (timeout?: number).
packages/angular/src/zone.ts Updated suppression comment to include prefer-optional-chain (but currently via eslint directive).
packages/angular/src/errorhandler.ts Added oxlint suppressions for prefer-optional-chain in narrowing patterns.
dev-packages/size-limit-gh-action/index.mjs Prefix unused catch param to satisfy unused-var conventions.
dev-packages/rollup-utils/plugins/npmPlugins.mjs Removed unused fs/path imports.
dev-packages/node-overhead-gh-action/index.mjs Prefix unused catch param to satisfy unused-var conventions.
dev-packages/node-integration-tests/suites/tracing/google-genai/scenario.mjs Prefix unused catch param to satisfy unused-var conventions.
dev-packages/browser-integration-tests/utils/replayHelpers.ts Prefix unused catch param to satisfy unused-var conventions.
dev-packages/.oxlintrc.json Turned off additional TS rules for dev-packages.
.oxlintrc.json Updated plugin/rule configuration and rule severities/overrides.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +3 to 4
"plugins": ["typescript", "import", "jsdoc", "vitest"],
"jsPlugins": [
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

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

.oxlintrc.json removes the jest plugin from plugins, but the config still enables multiple jest/* rules (e.g. jest/no-focused-tests, jest/no-disabled-tests, and several jest/* rules turned off later). With oxlint running in CI, this will typically fail config validation or leave these rules ineffective. Either re-add the jest plugin, or migrate these rules to the vitest/* equivalents and remove the jest/* rules entirely.

Copilot uses AI. Check for mistakes.
Comment on lines +10 to 11
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access typescript/prefer-optional-chain
const isNgZoneEnabled = typeof Zone !== 'undefined' && Zone.root?.run;
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

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

This is an eslint-disable-next-line directive, but the rule you’re trying to suppress (typescript/prefer-optional-chain) is an oxlint rule name. Since the repo lint script runs oxlint, this comment won’t suppress the oxlint error. Use an oxlint-disable-next-line typescript/prefer-optional-chain comment here instead (keeping the typeof Zone !== 'undefined' check, since optional chaining can’t replace it without risking a ReferenceError).

Copilot uses AI. Check for mistakes.
Comment on lines +252 to 254
// oxlint-disable-next-line typescript/no-floating-promises
promise.finally(() => {
const currentPromises = pendingLazyRouteLoads.get(span);
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

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

Instead of disabling typescript/no-floating-promises here, it would be clearer to explicitly mark the returned promise as intentionally unhandled (the rule is configured with ignoreVoid: true in .oxlintrc.json). Consider prefixing this with void so the intent is explicit and you don’t need a disable comment.

Copilot uses AI. Check for mistakes.
Comment on lines 40 to 44
replay.addUpdate(() => {
// oxlint-disable-next-line typescript/no-floating-promises
createPerformanceSpans(replay, [result]);
// Returning false to flush
return false;
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

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

createPerformanceSpans returns an array of promises (Promise<...>[]), so calling it without handling the results is what triggers typescript/no-floating-promises. Rather than suppressing the rule, consider explicitly handling/ignoring the promises (e.g. aggregate and intentionally drop with void), which makes the fire-and-forget behavior clearer and avoids blanket suppression on this line.

Copilot uses AI. Check for mistakes.
Comment on lines 22 to 25
replay.addUpdate(() => {
// oxlint-disable-next-line typescript/no-floating-promises
createPerformanceSpans(replay, [result]);
// Returning true will cause `addUpdate` to not flush
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

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

Same as in handleHistorySpanListener: createPerformanceSpans returns an array of promises, so the current call is effectively fire-and-forget. Instead of disabling typescript/no-floating-promises, consider explicitly aggregating/handling the promises (or intentionally ignoring them with void) so it’s clear these async operations are intentionally not awaited.

Copilot uses AI. Check for mistakes.
Comment on lines +84 to 86
// oxlint-disable-next-line typescript/no-floating-promises
reader.closed.finally(() => onDone());
return new ReadableStream({
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

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

Rather than disabling typescript/no-floating-promises here, consider explicitly marking this as intentionally unhandled (e.g. prefix with void). This keeps the rule enabled while still documenting that reader.closed.finally(...) is fire-and-forget.

Copilot uses AI. Check for mistakes.
.oxlintrc.json Outdated
"typescript/prefer-optional-chain": ["error"],
"typescript/no-redundant-type-constituents": "off",
"typescript/restrict-template-expressions": "off",
"typescript/await-thenable": "off",
Copy link
Member

Choose a reason for hiding this comment

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

await on non-Promises is valid JS — it's a useful pattern for uniformly handling T | Promise<T> without branching. Not a bug.

FWIW the rule should account for this. At least the typescript-eslint one will allow awaiting a T | Promise<T>. I haven't checked the oxlint one.

https://typescript-eslint.io/play/#ts=5.9.2&fileType=.ts&code=CYUwxgNghgTiAEYD2A7AzgF3gNyhAriAFzyYwCWKA5vAD7wAKMSAtuWiADxmVUB8AKAFQ0ATxRh4AM3wSM5VPBZRKACgCU8AN4D48KAHcVWXARABueAHor8JAGsBAXyA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6AQwHd3K78ALRE3YAjJOiiJo0APbRI4MAF8QSoA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA&tokens=false

Copy link
Member Author

@logaretm logaretm Mar 9, 2026

Choose a reason for hiding this comment

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

@JoshuaKGoldberg I closed the PR by mistake with claude's help 🤦‍♂️

I disabled it since it has some false positives, but the production ones look genuine so I will fix them instead. thanks!

@logaretm logaretm closed this Mar 9, 2026
Most await-thenable violations are in tests or are false positives where
code intentionally handles T | Promise<T> uniformly. Keep as warn for
production source to catch genuinely unnecessary awaits.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@logaretm logaretm reopened this Mar 9, 2026
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Remove unnecessary await on serializeEnvelope (returns sync value).
Suppress remaining await-thenable in cron callbacks and server action
instrumentation where callbacks may be async at runtime despite types.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

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

Removed undefined from optional params | 19 | param?: T | undefined → param?: T — the ? already implies undefined

We explicitly added undefined in probably most of these cases because there's the exactOptionalPropertyTypes rule which some of our users have enabled. I'm wondering why oxlint is flagging these in the first place but would advocate to rather disable the respective rule. WDYT?

Comment on lines +108 to 109
// oxlint-disable-next-line typescript/prefer-optional-chain
if (message.id !== null && message.id !== undefined) {
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: we could simplify this further, right? Would this allow us to get rid of the optional chain disable rule?

Suggested change
// oxlint-disable-next-line typescript/prefer-optional-chain
if (message.id !== null && message.id !== undefined) {
// oxlint-disable-next-line typescript/prefer-optional-chain
if (message.id != null) {

Comment on lines +146 to 151
// oxlint-disable-next-line typescript/prefer-optional-chain
'config' in params &&
params.config &&
typeof params.config === 'object' &&
'systemInstruction' in params.config &&
params.config.systemInstruction
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.

l: hmm so on first glance it looks like we could indeed simplify this but I'm wondering if TS would complain because of how params is typed? Or could it be that prefer-optional-chain is buggy and doesn't know how to handle unknown?
EDIT: seeing how it flags other cases like #19612 (comment), I think this rule is a bit buggy, no?

* @internal
*/
public recordException(_exception: unknown, _time?: number | undefined): void {
public recordException(_exception: unknown, _time?: number): void {
Copy link
Member

Choose a reason for hiding this comment

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

h: see my other comment above regarding exactOptionalPropertyTypes. Unless I'm missing something (?)

Comment on lines -88 to -90
function info(...args: Parameters<typeof console.info>): void {
_maybeLog('info', ...args);
}
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?

Comment on lines +98 to 99
// oxlint-disable-next-line typescript/prefer-optional-chain
const isInternalException = hint.data && (hint.data as { __sentry__: boolean }).__sentry__ === true;
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore(lint): Rule adjustments and fix warnings

4 participants

X Tutup