Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged

Conversation

@OleksandraKordonets
Copy link
Contributor

@OleksandraKordonetsOleksandraKordonets commentedNov 19, 2025
edited by JoshuaKGoldberg
Loading

PR Checklist

Overview

This PR fixes a false positive in@typescript-eslint/no-base-to-string where.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.

@typescript-eslint
Copy link
Contributor

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.

@netlify
Copy link

netlifybot commentedNov 19, 2025
edited
Loading

Deploy Preview fortypescript-eslint ready!

NameLink
🔨 Latest commit52a4d74
🔍 Latest deploy loghttps://app.netlify.com/projects/typescript-eslint/deploys/69252c5ee7513a000898dafe
😎 Deploy Previewhttps://deploy-preview-11767--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 94 (🔴 down 4 from production)
Accessibility: 97 (no change from production)
Best Practices: 100 (no change from production)
SEO: 92 (no change from production)
PWA: 80 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to yourNetlify project configuration.

@nx-cloud
Copy link

nx-cloudbot commentedNov 19, 2025
edited
Loading

View yourCI Pipeline Execution ↗ for commit52a4d74

CommandStatusDurationResult
nx test eslint-plugin --coverage=false✅ Succeeded5m 9sView ↗
nx run-many -t lint✅ Succeeded3m 15sView ↗
nx run-many -t typecheck✅ Succeeded2m 2sView ↗
nx test typescript-estree --coverage=false✅ Succeeded2sView ↗
nx test eslint-plugin-internal --coverage=false✅ Succeeded4sView ↗
nx run integration-tests:test✅ Succeeded5sView ↗
nx run types:build✅ Succeeded2sView ↗
nx run generate-configs✅ Succeeded6sView ↗
Additional runs (29)✅ Succeeded...View ↗

☁️Nx Cloud last updated this comment at2025-11-25 04:22:22 UTC

@codecov
Copy link

codecovbot commentedNov 19, 2025
edited
Loading

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.49%. Comparing base (d26e9de) to head (52a4d74).
⚠️ Report is 8 commits behind head on main.

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
FlagCoverage Δ
unittest90.49% <100.00%> (+<0.01%)⬆️

Flags with carried forward coverage won't be shown.Click here to find out more.

Files with missing linesCoverage Δ
...kages/eslint-plugin/src/rules/no-base-to-string.ts99.07% <100.00%> (+0.01%)⬆️
🚀 New features to boost your workflow:
  • ❄️Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

JoshuaKGoldberg
JoshuaKGoldberg previously approved these changesNov 24, 2025
Copy link
Member

@JoshuaKGoldbergJoshuaKGoldberg left a 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. 🙂

Comment on lines 258 to 264
if(ignoredTypeNames.includes(typeName)){
returntrue;
}

returngetBaseTypesForType(type).some(base=>
isIgnoredTypeOrBase(base,seen),
);

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 😄

Suggested change
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
Copy link
Member

JoshuaKGoldberg commentedNov 24, 2025
edited
Loading

That issue was marked asaccepting prs

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.

https://typescript-eslint.io/docs/contributing

OleksandraKordonets reacted with thumbs up emoji

@JoshuaKGoldbergJoshuaKGoldberg added the 1 approval>=1 team member has approved this PR; we're now leaving it open for more reviews before we merge labelNov 24, 2025
Copy link
Member

@JoshuaKGoldbergJoshuaKGoldberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thanks! 🙌

@JoshuaKGoldbergJoshuaKGoldberg merged commit0db02ac intotypescript-eslint:mainNov 28, 2025
66 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@JoshuaKGoldbergJoshuaKGoldbergJoshuaKGoldberg approved these changes

Assignees

No one assigned

Labels

1 approval>=1 team member has approved this PR; we're now leaving it open for more reviews before we merge

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Bug: [no-base-in-string] generic classes don't check for ignored superclasses

2 participants

@OleksandraKordonets@JoshuaKGoldberg

[8]ページ先頭

©2009-2025 Movatter.jp