Returning undefined triggers no-return-assign
See original GitHub issue- ESLint Version: 5.5.0
- Node Version: 10.6.0
- npm Version: 6.4.1
Default configuration; () => void (a = 1)
triggers the no-return-assign rule even though it’s returning undefined
.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
MongoDB Atlas scheduled trigger service returning undefined
get('mongodb-atlas'); is returning undefined when I log it to console, and when I try and using it, it just says Cannot access member...
Read more >Scheduled trigger service returning undefined - MongoDB Atlas
I'm trying to create a scheduled trigger to clear a collection weekly, but I am unable to get the service… const collection ...
Read more >Low level issues - Embold Help Center
A confusing aspect of JavaScript is that a function returns undefined if any of the following are true: 1. it does not execute...
Read more >AdditionalScope passed to Query Trigger in Javascript Query ...
I am a passing the additionalScope function to the query.trigger method ... passed to Query Trigger in Javascript Query returning Undefined.
Read more >backend/static/build/static/js/18.2480c5a6.chunk.js.map
openClassName;\n\n if (openClassName !== undefined) {\n return ... className,\n overlay = props.overlay,\n trigger = props.trigger,\n align ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
(to clarify, i don’t think this is a bug - the rules docs have the title of “Disallow Assignment in return Statement” - it’s in no way about the return value or the result of the assignment, and the description points out that the motivation is to catch the bug of doing
=
when you meant to do==
or===
.There should be no exception here for
void
(imo there shouldn’t be one for parens either). At the worst,void
could be under another option (likeexcept-parens
) but I don’t think there’s value in that versus the added rule complexity.The rule isn’t warning about returning the result of an assignment - it’s warning about having an assignment expression inside a return statement. Adding
void
doesn’t change that.