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-confusing-void-expression] add an option to ignore void<->void#10067
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Thanks for the PR,@ronami! 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 commentedSep 27, 2024 • 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 site configuration. |
nx-cloudbot commentedSep 27, 2024 • 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.
☁️ Nx Cloud ReportCI is running/has finished running commands for commit8b85c14. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 2 targetsSent with 💌 fromNxCloud. |
[no-confusing-void-expression]
Add option to ignore void<->void[no-confusing-void-expression]
Add option to ignore void<->void[no-confusing-void-expression]
Add an option to ignore void<->void[no-confusing-void-expression]
Add an option to ignore void<->void[no-confusing-void-expression]
[no-confusing-void-expression]
[no-confusing-void-expression]
[no-confusing-void-expression]
codecovbot commentedSep 27, 2024 • 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 ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@## main #10067 +/- ##==========================================+ Coverage 86.09% 86.12% +0.02%========================================== Files 428 429 +1 Lines 14969 14995 +26 Branches 4343 4351 +8 ==========================================+ Hits 12888 12914 +26 Misses 1734 1734 Partials 347 347
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 like a great start to me! Mostly requesting changes on docs & testing, the game plan seems very reasonable. 🏈
packages/eslint-plugin/docs/rules/no-confusing-void-expression.mdx OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
packages/eslint-plugin/docs/rules/no-confusing-void-expression.mdx OutdatedShow resolvedHide resolved
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.
[Praise] I like the reuse here 🙂 nice.
if ( | ||
ts.isFunctionExpression(functionTSNode) || | ||
ts.isArrowFunction(functionTSNode) | ||
) { |
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.
[Style] Nit: a little less code to read & run here, asgetContextualType
is just looking for expressions:
if( | |
ts.isFunctionExpression(functionTSNode)|| | |
ts.isArrowFunction(functionTSNode) | |
){ | |
if(ts.isExpression(functionTSNode)){ |
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.
Nice.
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've seen this done here. Would it make sense to send a tiny PR to shorten it in a similar way? Looks like it works out locally.
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.
If you want, I'd 👍 it!
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
….mdxCo-authored-by: Josh Goldberg ✨ <git@joshuakgoldberg.com>
….mdxCo-authored-by: Josh Goldberg ✨ <git@joshuakgoldberg.com>
Co-authored-by: Josh Goldberg ✨ <git@joshuakgoldberg.com>
@ronami is this ready for re-review? We normally wait to be explicitly re-requested, so we're holding off posting more comments for now. |
Oh, I wasn't aware of this. Yes! It is ready for review. |
Great thanks! In the future, you can use the actual GitHub feature:https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/about-pull-request-reviews#re-requesting-a-review. That'll put it back on our queue. We have automations around it to remove the |
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.
e2e9ffc
intotypescript-eslint:mainUh oh!
There was an error while loading.Please reload this page.
##### [v8.14.0](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8140-2024-11-11)##### 🚀 Features- **eslint-plugin:** \[await-thenable] report unnecessary `await using` statements ([#10209](typescript-eslint/typescript-eslint#10209))- **eslint-plugin:** \[no-confusing-void-expression] add an option to ignore void<->void ([#10067](typescript-eslint/typescript-eslint#10067))##### 🩹 Fixes- **scope-manager:** fix asserted increments not being marked as write references ([#10271](typescript-eslint/typescript-eslint#10271))- **eslint-plugin:** \[no-misused-promises] improve report loc for methods ([#10216](typescript-eslint/typescript-eslint#10216))- **eslint-plugin:** \[no-unnecessary-condition] improve error message for literal comparisons ([#10194](typescript-eslint/typescript-eslint#10194))##### ❤️ Thank You- Gyumong [@gyumong](https://github.com/Gyumong)- Jan Ochwat [@janek515](https://github.com/janek515)- Kirk Waiblinger [@kirkwaiblinger](https://github.com/kirkwaiblinger)- Ronen AmielYou can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website.
| datasource | package | from | to || ---------- | -------------------------------- | ------ | ------ || npm | @typescript-eslint/eslint-plugin | 8.13.0 | 8.14.0 || npm | @typescript-eslint/parser | 8.13.0 | 8.14.0 |## [v8.14.0](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8140-2024-11-11)##### 🚀 Features- **eslint-plugin:** \[await-thenable] report unnecessary `await using` statements ([#10209](typescript-eslint/typescript-eslint#10209))- **eslint-plugin:** \[no-confusing-void-expression] add an option to ignore void<->void ([#10067](typescript-eslint/typescript-eslint#10067))##### 🩹 Fixes- **scope-manager:** fix asserted increments not being marked as write references ([#10271](typescript-eslint/typescript-eslint#10271))- **eslint-plugin:** \[no-misused-promises] improve report loc for methods ([#10216](typescript-eslint/typescript-eslint#10216))- **eslint-plugin:** \[no-unnecessary-condition] improve error message for literal comparisons ([#10194](typescript-eslint/typescript-eslint#10194))##### ❤️ Thank You- Gyumong [@gyumong](https://github.com/Gyumong)- Jan Ochwat [@janek515](https://github.com/janek515)- Kirk Waiblinger [@kirkwaiblinger](https://github.com/kirkwaiblinger)- Ronen AmielYou can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website.
| datasource | package | from | to || ---------- | -------------------------------- | ------ | ------ || npm | @typescript-eslint/eslint-plugin | 8.13.0 | 8.14.0 || npm | @typescript-eslint/parser | 8.13.0 | 8.14.0 |## [v8.14.0](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8140-2024-11-11)##### 🚀 Features- **eslint-plugin:** \[await-thenable] report unnecessary `await using` statements ([#10209](typescript-eslint/typescript-eslint#10209))- **eslint-plugin:** \[no-confusing-void-expression] add an option to ignore void<->void ([#10067](typescript-eslint/typescript-eslint#10067))##### 🩹 Fixes- **scope-manager:** fix asserted increments not being marked as write references ([#10271](typescript-eslint/typescript-eslint#10271))- **eslint-plugin:** \[no-misused-promises] improve report loc for methods ([#10216](typescript-eslint/typescript-eslint#10216))- **eslint-plugin:** \[no-unnecessary-condition] improve error message for literal comparisons ([#10194](typescript-eslint/typescript-eslint#10194))##### ❤️ Thank You- Gyumong [@gyumong](https://github.com/Gyumong)- Jan Ochwat [@janek515](https://github.com/janek515)- Kirk Waiblinger [@kirkwaiblinger](https://github.com/kirkwaiblinger)- Ronen AmielYou can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website.
Uh oh!
There was an error while loading.Please reload this page.
PR Checklist
Overview
This PR addresses#8538 and adds an option (namely
ignoreVoidReturningFunctions
) that allows returningvoid
expressions from either:void
as one of their return types.void
.I enabled the rule back on
@typescript-eslint
's monorepo (since it's currently disabled) with the option and had to fix one error that looks valid. Running the rule on@typescript-eslint
's monorepo helped me figure out the various edge cases of the rule (hopefully, I didn't miss a whole lot).I added a "game plan" comment after seeing@kirkwaiblinger do this on several other rules, and it has been helpful to read through.
One open question I have is whether or not this should apply to async functions. I mean, if the following should be valid or not:
Please let me know if this makes sense or if I missed anything.
Edit: Only when I finished most of the work I noticed the linked PR of#8632. I noticed I was missing a bunch of tests and added the ones I was missing, thanks@developer-bandi 🙏