fix: allow typedef returns that may be void#1699
Conversation
|
Thank you for this PR. However, I'm not sure how common it is that the typedef would be defined on the block itself. I was hoping any PR could search the document for typedefs (as does |
Signed-off-by: Matthew Stanton <stantonmatthewj@gmail.com>
c54051f to
99dfe01
Compare
|
Updated in I added coverage for separate-block typedefs before and after the function, plus a non-void typedef case that still reports. Local checks: |
|
Thanks! This looks good, but may take me maybe a few days to get to it to review. |
Signed-off-by: Matthew Stanton <stantonmatthewj@gmail.com>
brettz9
left a comment
There was a problem hiding this comment.
Looking good.
See the comments. My example code needs to be tested--just what I think it will probably look like.
Signed-off-by: Matthew Stanton <stantonmatthewj@gmail.com>
|
Superseded by the later |
Signed-off-by: Matthew Stanton <stantonmatthewj@gmail.com>
932470e to
839ae3e
Compare
|
Updated in
Local checks: focused GitHub checks are also green on the pushed head: Build, Lint, and the three Test matrix jobs. |
brettz9
left a comment
There was a problem hiding this comment.
Looking very good to me, thanks!
|
🎉 This PR is included in version 63.0.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Fixes #1390.
This updates
require-returns-checkso a@returnstag whose type resolves to a same-file@typedefis treated as potentially undefined when that typedef includesvoidorundefined. That prevents the rule from reporting a missing return expression for patterns like:I also added generated docs coverage for the new valid case.
Verification:
pnpm run test-index --rule require-returns-checkpnpm exec eslint src/rules/requireReturnsCheck.js test/rules/assertions/requireReturnsCheck.jspnpm run tscpnpm run check-docspnpm run buildgit diff --check