unthrown icon indicating copy to clipboard operation
unthrown copied to clipboard

@unthrown/oxlint 5.4.0 removes no-throw and prefer-ensure in a minor, hard-failing downstream configs

Open btravers opened this issue 3 months ago • 1 comments

Summary

@unthrown/oxlint 5.4.0 removes the no-throw and prefer-ensure rules. Because oxlint fails to parse a config that names an unknown rule, this is not a silent deprecation — every downstream project that enabled either rule has its entire lint run break on a patch-level-looking upgrade:

x Rule 'no-throw' not found in plugin 'unthrown'
x Rule 'prefer-ensure' not found in plugin 'unthrown'

Note this kills the whole oxlint invocation, including every non-unthrown rule — so the blast radius is the project's entire lint suite, not just its unthrown rules.

Which release

Rule lists taken from each version's published README:

Version Rules
5.1.0 no-ambiguous-error-type, no-catch-all-pattern, no-throw, no-unhandled-result, no-unused-matcher, prefer-async-result, prefer-ensure
5.2.0 above + no-get-or-throw
5.3.0 same as 5.2.0
5.4.0 no-ambiguous-error-type, no-catch-all-pattern, no-get-or-throw, no-unhandled-result, no-unused-matcher, prefer-async-result

So both removals landed in 5.4.0, in a minor.

Why no-throw specifically is hard to lose

no-get-or-throw (added 5.2.0) is not a substitute. It matches zero-argument .getOrThrow() member calls; no-throw banned throw statements outright. A codebase that has adopted errors-as-values end to end wants the latter — the whole point is that throw is reserved for genuine defects, and a lint rule is what keeps that from eroding.

Concretely, in btravstack/temporal-contract: 93 oxlint-disable-next-line unthrown/no-throw comments across packages/*/src. Each documents why one specific throw is sanctioned — a terminal ApplicationFailure Temporal must observe, or a deliberate rethrow that routes a cause onto the defect channel. That rule was the mechanical backstop for a project rule stated in the repo's own agent instructions ("Activities and the typed client return AsyncResult — never throw"). After 5.4.0 that rule is convention-only, and the 93 annotations point at a rule that no longer exists.

Ask

Any one of these would resolve it:

  1. Keep no-throw (optionally opt-in / outside recommended, like no-get-or-throw) — a project that bans throw outright has no other way to enforce it.
  2. If the removal is intentional, make it a major, and say so in the release notes with a migration line: what replaces no-throw for codebases that ban throw outright, and what to do with existing disable comments.
  3. At minimum, deprecate before removing — keep the rule name resolving (as a no-op or an alias) for one minor so downstream configs degrade to a warning instead of a hard parse failure.

Happy to send a PR for whichever direction you prefer.

Context

Found while upgrading unthrown 5.1.0 → 5.4.0. The core library diff over those three minors is one added symbol (fromExecutor) and no removals — so the lint plugin is where the breaking change lives, and it isn't signalled by the version.

btravers avatar Aug 12 '26 16:08 btravers

You're right, and thanks for the detail — the 93 disable comments made the cost concrete.

The removal's stated migration path does not exist. oxlint ships no no-restricted-syntax:

$ oxlint -c .oxlintrc.json .     # {"rules":{"no-restricted-syntax":[{"selector":"ThrowStatement",...}]}}
Failed to parse oxlint configuration file.
  x Rule 'no-restricted-syntax' not found in plugin 'eslint'

So "it's a no-restricted-syntax entry rather than a rule" was true in the abstract and false for this linter — a codebase that bans throw outright had nothing left. Combined with the hard config parse failure you describe, that is a bad trade for the ~20 lines the rule costs.

#228 restores no-throw, unchanged and still opt-in. Nothing to do to adopt: a config naming "unthrown/no-throw" resolves again, and your existing oxlint-disable-next-line unthrown/no-throw comments point at a rule that exists once more. A regression test now pins both that it ships and that it stays out of recommended, and the reason is recorded in the package spec so it doesn't get audited away a second time.

prefer-ensure stays removed — it flagged correct code that violates no thesis (a report-only refactor suggestion with a known false positive), and your report doesn't argue for it. If you had it enabled, drop the entry.

On the versioning ask: agreed in principle that a rule removal is major-shaped. This one shipped as a minor with a "Breaking, released as a minor" changelog lead, which is not enough when the failure mode is a hard parse error rather than a lost check. The restore ships as a minor.

btravers avatar Aug 12 '26 17:08 btravers