Skip to content

feat: enable type-aware no-floating-promises rule, fix all 177 violations#22741

Merged
kitlangton merged 1 commit into
devfrom
kit/oxlint-floating-promises
Apr 16, 2026
Merged

feat: enable type-aware no-floating-promises rule, fix all 177 violations#22741
kitlangton merged 1 commit into
devfrom
kit/oxlint-floating-promises

Conversation

@kitlangton
Copy link
Copy Markdown
Contributor

Summary

  • Add oxlint-tsgolint for type-aware linting (uses TypeScript's Go compiler port for full type info)
  • Enable no-floating-promises rule — catches unhandled promise rejections
  • Fix all 177 violations across 103 files

Why this matters

no-floating-promises is the single highest-value type-aware lint rule. It catches:

  • Promises that are never awaited, returned, or voided
  • Silent failures where a rejected promise is dropped without error handling
  • Common in async callbacks, event handlers, and fire-and-forget patterns

What was fixed

All 177 hits were intentional fire-and-forget patterns that just needed void to signal intent:

Pattern Count Example
Bus.publish(...) / event publishing ~20 void Bus.publish(Event.Updated, {...})
TUI/UI async callbacks ~30 void sdk.client.session.create(...)
Test cleanup/setup ~42 void Log.init(...), void server.stop()
navigator.clipboard ~3 void navigator.clipboard.writeText(...)
mock.module(...) in tests ~15 void mock.module(...)
Misc async in sync contexts ~67 Various fire-and-forget calls

No code was restructured — only void was added to make the intent explicit.

Performance

Type-aware linting adds ~7s to the lint run (vs ~140ms syntax-only) since it needs to build the type graph. This is still much faster than ESLint + typescript-eslint would be (~30-60s on a codebase this size).

…ions

Add oxlint-tsgolint for type-aware linting and enable the
no-floating-promises rule. Fix all 177 unhandled promise warnings
by adding `void` to intentional fire-and-forget calls (Bus.publish,
clipboard, cleanup, async callbacks in sync contexts).

This rule prevents silently dropped promise rejections — the #1
async bug pattern in TypeScript codebases.
@kitlangton kitlangton force-pushed the kit/oxlint-floating-promises branch from c7c7ced to 3e427bb Compare April 16, 2026 03:20
@kitlangton kitlangton disabled auto-merge April 16, 2026 03:27
@kitlangton kitlangton merged commit 80f1f1b into dev Apr 16, 2026
11 checks passed
@kitlangton kitlangton deleted the kit/oxlint-floating-promises branch April 16, 2026 03:27
jerome-benoit pushed a commit to jerome-benoit/opencode that referenced this pull request Apr 16, 2026
xywsxp pushed a commit to xywsxp/opencode that referenced this pull request Apr 24, 2026
dgokeeffe pushed a commit to dgokeeffe/opencode-databricks that referenced this pull request May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant