build(deps-dev): bump typescript-eslint from 8.58.1 to 8.60.0#2240
Merged
Conversation
Contributor
|
@dscho Can you take a look? The |
dscho
reviewed
May 27, 2026
Comment on lines
+134
to
+135
| const error = reason as Error; | ||
| reject(error); |
Member
There was a problem hiding this comment.
I interpreted the error as suggesting that the as Error is unnecessary, i.e. that reject(reason); should work?
Contributor
There was a problem hiding this comment.
It didn’t like that and it didn’t like typing on the catch either. The code compiled without the change so it is lint related.
dscho
added a commit
that referenced
this pull request
May 28, 2026
The typescript-eslint 8.60.0 bump in 766bdbd made `@typescript-eslint/prefer-promise-reject-errors` flag the two `reject(reason)` call sites in `git()`'s line handler: the `catch (reason)` clause and the `linePromise.catch((reason) => ...)` callback. In the former, modern TypeScript types the caught binding as `unknown`; in the latter, the Promise.catch callback parameter is inferred as `any`. Both fail the rule's default mode, which requires `reject` to receive a value statically typed `Error`. The fix-up commit 0d86e04 kept lint quiet by asserting `reason as Error`, hoisted in the `try/catch` arm into a `const error = reason as Error`. That tells the type checker something that need not be true at runtime. A thrown string or rejected `null` ends up presented to downstream consumers as `Error`, so any caller that relies on `.message` or `instanceof Error` will see incorrect type information without warning. typescript-eslint ships an officially supported escape hatch for this exact pattern. The `prefer-promise-reject-errors` rule accepts an `allowThrowingUnknown` option (https://typescript-eslint.io/rules/prefer-promise-reject-errors/), which was added in response to typescript-eslint/typescript-eslint#10375 and lets `reject(reason);` pass when `reason` is statically typed `unknown`. A related proposal for a stricter "allow only re-throw" variant for the same rule was declined in typescript-eslint/typescript-eslint#11095, though the equivalent `allowRethrowing` option did ship for `only-throw-error` via typescript-eslint/typescript-eslint#11075; neither would have helped here, since both still demand the caught value be statically `unknown` rather than `any`. Enabling `allowThrowingUnknown` in `eslint.config.mjs` therefore covers the `catch (reason)` arm directly. The `linePromise.catch` arm still needs the callback parameter to be annotated `(reason: unknown)` so that its inferred `any` widens to `unknown`; without that annotation, `allowThrowingUnknown` does not apply and the rule still fires. With both in place, the `as Error` casts disappear and `reject(reason);` carries the original rejection value through honestly. A pure-TypeScript alternative that needed no eslint config change was considered, namely `reject(reason instanceof Error ? reason : new Error(String(reason)));`. It is runtime-safe and lint-clean, but it silently wraps non-Error rejections in a synthetic Error built from the value's `toString()`, which loses more information than it preserves on a code path where the caught value is overwhelmingly already an Error. The rule-option route is preferred because it neither asserts a falsehood nor papers over one. Resolves the discussion at #2240 (comment). Assisted-by: Claude Opus 4.7 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
0d86e04 to
33ac9c9
Compare
Bumps [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint) from 8.58.1 to 8.60.0. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/typescript-eslint/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.60.0/packages/typescript-eslint) --- updated-dependencies: - dependency-name: typescript-eslint dependency-version: 8.60.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
The typescript-eslint 8.60.0 bump in 766bdbd made `@typescript-eslint/prefer-promise-reject-errors` flag the two `reject(reason)` call sites in `git()`'s line handler: the `catch (reason)` clause and the `linePromise.catch((reason) => ...)` callback. In the former, modern TypeScript types the caught binding as `unknown`; in the latter, the Promise.catch callback parameter is inferred as `any`. Both fail the rule's default mode, which requires `reject` to receive a value statically typed `Error`. The fix-up commit 0d86e04 kept lint quiet by asserting `reason as Error`, hoisted in the `try/catch` arm into a `const error = reason as Error`. That tells the type checker something that need not be true at runtime. A thrown string or rejected `null` ends up presented to downstream consumers as `Error`, so any caller that relies on `.message` or `instanceof Error` will see incorrect type information without warning. typescript-eslint ships an officially supported escape hatch for this exact pattern. The `prefer-promise-reject-errors` rule accepts an `allowThrowingUnknown` option (https://typescript-eslint.io/rules/prefer-promise-reject-errors/), which was added in response to typescript-eslint/typescript-eslint#10375 and lets `reject(reason);` pass when `reason` is statically typed `unknown`. A related proposal for a stricter "allow only re-throw" variant for the same rule was declined in typescript-eslint/typescript-eslint#11095, though the equivalent `allowRethrowing` option did ship for `only-throw-error` via typescript-eslint/typescript-eslint#11075; neither would have helped here, since both still demand the caught value be statically `unknown` rather than `any`. Enabling `allowThrowingUnknown` in `eslint.config.mjs` therefore covers the `catch (reason)` arm directly. The `linePromise.catch` arm still needs the callback parameter to be annotated `(reason: unknown)` so that its inferred `any` widens to `unknown`; without that annotation, `allowThrowingUnknown` does not apply and the rule still fires. With both in place, the `as Error` casts disappear and `reject(reason);` carries the original rejection value through honestly. A pure-TypeScript alternative that needed no eslint config change was considered, namely `reject(reason instanceof Error ? reason : new Error(String(reason)));`. It is runtime-safe and lint-clean, but it silently wraps non-Error rejections in a synthetic Error built from the value's `toString()`, which loses more information than it preserves on a code path where the caught value is overwhelmingly already an Error. The rule-option route is preferred because it neither asserts a falsehood nor papers over one. Resolves the discussion at #2240 (comment). Assisted-by: Claude Opus 4.7 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
There were some newly identified lint issues. Signed-off-by: Chris. Webster <chris@webstech.net> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
33ac9c9 to
805e2a2
Compare
Member
|
I think I've figured it out: 190e366 (Opus helped research this). |
dscho
approved these changes
May 28, 2026
github-actions Bot
pushed a commit
that referenced
this pull request
May 28, 2026
….58.1 to 8.60.0 (#2240), 2026-05-28))
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Bumps typescript-eslint from 8.58.1 to 8.60.0.
Release notes
Sourced from typescript-eslint's releases.
... (truncated)
Changelog
Sourced from typescript-eslint's changelog.
... (truncated)
Commits
f891c29chore(release): publish 8.60.0ca6ca14chore(release): publish 8.59.44b927c6fix(typescript-eslint): export Compatible* types from typescript-eslint to re...48e13c0chore(release): publish 8.59.344f9625chore(deps): update vitest monorepo to v4.1.5 (#12307)2ec35f1chore(release): publish 8.59.25245793chore(release): publish 8.59.1ea9ae4fchore(release): publish 8.59.090c2803chore(release): publish 8.58.2b3315fdchore: convert import eslint to import js - followup (#12100)Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebasewill rebase this PR@dependabot recreatewill recreate this PR, overwriting any edits that have been made to it@dependabot show <dependency name> ignore conditionswill show all of the ignore conditions of the specified dependency@dependabot ignore this major versionwill close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor versionwill close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependencywill close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)