Skip to content

Add oxlint rule to catch thrown un-awaited redirect helpers#4222

Merged
0ski merged 4 commits into
mainfrom
claude/oxlint-no-thrown-unawaited-redirect
Jul 10, 2026
Merged

Add oxlint rule to catch thrown un-awaited redirect helpers#4222
0ski merged 4 commits into
mainfrom
claude/oxlint-no-thrown-unawaited-redirect

Conversation

@claude

@claude claude Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

✅ Checklist

  • I have followed every step in the contributing guide
  • The PR title follows the convention.
  • I ran and tested the code works

Testing

  • Verified the rule emits exactly five errors for un-awaited throws of the known
    async redirect helpers while ignoring awaited throws, returned promises, and
    synchronous redirect(...).
  • Verified --fix inserts await in async functions and produces a clean
    second lint run.
  • Verified synchronous functions remain diagnostic-only so autofix cannot
    introduce invalid syntax.
  • Ran pnpm run format, pnpm run lint,
    pnpm run typecheck --filter webapp, and git diff --check.

Changelog

Adds an Oxlint rule that prevents async redirect helpers from being thrown
without awaiting their Response. Existing violations are fixed, the autofix
is 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

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
@changeset-bot

changeset-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: c3ebd91

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

claude added 2 commits July 10, 2026 10:03
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
devin-ai-integration[bot]

This comment was marked as resolved.

@trigger-dot-bot

trigger-dot-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown

Preview Deployment

Status Preview Commit Updated
⚪ Removed c3ebd91 Jul 10, 11:24 UTC

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Tested commit c3ebd91b6 through the real repo Oxlint CLI.

  • Passed: exactly five targeted errors for the five async redirect helpers.
  • Passed: awaited throws, returned promises, and synchronous redirects were ignored.
  • Passed: autofix added await in async functions and produced a clean re-lint.
  • Passed: synchronous functions remained diagnostic-only; autofix did not create invalid syntax.
  • Passed: .mjs loading removed the Node module-type warning.
  • Passed: format, lint, webapp typecheck, and diff-check exited 0.

Oxlint detection evidence

Autofix and safety evidence

Autofix and synchronous-context evidence

Repository gates and local environment caveat

Format, lint, typecheck, and diff-check evidence

pnpm run format also touched six files in the locally populated OTLP proto
submodule. I reversed that exact side-effect and verified both working trees
were clean; it is outside this PR's diff.

Devin session: https://app.devin.ai/sessions/e60ad7610773401da3d3040cf1252337

@devin-ai-integration devin-ai-integration Bot marked this pull request as ready for review July 10, 2026 10:33
@0ski 0ski merged commit de53662 into main Jul 10, 2026
31 checks passed
@0ski 0ski deleted the claude/oxlint-no-thrown-unawaited-redirect branch July 10, 2026 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants