-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix(eslint-plugin): [restrict-template-expressions] check base types in allow list #11764
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix(eslint-plugin): [restrict-template-expressions] check base types in allow list #11764
Conversation
Allow derived types in template expressions when base types are in allow list Fixes typescript-eslint#11759
|
Thanks for the PR, @Higangssh! 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 on https://opencollective.com/typescript-eslint. |
✅ Deploy Preview for typescript-eslint ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
View your CI Pipeline Execution ↗ for commit 8eaddd5
☁️ Nx Cloud last updated this comment at |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #11764 +/- ##
==========================================
- Coverage 90.56% 90.56% -0.01%
==========================================
Files 522 522
Lines 53063 53084 +21
Branches 8838 8844 +6
==========================================
+ Hits 48058 48076 +18
- Misses 4990 4993 +3
Partials 15 15
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|

Fixes #11759
PR Checklist
3Aopen+is%3Aissue+label%3A%22accepting+prs%22)
Overview
This PR fixes an issue where the
restrict-template-expressionsrule incorrectly rejects derived class instancesin template literals when their base class is in the allow list.
Problem
Currently, when a base class is included in the
allowoption, derived classes extending it are still flagged aserrors, violating the Liskov Substitution Principle where subtypes should be substitutable for their supertypes.
Example:
Solution
Implemented recursive base type checking following the pattern established in the no-base-to-string rule:
Changes
scenario