Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.9k
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
feat(eslint-plugin): [no-useless-default-assignment] add rule#11720
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 commit026fd7f
☁️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✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@## main #11720 +/- ##==========================================+ Coverage 90.53% 90.58% +0.04%========================================== Files 523 524 +1 Lines 53097 53325 +228 Branches 8838 8892 +54 ==========================================+ Hits 48074 48302 +228 Misses 5010 5010 Partials 13 13
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.
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>
ulrichstark commentedNov 4, 2025
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. |
JoshuaKGoldberg commentedNov 4, 2025
Yes let's do that 🚀 |
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.
Lovely work, thanks! 🙌
@ronami had a bunch of good points I'd missed last review cycle, so if they have time it'd be good to hear from them too.
ronami 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.
🚀🚀 Looks amazing!
I've added two comments for bugs around destructuring records/mapped-types.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
ed0011c
ronami left a comment• 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.
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.
Lovely work! 🏆
Requesting one final adjustment for records/mapped-types around thenoUncheckedIndexedAccess compiler option.
Uh oh!
There was an error while loading.Please reload this page.
ronami 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.
🚀🚀
1301f79 intotypescript-eslint:mainUh oh!
There was an error while loading.Please reload this page.
simPod commentedDec 15, 2025
importtype{TypePolicy}from'@apollo/client';importtype{Foo,Bar}from'@app/gql/graphql';import{replaceArray}from'./helpers';exportconstnetworkPortTypePolicy:TypePolicy={fields:{pduLinks:{merge:(_existing:PduPortLink[]|undefined,incoming:PduPortLink[]=[])=>replaceArray<PduPortLink>(_existing,incoming),},serverLinks:{merge:(_existing:ServerPortLink[]|undefined,incoming:ServerPortLink[]=[])=>replaceArray<ServerPortLink>(_existing,incoming),},},}; |
ulrichstark commentedDec 15, 2025
kirkwaiblinger commentedDec 15, 2025
Please file a new issue with reproduction for this, thanks! Seehttps://typescript-eslint.io/contributing/issues#commenting |

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