That's because JavaScript interprets
return
{
bar: "hello"
};
as return statement followed by block creation (which is ignored in runtime). Not as "return an object". And I really don't know why JavaScript devs made such decision.
Anyway ASI inserts ; after return resulting in the equivalent code:
return;
{
bar: "hello"
};
The newline after return is the culprit. Don't use it if you wish to return something.