Skip to content
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): [explicit-function-return-type, explicit-module-boundary-types] improved checking for allowHigherOrderFunctions option #8508

Merged
merged 11 commits into from
Mar 18, 2024

Conversation

yeonjuan
Copy link
Contributor

@yeonjuan yeonjuan commented Feb 19, 2024

PR Checklist

Overview

The explicit-function-return-type's issue(#928) also occured in explicit-module-boundary-types because two rule use same util (explicitReturnTypeUtils.ts).

export const foo = () => { // no lint error
  return (): void => {}
}

export const bar = () => { // lint error
  const baz = "baz";
  return (): void => { }
}

I changed the code to collect the return statements inside the function, pass them to explicitReturnTypeUtils, and check whether it is a highOrderFunction or not. (#894 (comment))

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @yeonjuan!

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.

Copy link

netlify bot commented Feb 19, 2024

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 68ebb69
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/65f83037e147140008aca514
😎 Deploy Preview https://deploy-preview-8508--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: 98 (🟢 up 5 from production)
Accessibility: 100 (no change from production)
Best Practices: 92 (no change from production)
SEO: 98 (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 your Netlify site configuration.

@yeonjuan yeonjuan changed the title fix(eslint-plugin): [explicit-function-return-type] Improved checking for allowHigherOrderFunctions option fix(eslint-plugin): [explicit-function-return-type] improved checking for allowHigherOrderFunctions option Feb 19, 2024
@yeonjuan yeonjuan force-pushed the fix/928 branch 2 times, most recently from 82ccc02 to 0d5d17c Compare February 19, 2024 17:23
Copy link

codecov bot commented Feb 19, 2024

Codecov Report

Attention: Patch coverage is 96.00000% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 87.35%. Comparing base (3ac824b) to head (68ebb69).
Report is 47 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8508      +/-   ##
==========================================
+ Coverage   87.14%   87.35%   +0.21%     
==========================================
  Files         251      252       +1     
  Lines       12272    12456     +184     
  Branches     3871     3914      +43     
==========================================
+ Hits        10694    10881     +187     
+ Misses       1306     1304       -2     
+ Partials      272      271       -1     
Flag Coverage Δ
unittest 87.35% <96.00%> (+0.21%) ⬆️

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

Files Coverage Δ
...-plugin/src/rules/explicit-function-return-type.ts 98.11% <100.00%> (+0.24%) ⬆️
.../eslint-plugin/src/util/explicitReturnTypeUtils.ts 97.70% <100.00%> (ø)
...plugin/src/rules/explicit-module-boundary-types.ts 91.54% <90.00%> (-0.88%) ⬇️

... and 24 files with indirect coverage changes

@yeonjuan yeonjuan changed the title fix(eslint-plugin): [explicit-function-return-type] improved checking for allowHigherOrderFunctions option fix(eslint-plugin): [explicit-function-return-type, explicit-module-boundary-types] improved checking for allowHigherOrderFunctions option Feb 21, 2024
@yeonjuan yeonjuan marked this pull request as ready for review February 21, 2024 14:06
@JoshuaKGoldberg
Copy link
Member

By the way @yeonjuan, you are a hero for merging main in so much 😄. I filed #8610 to track establishing a standard so you & other PR authors don't feel a need to spend your time on that.

@yeonjuan
Copy link
Contributor Author

yeonjuan commented Mar 7, 2024

@JoshuaKGoldberg
Thanks for sharing. I thought the notifications wouldn't go to the folk because I push to a forked repo.... I will follow the recommendations going forward.

Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

Love it, this is great! 🤩

Just the one note on a return outside a function. Otherwise really nicely crafted.

@JoshuaKGoldberg
Copy link
Member

Oh and just a heads up, although there isn't a technical Git merge conflict, #8019 being merged is giving this a lint failure in CI.

/home/runner/work/typescript-eslint/typescript-eslint/packages/eslint-plugin/src/rules/explicit-function-return-type.ts
  117:14  error  Forbidden non-null assertion  @typescript-eslint/no-non-null-assertion

@JoshuaKGoldberg JoshuaKGoldberg added the awaiting response Issues waiting for a reply from the OP or another party label Mar 7, 2024
@github-actions github-actions bot removed the awaiting response Issues waiting for a reply from the OP or another party label Mar 10, 2024
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

Cute dog cutout jumping up above a light blue and purple/pink gradient background of stars. The dog is wearing sunglasses that fall off after they jump. A spoon of peanut butter is near the top. Caption: "YIPPEE", animated bottom to top.

@JoshuaKGoldberg JoshuaKGoldberg added the 1 approval >=1 team member has approved this PR; we're now leaving it open for more reviews before we merge label Mar 18, 2024
@JoshuaKGoldberg JoshuaKGoldberg merged commit 612875b into typescript-eslint:main Mar 18, 2024
59 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
1 approval >=1 team member has approved this PR; we're now leaving it open for more reviews before we merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[explicit-function-return-type] Have to type every chain of higher order function
2 participants