Skip to content

Lint: dropped background tasks, async mistakes, and unhandled promises in the viewer - #3

Merged
ryangswe merged 1 commit into
mainfrom
chore/type-aware-lint
Nov 6, 2026
Merged

ryangswe merged 1 commit into
mainfrom
chore/type-aware-lint

Conversation

@ryangswe

@ryangswe ryangswe commented Nov 6, 2026

Copy link
Copy Markdown
Owner

Adds lint rules that find bugs, not style. None of them finds anything on main today; they are there to stop the next one.

Python (ruff, pyproject.toml). select gains three groups:

  • PLE, code that fails at run time;
  • ASYNC, blocking calls and other mistakes in async code;
  • RUF006, an asyncio task whose result is dropped, so it can be garbage-collected mid-run.

Four ASYNC rules that give advice rather than find bugs are left out (ASYNC109, ASYNC110, ASYNC115, ASYNC116). For example, ASYNC109 flags any timeout parameter on an async function.

Viewer (oxlint, web/.oxlintrc.json). Four type-aware rules run as errors. They flag a promise nobody waits for or catches, an async function passed where a plain callback is expected, an await on something that is not a promise, and a switch that misses a case of a union. Type-aware rules need oxlint-tsgolint, which is pinned at 7.0.2006 in web/. --type-aware is added to the lint script, the CI step and CLAUDE.md. oxlint is used because typescript-eslint supports TypeScript only up to 6.0, and the viewer is on 7.0.

The two existing react warnings in src/App.tsx are unchanged and don't fail the job.

How it was checked

  • uvx ruff@0.17.4 check src tests passes, as does ruff 0.17.3, the version in uv.lock. uv lock --check passes, and so does .claude/workflow/check.py.
  • npx oxlint --type-aware src exits 0, tsc -b passes, and the viewer builds.
  • Planted breaks were each caught. On the viewer side, a floating promise in src/App.tsx and a missed Mode case in a switch. On the Python side, a dropped asyncio.create_task (RUF006), a blocking call in async code (ASYNC251) and an undefined name.
  • On this PR, a planted break in each language turned CI red before it was removed (see the checks history).
  • Two independent reviewers checked the change. The open week1-two-rooms-protocol branch doesn't touch these files.

…s in the viewer

ruff now also selects PLE (errors that crash at run time), ASYNC (blocking calls and other
mistakes in async code) and RUF006 (an asyncio task whose result is dropped, so it can be
garbage-collected mid-run). Four ASYNC rules that give advice rather than find bugs are left out
(ASYNC109, ASYNC110, ASYNC115, ASYNC116). The viewer's oxlint runs four type-aware rules as
errors: no-floating-promises, no-misused-promises, await-thenable and
switch-exhaustiveness-check (a default case counts as handling the rest). oxlint-tsgolint, which
runs them, is pinned in web/.

None of the new rules finds anything on main today.
@ryangswe
ryangswe force-pushed the chore/type-aware-lint branch from 50132c1 to 3f1e51f Compare November 6, 2026 04:44
@ryangswe
ryangswe marked this pull request as ready for review November 6, 2026 04:45
@ryangswe
ryangswe merged commit 36434b7 into main Nov 6, 2026
4 checks passed
@ryangswe
ryangswe deleted the chore/type-aware-lint branch November 6, 2026 07:53
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.

1 participant