Add oxlint rule to catch thrown un-awaited redirect helpers#4222
Conversation
Adds a custom oxlint JS plugin (trigger/no-thrown-unawaited-redirect) that flags `throw <asyncRedirectHelper>(...)` on ThrowStatement. These helpers return a Promise, so throwing them un-awaited throws a pending Promise and Remix renders the error boundary instead of redirecting. The rule provides an autofix that inserts `await`. Plain synchronous `throw redirect(...)` is not flagged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EZ8nrziWFcXhqGewJgo4ei
|
Change `throw redirectWithErrorMessage(...)` to `throw await redirectWithErrorMessage(...)` at the 9 sites flagged by the new trigger/no-thrown-unawaited-redirect oxlint rule so the redirect Response is thrown instead of a pending Promise. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EZ8nrziWFcXhqGewJgo4ei
Wrap the redirect throw in vercel.onboarding.tsx that exceeded the 100-char print width after the await insertion, so oxfmt --check passes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EZ8nrziWFcXhqGewJgo4ei
|
Preview Deployment
|
|
Tested commit
Repository gates and local environment caveat
Devin session: https://app.devin.ai/sessions/e60ad7610773401da3d3040cf1252337 |
✅ Checklist
Testing
async redirect helpers while ignoring awaited throws, returned promises, and
synchronous
redirect(...).--fixinsertsawaitin async functions and produces a cleansecond lint run.
introduce invalid syntax.
pnpm run format,pnpm run lint,pnpm run typecheck --filter webapp, andgit diff --check.Changelog
Adds an Oxlint rule that prevents async redirect helpers from being thrown
without awaiting their
Response. Existing violations are fixed, the autofixis limited to async functions, and the plugin uses an explicit ESM extension.
Screenshots
See the test-results comment for CLI evidence.
💯
Link to Devin session: https://app.devin.ai/sessions/e60ad7610773401da3d3040cf1252337
Requested by: @ericallam