-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix(eslint-plugin): [no-unnecessary-type-parameters] clarify message #9737
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
fix(eslint-plugin): [no-unnecessary-type-parameters] clarify message #9737
Conversation
Thanks for the PR, @JoshuaKGoldberg! 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 site configuration. |
packages/eslint-plugin/src/rules/no-unnecessary-type-parameters.ts
Outdated
Show resolved
Hide resolved
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #9737 +/- ##
==========================================
+ Coverage 87.90% 87.94% +0.03%
==========================================
Files 403 402 -1
Lines 13765 13725 -40
Branches 4010 3997 -13
==========================================
- Hits 12100 12070 -30
+ Misses 1358 1350 -8
+ Partials 307 305 -2
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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 good to me on the "in the signature" changes, with appropriate node type 👍
Do we want to consider the part of the issue too that complains about it saying "used once" when it's used zero times? I think that change should be pretty simple since I think we can just use the identifierCounts
right above the context.report()
call to differentiate between 0 and 1 usages (which is to say, identifierCounts === 1
or identifierCounts === 2
). But no need to include this if you think it's inadvisable
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.
I'll fix up the merge conflict & formatting issues locally. 🚀 |
Oh and fyi @danvk - we're hoping to get this in today, but if you have more changes you'd want, let me know! I'm on task to apply them. |
Merging real quick to get this in before the auto release. 😄 |
LGTM on the wording. I'm confused why we care about zero times in the context of this rule, though. That would be an unused type parameter, and TypeScript already complains about those. ![]() |
Uh oh! @danvk, the image you shared is missing helpful alt text. Check #9737 (comment). Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image. Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs.
|
PR Checklist
Overview
Adds "in the (class|function) signature" to clarify the message. Also, shoutout @kirkwaiblinger, updated the rule's description and message to be clear that it reports when a type parameter isn't used multiple times. Using a type parameter 0 times or 1 time both cause a report.
💖