Repository navigation
fix(cli): Require return await for returned promises - #1556
Merged
Merged
Conversation
Enable type-aware Oxlint (oxlint-tsgolint) and turn on
typescript/return-await ("always") for packages/cli/src so returning an
un-awaited promise from an async function fails lint. Returning without
await drops the caller's frame from async stack traces.
Fix the 89 existing hits. In sentry-client executeAttempt, move
handleResponse out of the try block so awaiting it does not route
response-handling errors through handleFetchError.
Type-aware correctness rules with an existing backlog are turned off at
the root for now. Drop baseUrl from two tsconfigs (unsupported by tsgo;
paths already resolve relative to the config) and ignore the SvelteKit
init-eval template, whose tsconfig extends a generated file.
Fixes #1552
Co-authored-by: byk <burak.kaya@sentry.io>
Co-Authored-By: Claude <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
BYK
approved these changes
Oct 20, 2026
Move typescript/return-await ("always") from the CLI override to the
root config (and apps/local's own config) and fix the ~100 remaining
hits across MCP packages, apps/local and scripts.
In mcp-cloudflare's /oauth/register guard, build the rejection response
outside the try so a finalizeResponse failure is not swallowed by the
malformed-body catch.
Replace the dashboard `.catch(async (error) => enrichDashboardError(...))`
call sites with a withDashboardErrors(ctx, fn) helper, drop the config
assertion test, and document the void/await choices inline.
Refs #1552, #1573
Co-authored-by: byk <burak.kaya@sentry.io>
Co-Authored-By: Claude <noreply@anthropic.com>
Add a repo-wide ast-grep rule, no-async-catch-callback, so the `.catch(async (error) => ...)` pattern replaced by withDashboardErrors can't come back, and note it in the coding guidelines. Co-authored-by: byk <burak.kaya@sentry.io> Co-Authored-By: Claude <noreply@anthropic.com>
BYK
approved these changes
Oct 21, 2026
BYK
enabled auto-merge (squash)
October 21, 2026 14:22
sentry-junior Bot
added a commit
that referenced
this pull request
Oct 21, 2026
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>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1552.
When an async function returns a promise without awaiting it, the caller's frame drops out of async stack traces. This PR turns on type-aware Oxlint through
oxlint-tsgolint, usingoptions.typeAwarein.oxlintrc.json. That coverspnpm run lint, CI, lint-staged and the editor. It also enablestypescript/return-awaitwith thealwaysoption forpackages/cli/src/**. All 89 existing hits are fixed. None needed a suppression.Things to look at:
sentry-client.tsexecuteAttempt: inside atry,return awaitis not just cosmetic: rejections then hit the localcatch. Here that would have routedhandleResponseerrors (such asMalformedAuthTokenError) throughhandleFetchError, andsentry-client.auth.test.tscaught it. SohandleResponsenow runs after thetry, which keeps the old behavior. The only other hit inside atryis inlocal/daemon.ts, in thecatch. There, an ENOENT from the retriedtryClaim()now gets one more claim attempt instead of propagating directly, which is harmless.await-thenable(275 hits),no-base-to-string,no-floating-promises,unbound-method,restrict-template-expressions, and a few smaller ones. They're set tooffat the root, so lint behaves exactly as before apart from the new rule. We can turn them back on one at a time later.baseUrlis removed fromapps/local/tsconfig.app.jsonandpackages/mcp-cloudflare/tsconfig.client.json. tsgo rejects it, andpathsalready resolve relative to the config file. The SvelteKit init-eval template is ignored because its tsconfig extends a generated.svelte-kit/tsconfig.json.apps/localalso gets twovoid navigate(...)calls, because its nested config started showingno-floating-promiseswarnings.Gap:
return-awaitonly checksasyncfunctions. A non-async wrapper like the originalfetchAccountOrgs(function f(): Promise<T> { return withStoredAccount(...) }) still passes. To catch that we'd needtypescript/promise-function-async, which has about 265 hits in the CLI and makes sync throws reject. That seemed better as a separate change.via byk.
--
View Junior Session in Sentry