Skip to content

chore(lint): Enable type-aware Oxlint rules disabled in #1556 - #1578

Merged
BYK merged 3 commits into
mainfrom
byk/enable-type-aware-lint-rules
Oct 22, 2026
Merged

BYK merged 3 commits into
mainfrom
byk/enable-type-aware-lint-rules

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Turns back on the nine type-aware rules #1556 switched off (await-thenable, no-base-to-string, no-duplicate-type-constituents, no-floating-promises, no-misused-spread, no-redundant-type-constituents, require-array-sort-compare, restrict-template-expressions, unbound-method) and fixes the ~640 violations they reported.

Most fixes are mechanical. These ones are worth a look:

  • Real bugs found by the rules: some async property tests and LoggingUI rejection assertions were never awaited, so they could pass without running. Smoke-test headers object-spread HeadersInit, which silently drops entries from a Headers instance; they now go through Headers. Fetch wrappers called String(input) on Request | URL | string, which gives [object Request] for requests; a new CLI fetchInputUrl() helper reads the URL properly.
  • Stringifying unknowns: places that interpolated or String()'d unknown values now use the CLI's stringifyUnknown() or MCP's formatUnknown(), so objects show up as JSON instead of [object Object]. formatUnknown moved to mcp-core/src/internal/unknown-formatting.ts so internal formatters don't import from tools/ (it's still re-exported from api-formatting). Spotlight envelope IDs are UUID objects with their own toString(), so they get a small spotlightEnvelopeId() helper.
  • Types: TraceSpanSchema now uses Zod 4's getter-based recursion instead of z.lazy(...) as z.ZodType<any>. That any was hiding redundant union members.
  • Dead code: removed the unused getSentryConfig.partial from the Cloudflare Sentry config. It was the only no-misused-spread hit that needed real changes.

Config tweaks instead of blanket disables:

  • no-floating-promises uses allowForKnownSafeCalls for node:test's test/it/describe/suite.
  • restrict-template-expressions allows never (exhaustive-switch error messages).
  • unbound-method is off only in test files, where mock and identity assertions like expect(obj.method) trip it all the time.

Fixes #1573

via BYK.

--

View Junior Session in Sentry

Turn the nine type-aware rules back on and fix the violations they
report: drop awaits on non-thenables, mark intentional fire-and-forget
promises with void, await forgotten assertions, give sorts explicit
comparators, stop stringifying unknown values to "[object Object]", and
remove redundant type constituents.

no-floating-promises allows node:test's test/describe helpers,
restrict-template-expressions allows never, and unbound-method stays off
in tests, where mock and identity assertions trip it.

Fixes #1573

Co-Authored-By: BYK <burak.kaya@sentry.io>
@vercel

vercel Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Oct 22, 2026 12:37pm UTC

Request Review

Comment thread packages/cli/src/commands/alert/issues/rule-resolve.ts Outdated
Comment thread packages/cli/src/commands/alert/metrics/rule-resolve.ts Outdated
Comment thread packages/cli/src/lib/api/projects.ts Outdated
Comment thread packages/cli/src/lib/formatters/human.ts
} catch (err) {
log.debug("Failed to JSON-encode attribute value", err);
return sanitize(String(value));
return sanitize(Object.prototype.toString.call(value));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why? What?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That was a clumsy fix, sorry. The catch branch only runs when JSON.stringify throws (circular refs, BigInt). The old String(value) there tripped no-base-to-string, and swapping in Object.prototype.toString.call() just produced the same [object Object] in a roundabout way. stringifyUnknown() already does exactly this try-JSON-then-fall-back dance, so formatAttrValue() now just does sanitize(stringifyUnknown(value)) after the null check. Fixed in b75e6a1.

Comment thread packages/cli/test/helpers.ts Outdated
Comment thread packages/mcp-core/src/tools/catalog/update-issue.ts
Comment thread packages/mcp-core/src/tools/surfaces.ts
Comment thread packages/mcp-core/src/server.test.ts
Comment thread packages/mcp-server-evals/src/evals/utils/structuredOutputScorer.ts
- Count slashes with a non-allocating countChar() helper
- Keep RegExp.escape unbound; it is static and never reads `this`
- Let formatAttrValue() defer to stringifyUnknown()
- Rename fetchInputUrl() to extractInputUrl()
- Restore IssueStatusDisplay using `string & {}`
- Allow URL/URLSearchParams in template literals instead of
  sprinkling .href/.toString()
- Narrow replay payload entries with a type guard instead of String()
Per review: keep String() in stringifyUnknown's JSON failure fallback so
custom toString() output survives, and keep the `unknown | Handler`
unions in the test mock types for documentation. Both use targeted
lint disables with reasons.
@BYK
BYK merged commit 8bb1c66 into main Oct 22, 2026
56 of 59 checks passed
@BYK
BYK deleted the byk/enable-type-aware-lint-rules branch October 22, 2026 12:57

This branch was successfully deployed

1 active and 1 inactive deployments
Actions — 0394a377 Deployed Oct 22, 2026 by sentry-junior[bot] via eval #1355
Preview — 0394a377 Deployed Oct 22, 2026 by vercel[bot]
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.

Enable type-aware Oxlint rules turned off in #1556

1 participant