-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
JavaScript: Mark return out of function #3612
Comments
Thanks for the report! JSHint has silently tolerated this syntax error for a very long time; I'm a little surprised no one has reported it before. There's some historical rational behind the behavior. By default, the Node.js runtime "wraps" JavaScript programs in an immediately-invoked function expression. A side-effect of that transformation is that developers can write Unfortunately, it seems likely that many consumers are depending on the ability to use So while we should certainly correct this, the fix will have to wait until the next major release of JSHint. We have no ETA on that today. |
For the time being, instead of changing the default behaviour, which would be a breaking change, what about adding an Enforcing options for |
I came across a code that had
return
out of function. It would be good if JSHint could also mark it.The text was updated successfully, but these errors were encountered: