millermedeiros / esformatter

ECMAScript code beautifier/formatter
MIT License
970 stars 91 forks source link

return in parenthesis inconsistency #465

Closed vlork closed 7 years ago

vlork commented 8 years ago
return (
boop
)
return (
boop
);

becomes

return (
    boop
)
return (
    boop
    );

Not sure if intentional.

Relevant for JSX, with markup within parenthesis, though formatting seems to be done by esformatter core.

millermedeiros commented 8 years ago

this definitely needs to be fixed, should not be hard for this specific case.

this is handled by getIndentEdges inside https://github.com/millermedeiros/esformatter/blob/master/lib/hooks/ReturnStatement.js

maybe the parenthesis check is wrong, or maybe it should not return the parentheses.closing as the endToken.

I'm not going to have time to work on esformatter this week, PRs are highly appreciated! Thanks for reporting the bug.

see also #298 (which is way harder to fix, but somewhat related)

glesage commented 7 years ago

Indeed, this is still an issue. Any updates?

millermedeiros commented 7 years ago

@glesage been busy with my day job, newborn daughter and mountain biking.. only had time to fix this today. will try to release a new version soon including the fix :D

pull requests are highly appreciated!