Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged

Conversation

ronami
Copy link
Member

@ronamironami commentedSep 27, 2024
edited
Loading

PR Checklist

Overview

This PR addresses#8538 and adds an option (namelyignoreVoidReturningFunctions) that allows returningvoid expressions from either:

  • Functions explicitly annotated withvoid as one of their return types.
  • Their contextual type includesvoid.

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:

functionreturnsVoid():void{}asyncfunctionfoo():Promise<void>{returnreturnsVoid();}

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 🙏

developer-bandi reacted with thumbs up emoji
@typescript-eslint
Copy link
Contributor

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.

@netlifyNetlify
Copy link

netlifybot commentedSep 27, 2024
edited
Loading

Deploy Preview fortypescript-eslint ready!

NameLink
🔨 Latest commit8b85c14
🔍 Latest deploy loghttps://app.netlify.com/sites/typescript-eslint/deploys/670a15a2d4fac700082ea430
😎 Deploy Previewhttps://deploy-preview-10067--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 94 (no change from production)
Accessibility: 100 (no change from production)
Best Practices: 92 (no change from production)
SEO: 90 (no change from production)
PWA: 80 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to yourNetlify site configuration.

@nx-cloudNx Cloud
Copy link

nx-cloudbot commentedSep 27, 2024
edited
Loading

☁️ Nx Cloud Report

CI 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 targets

Sent with 💌 fromNxCloud.

@ronamironami changed the title[no-confusing-void-expression] Add option to ignore void<->voidfeat(eslint-plugin):[no-confusing-void-expression] Add option to ignore void<->voidSep 27, 2024
@ronamironami changed the titlefeat(eslint-plugin):[no-confusing-void-expression] Add option to ignore void<->voidfeat(eslint-plugin):[no-confusing-void-expression] Add an option to ignore void<->voidSep 27, 2024
@ronamironami changed the titlefeat(eslint-plugin):[no-confusing-void-expression] Add an option to ignore void<->voidfeat(eslint-plugin): Add an option to ignore void<->void on[no-confusing-void-expression]Sep 27, 2024
@ronamironami changed the titlefeat(eslint-plugin): Add an option to ignore void<->void on[no-confusing-void-expression]feat(eslint-plugin): add an option to ignore void<->void on[no-confusing-void-expression]Sep 27, 2024
@ronamironami changed the titlefeat(eslint-plugin): add an option to ignore void<->void on[no-confusing-void-expression]feat(eslint-plugin): [no-confusing-void-expression] add an option to ignore void<->voidSep 27, 2024
@codecovCodecov
Copy link

codecovbot commentedSep 27, 2024
edited
Loading

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.12%. Comparing base(974d9ce) to head(8b85c14).
Report is 80 commits behind head on main.

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
FlagCoverage Δ
unittest86.12% <100.00%> (+0.02%)⬆️

Flags with carried forward coverage won't be shown.Click here to find out more.

Files with missing linesCoverage Δ
...t-plugin/src/rules/no-confusing-void-expression.ts100.00% <100.00%> (ø)
...ckages/eslint-plugin/src/rules/no-unsafe-return.ts97.22% <100.00%> (-0.22%)⬇️
...es/eslint-plugin/src/util/getParentFunctionNode.ts100.00% <100.00%> (ø)

@ronamironami marked this pull request as ready for reviewSeptember 27, 2024 18:54
Copy link
Member

@JoshuaKGoldbergJoshuaKGoldberg left a 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. 🏈

ronami reacted with heart emoji

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.

ronami reacted with heart emoji
Comment on lines 454 to 457
if (
ts.isFunctionExpression(functionTSNode) ||
ts.isArrowFunction(functionTSNode)
) {

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:

Suggested change
if(
ts.isFunctionExpression(functionTSNode)||
ts.isArrowFunction(functionTSNode)
){
if(ts.isExpression(functionTSNode)){

ronami reacted with thumbs up emoji
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Nice.

Copy link
MemberAuthor

@ronamironamiOct 11, 2024
edited
Loading

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.

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!

@JoshuaKGoldbergJoshuaKGoldberg added the awaiting responseIssues waiting for a reply from the OP or another party labelOct 10, 2024
@JoshuaKGoldberg
Copy link
Member

@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.

@ronami
Copy link
MemberAuthor

@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.

@JoshuaKGoldberg
Copy link
Member

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 theawaiting response label.

ronami reacted with thumbs up emoji

@github-actionsgithub-actionsbot removed the awaiting responseIssues waiting for a reply from the OP or another party labelOct 22, 2024
Copy link
Member

@JoshuaKGoldbergJoshuaKGoldberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Looks great, thanks for all the changes!

Renee Young hand-waving saying "Glorious!"

ronami reacted with heart emoji
@JoshuaKGoldbergJoshuaKGoldberg merged commite2e9ffc intotypescript-eslint:mainNov 4, 2024
63 checks passed
@ronamironami deleted the ignore-void-void branchNovember 4, 2024 17:31
renovatebot added a commit to mmkal/eslint-plugin-mmkal that referenced this pull requestNov 11, 2024
##### [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.
renovatebot added a commit to andrei-picus-tink/auto-renovate that referenced this pull requestNov 12, 2024
| 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.
renovatebot added a commit to andrei-picus-tink/auto-renovate that referenced this pull requestNov 12, 2024
| 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.
@github-actionsgithub-actionsbot locked asresolvedand limited conversation to collaboratorsNov 13, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@JoshuaKGoldbergJoshuaKGoldbergJoshuaKGoldberg approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Enhancement: [no-confusing-void-expression] Add option to ignore void<->void
2 participants
@ronami@JoshuaKGoldberg

[8]ページ先頭

©2009-2025 Movatter.jp