Commit Graph

1 Commits (master)

Author SHA1 Message Date
Joseph Frazier f048ad3094 (Babylon) Allow `return` outside function (#1608)
This makes it easier to format code snippets including a `return`
statement, without having to format the entire function. For example,
given the following code:

```js
function f() {
    return someVeryLongStringA && someVeryLongStringB && someVeryLongStringC && someVeryLongStringD
}
```

a developer could select the line containing `return`, then use
prettier to format the code to:

```js
function f() {
return (
  someVeryLongStringA &&
  someVeryLongStringB &&
  someVeryLongStringC &&
  someVeryLongStringD
);
}
```

which can then be reindented by the editor.

---

Related to https://github.com/prettier/prettier/issues/593
2017-05-14 14:45:33 -07:00