unthrown
unthrown copied to clipboard
oxlint no-catch-all-pattern: allow P._ when E is a single non-union type
Found while auditing btravstack/start (2026-08-13).
@unthrown/oxlint's no-catch-all-pattern documentation already names the legitimate P._ cases: a helper generic in E, or an E that is a single non-union type with nothing to enumerate. But the rule flags those cases anyway, so idiomatic code carries a disable comment.
Concrete cost, measured in btravstack/start: the env-validation fold
// oxlint-disable-next-line unthrown/no-catch-all-pattern -- `E` is the issues array: one type with no discriminant, so there is nothing to enumerate and the single arm IS the enumeration
errCases: (matcher) => matcher.with(P._, (issues) => abort(describeEnvIssues(issues))),
is copy-pasted verbatim into four entry points (E = a standard-schema issues array — one non-union type). When the idiomatic path requires a suppression, the suppression stops carrying information.
Acceptance
- The rule does not flag
P._when the matchedEis provably a single non-union type (and, if feasible, the unresolved-generic-Ecase). - Sites that currently carry the disable for exactly that reason can drop it (an unused disable is already a warning, so the cleanup is self-indicating).