Skip to content

Guardrails TB1: one type-aware lint rule through agent hook, editor, pre-commit and CI with a shrink-only baseline #4297

Closed

Description

@DoodleBears

Part of #4296. The smallest slice that proves the whole lint pipeline end to end, before adding rules in bulk.

Behaviour

An agent (or a person) who writes void-less, un-awaited promise code in packages/**/src sees the error at edit time, again at commit, and CI fails the same way, while the existing occurrences are tolerated by a baseline that can only shrink.

Scope

  • Add oxlint-tsgolint and enable typescript/no-floating-promises in .oxlintrc.json (oxlint --type-aware).
  • scripts/lint-ratchet.mjs: runs oxlint with JSON output, compares counts per file × rule with scripts/lint-baseline.json. Fails on any new finding; fails when a baselined count dropped but the baseline was not lowered (--update lowers it, never raises). Each error prints the rule, the guardrail id, the doc anchor and the fix (await, void, or .catch with a Developer diagnostics log).
  • scripts/guardrails.json: registry with this first entry (id, source, layer, check, baseline). pnpm lint validates the registry.
  • pnpm lint calls the ratchet instead of bare oxlint; pnpm lint:fix keeps oxlint --fix.
  • .lintstagedrc.json: staged *.{ts,tsx,mjs} → ratchet in staged-file mode.
  • .claude/settings.json PostToolUse hook (Edit/Write/MultiEdit): ratchet on the touched file; findings go back to the agent. .vscode/extensions.json recommends the oxc extension with type-aware on.
  • scripts/ci-plan.mjs RULES updated for the new files.

Done when

  • A test fixture with a floating promise fails the ratchet with the fix message; the same file with await passes.
  • A baseline entry that went down without --update fails with "lower the baseline".
  • Measured: type-aware lint time for the full repo and for one file (hook budget ≤ 2 s per file), reported in the PR.

Activity

  1. DoodleBears commented on Nov 16, 2026

    @DoodleBears
    ContributorAuthor

    Agent work outcome


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions