millermedeiros/esformatter — pull request #99 by jzaefferer (2013-12-07 17:46:40+00:00)
Title: ReturnStatement: Test for whitespace in parens in ReturnStatement

This should adhere to ExpressionOpeningParentheses and ExpressionClosingParentheses, but currently those don't apply in the context of a ReturnStatement.

I've looked into this for a while, trying to reuse hooks/addSpaceInsideExpressionParentheses.js. Since that actually looks at the previous token when the first one isn't the open paren, it can't be used here - the `return` is the startToken value for the ReturnStatement, so we'd have to look at the next token instead.

Maybe there is a way to reuse the logic in that file? If not, I can look into reimplementing it for the ReturnStatement.