-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix(eslint-plugin): [explicit-module-boundary-types] don't check returned functions if parent function has return type #2084
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-module-boundary-types] don't check returned functions if parent function has return type #2084
Conversation
Thanks for the PR, @ifiokjr! 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. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitors per day. |
Codecov Report
@@ Coverage Diff @@
## master #2084 +/- ##
=======================================
Coverage 93.42% 93.42%
=======================================
Files 171 171
Lines 7755 7774 +19
Branches 2215 2222 +7
=======================================
+ Hits 7245 7263 +18
Misses 244 244
- Partials 266 267 +1
|
packages/eslint-plugin/src/rules/explicit-module-boundary-types.ts
Outdated
Show resolved
Hide resolved
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.
Mostly LGTM - thanks!
One comment that needs addressing.
f06e1e0
to
5cac715
Compare
ce93945
to
9b37ff0
Compare
I've just pushed again to:
|
Was complaining about inner function expressions. Fixes typescript-eslint#1845
Exit early when the type of the ancestor of the node being checked is not a return statement.
Ignore final return code path
cdffccb
to
9f8d026
Compare
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.
LGTM - thanks!
Description
Version 3.0.0 of the plugin enabled
explicit-module-boundary-types
by default. Unfortunately it doesn't currently handle the case where the parent function has a type signature. The following correct code produces an error.This fixes the problem by checking the parent nodes of exported declarations to see if they are already typed. If they are typed it doesn't show the error for child functions.
Fixes #1845