You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 return statements to interrupt control flow of the "top level" of their Node.js modules.
Unfortunately, it seems likely that many consumers are depending on the ability to use return like this. In an ideal world, JSHint would have only tolerated the apparently-invalid syntax if the node option were set to true. I'm afraid the ship's sailed on that, though.
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.
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: