Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
feat(eslint-plugin): [no-useless-default-assignment] add rule#11720
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
base:main
Are you sure you want to change the base?
Conversation
Thanks for the PR,@ulrichstark! 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 commentedOct 25, 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 commentedOct 25, 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 commit7d7a636
☁️Nx Cloud last updated this comment at |
codecovbot commentedOct 25, 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❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@## main #11720 +/- ##==========================================+ Coverage 90.66% 90.68% +0.01%========================================== Files 518 519 +1 Lines 52435 52643 +208 Branches 8686 8732 +46 ==========================================+ Hits 47541 47740 +199- Misses 4880 4889 +9 Partials 14 14
Flags with carried forward coverage won't be shown.Click here to find out more.
🚀 New features to boost your workflow:
|
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.
A great start, I love how readable this implementation is! 👏 nicely done.
Requesting changes mostly on getting test coverage up and covering edge cases. I suspect you'll have to tweak the implementation a little to deal with tuples. Cheers!
packages/eslint-plugin/docs/rules/no-useless-default-assignment.mdx OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
| default: | ||
| returnnull; | ||
| } | ||
| } |
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.
[Non-Actionable] I'm surprised a utility doesn't already exist for this - but I couldn't find one.
getStaticValue: doesn't handle identifiersgetStringIfConstant: doesn't handle identifiers (it's a small wrapper aroundgetStaticStringValue)getStaticStringValue: didn't handle identifiers properly
Not requesting changes, just noting - maybe I missed one?
packages/eslint-plugin/tests/rules/no-useless-default-assignment.test.ts OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
packages/eslint-plugin/docs/rules/no-useless-default-assignment.mdx OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
packages/eslint-plugin/docs/rules/no-useless-default-assignment.mdx OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
…t.mdxCo-authored-by: Josh Goldberg ✨ <git@joshuakgoldberg.com>
…t.mdxCo-authored-by: Josh Goldberg ✨ <git@joshuakgoldberg.com>
Thanks Josh for your review! I already made all low effort changes. Do you also want me to turn the suggestion into a fix? I think it's safe in every case the project is properly typed. |
Yes let's do that 🚀 |
Feedback implemented, turned suggestion into fix, improved examples in docs and increased test coverage. I'm ready! |

Uh oh!
There was an error while loading.Please reload this page.
PR Checklist
Overview
Reports useless default values.