Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
fix(eslint-plugin): honor ignored base types on generic classes#11767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
fix(eslint-plugin): honor ignored base types on generic classes#11767
Conversation
Thanks for the PR,@OleksandraKordonets! typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community. The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately. Thanks again! 🙏Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently onhttps://opencollective.com/typescript-eslint. |
netlifybot commentedNov 19, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
✅ Deploy Preview fortypescript-eslint ready!
To edit notification comments on pull requests, go to yourNetlify project configuration. |
nx-cloudbot commentedNov 19, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
View yourCI Pipeline Execution ↗ for commit52a4d74
☁️Nx Cloud last updated this comment at |
codecovbot commentedNov 19, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@## main #11767 +/- ##======================================= Coverage 90.49% 90.49% ======================================= Files 522 522 Lines 53357 53362 +5 Branches 8909 8914 +5 =======================================+ Hits 48284 48289 +5 Misses 5057 5057 Partials 16 16
Flags with carried forward coverage won't be shown.Click here to find out more.
🚀 New features to boost your workflow:
|
JoshuaKGoldberg left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM, thanks! ✨
I just left a couple of stylistic nitpicks in case you're interested. No worries at all if you prefer the code as-is, I just like refactoring as a form of reading the code. Totally up to you. 🙂
Uh oh!
There was an error while loading.Please reload this page.
| if(ignoredTypeNames.includes(typeName)){ | ||
| returntrue; | ||
| } | ||
| returngetBaseTypesForType(type).some(base=> | ||
| isIgnoredTypeOrBase(base,seen), | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
[Style] If you want to save a few lines 😄
| if(ignoredTypeNames.includes(typeName)){ | |
| returntrue; | |
| } | |
| returngetBaseTypesForType(type).some(base=> | |
| isIgnoredTypeOrBase(base,seen), | |
| ); | |
| return( | |
| ignoredTypeNames.includes(getTypeName(checker,type))|| | |
| getBaseTypesForType(type).some(base=>isIgnoredTypeOrBase(base,seen)) | |
| ); |
JoshuaKGoldberg commentedNov 24, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Btw, I wouldn't recommend sending PRs for issues that aren't yet marked as accepting prs. In this case it worked out because the issue was straightforward and accepted. But we've previously had to close PRs where the author put in a lot of work but the issue wasn't actually something that could be accepted. That feels bad for everyone. |
JoshuaKGoldberg left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thanks! 🙌
0db02ac intotypescript-eslint:mainUh oh!
There was an error while loading.Please reload this page.

Uh oh!
There was an error while loading.Please reload this page.
PR Checklist
Overview
This PR fixes a false positive in
@typescript-eslint/no-base-to-stringwhere.toString()calls on values typed as generic subclasses of ignored types, such asError, were being incorrectly reported. The rule previously only checked the type’s direct name, causing cases likeclass Boom<T> extends Error {}to be treated as unsafe, so this update adds recursive base-type checking with cycle protection to ensure that if a type or any of its ancestors matchignoredTypeNames, the call is allowed. A test is included to confirm.toString()is not reported for both direct and chained generic subclasses ofError, while preserving all existing rule behavior and configuration.