Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upGlobal return statements fail #167
Comments
watson
added a commit
to watson/git-att
that referenced
this issue
Jun 20, 2015
This comment has been minimized.
This comment has been minimized.
|
eslint (what But, since we now have support for custom js parsers now, perhaps we can remove module support and add back global return support. Users can get module support by using the esprima-fb or babel-eslint custom parsers. What do folks think? |
This comment has been minimized.
This comment has been minimized.
vs
and
I'm undecided. |
This comment has been minimized.
This comment has been minimized.
|
Just to clarify my use case: Some of my modules (like git-att referenced in this PR) ships with command line scripts ( |
This comment has been minimized.
This comment has been minimized.
|
@watson Understood - I like to do that in my code too. Here's a workaround, if you're interested in one: if (argv.version || argv.v) {
version()
process.exit(0)
} |
This comment has been minimized.
This comment has been minimized.
|
@dcousens Yeah, I get what you're saying. Maybe we should just make |
This comment has been minimized.
This comment has been minimized.
|
That could be worth looking into. Out of interest, would the desired behaviour with ES6 modules be that if an |
This comment has been minimized.
This comment has been minimized.
|
@feross Yeah, I usually also do that - but when calling an async function it doesn't help: https://github.com/watson/tweetcat/blob/4b287496b4a2d6dbcc22c495d1e071a9366242f3/bin.js#L25 |
feross
added
the
bug
label
Jun 28, 2015
This comment has been minimized.
This comment has been minimized.
|
Using |
This comment has been minimized.
This comment has been minimized.
|
I think this issue is unlikely to be fixed since global returns aren't valid ecmascript (which is silly). The various teams that work on the parsers are unwilling to add a special rule for invalid ecmascript. Unless anyone can think of something clever, I'm going to close this issue as WONTFIX. |
This comment has been minimized.
This comment has been minimized.
|
I'm thinking |
This comment has been minimized.
This comment has been minimized.
|
@dcousens That's correct. |
watson commentedJun 19, 2015
If I read #148 correctly, this should already be fixed and on npm, but given the following code in the file foo.js it fails anyway:
Standard will fail with the error "Illegal return statement":
So, help me out here :) What's going on?