-
-
Notifications
You must be signed in to change notification settings - Fork 2.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 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?
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 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 7d7a636
☁️ Nx Cloud last updated this comment at |
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:
|
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
Outdated
Show resolved
Hide resolved
| default: | ||
| return null; | ||
| } | ||
| } |
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
Outdated
Show resolved
Hide resolved
packages/eslint-plugin/tests/rules/no-useless-default-assignment.test.ts
Show resolved
Hide resolved
packages/eslint-plugin/docs/rules/no-useless-default-assignment.mdx
Outdated
Show resolved
Hide resolved
packages/eslint-plugin/docs/rules/no-useless-default-assignment.mdx
Outdated
Show resolved
Hide resolved
…t.mdx Co-authored-by: Josh Goldberg ✨ <[email protected]>
…t.mdx Co-authored-by: Josh Goldberg ✨ <[email protected]>
…ignment]-add-rule
|
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! |

PR Checklist
Overview
Reports useless default values.