You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
chore(lint): hold Promise.reject to the never-throw rule and narrow the inputs exemption - #547
before: lint/never-throw.grit matches `throw $arg` biome.json exempts all of src/cli/inputs.ts
registry.ts: Promise.reject(error) with no BUG: prefix (two sites the rule never saw)
after: the rule matches throw and Promise.reject (untyped, typed, bare) src/** under the rule; one biome-ignore on
registry.ts: Promise.reject(new Error(`BUG: ...`)) at each site commander's InvalidArgumentError throw
$ bun test test/lint/never-throw.test.ts test/sections/registry.test.ts
39 pass
0 fail
How
A rejection is a throw by another spelling. The GritQL or binds either form to one site and applies the same BUG-literal-or-catch-binding rule.
The Error is built where it is rejected, so the rule sees the BUG: prefix in source text; the foreign-context helper now returns the message.
The exemption shrinks to one line.biome check . is clean on the whole tree with inputs.ts under the rule.
The plugin test proves both halves: six rejection spellings outside the rule are flagged, two inside are not, and the real inputs.ts lints clean until its one suppression line is removed.
Proof
Tests: plugin and registry suites pass at 39; before the registry edit the extended rule flagged both rejection sites.
For example, return Promise.reject<void>(new Error("x")); and return Promise.reject<void>(); produce no diagnostic because the typed call has a TsInstantiationExpression; this repository's lint/rule-gate.grit:8-11 already needs separate typed and untyped call patterns for the same reason. Add typed one-argument and zero-argument alternatives, and cover both in the fixture.
Vivswan
changed the title
lint: hold Promise.reject to the never-throw rule and narrow the inputs exemption
chore(lint): hold Promise.reject to the never-throw rule and narrow the inputs exemption
Oct 11, 2026
…he inputs exemption
The plugin matched throw statements alone, so a rejection built without the BUG: prefix passed. The rule now reads Promise.reject beside throw, in the untyped, typed, and zero-argument forms, and the registry's two foreign-context rejections build their Error at the site with the prefix. The whole-file exemption for src/cli/inputs.ts shrinks to one suppression on commander's InvalidArgumentError throw, and the plugin test proves the suppression is live and flags every new rejection form.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
How
orbinds either form to one site and applies the same BUG-literal-or-catch-binding rule.BUG:prefix in source text; the foreign-context helper now returns the message.biome check .is clean on the whole tree with inputs.ts under the rule.Proof
biome check ., typecheck, and knip green.