Commit Graph

14 Commits (82257bc091b7d2ec0d4bfb36e3ea3a9329680cba)

Author SHA1 Message Date
Stephen Scott 9a1e408a3f Add option and specs (no implementation yet)
These new snapshots are from https://github.com/prettier/prettier/pull/2676
2017-11-27 22:26:58 -07:00
Lucas Azzola 3474056b36 fix(typescript): handle ObjectPattern instead of ObjectExpression inside BinaryExpression, fixes #2237 (#2238) 2017-06-23 07:53:42 -07:00
Kevin Gibbons 565106dd63 Add parentheses for assignment as body of arrow (#1326) 2017-04-18 13:28:33 -07:00
Dan Harper 332babe77d Fix single optional arrow param printing (#1002) 2017-03-15 09:38:13 -07:00
Kevin Gibbons 7443f4cbd6 Parenthesize function expressions in expression position (#941)
* refactor needsParens for function expressions

* snapshots

* comment
2017-03-07 18:53:42 -08:00
Davy Duperron 1b6ddf9a7f Fix binary op as body in arrow expression (#921)
* Implement new logic for wrapping binary op in arrowFunctionExpression.

* Add new test cases.

* Reuse new helper function in order to fix #917.

* Add new test case.

* Extend heuristic to dive deeper into mixed types.

* Add new test.

* Enhance logic to cover more cases.

* Add new test cases.

* Disable Flow as it gets BindExpression as an unexpected token.

* Simplify getCombinedDeepest function.

* Add missing case.

* Extract all conditions in switch cases to one top level condition.

* Refactor implementation to make it cleaner and also handle ExpressionStatement.

* Update related test cases.

* Add new test case.

* Make condition less expensive.

* Clean up unecessary conditions, simplify condition involving startsWithOpenCurlyBrace.

* Update and add new test cases for better coverage.

* Remove unecessary condition, refactor canBeFirstInStatement to drop some useless parens.

* Update test cases accordingly 🚀.
2017-03-07 13:24:47 -08:00
Davy Duperron 4dde054bb3 Fix binary expression instanceof in arrow function expression (#913)
* Add fix for parens of BinaryExpression with instanceof op embedded into ArrowFunctionExpression.

* Add new test 🚀.
2017-03-06 03:44:48 -08:00
Davy Duperron 2ef9896567 Fix object expression in arrow function expression (#897)
* Add new case for keeping parens around ObjectExpression in ArrowFunctionExpression.

* Add new test.
2017-03-05 13:04:50 -08:00
Christopher Chedeau c8615ed9a6 Add parenthesis for arrow function inside of ternary (#408)
This one is really weird

```js
if (() => {} ? 1 : 0) {}
```

parses fine but

```js
if (() => {
} ? 1 : 0) {}
```

is a syntax error. Let's always add a parenthesis.

Note that no one is every going to write this in practice, this is really useless :p
2017-01-22 16:16:57 -08:00
Brian Ng b94b86331f Ensure parens on NewExpression with function callee (#282) 2017-01-17 19:45:56 -08:00
Brian Ng f0d2ad4508 Fix parens for functions inside TaggedTemplateExpression (#259) 2017-01-16 19:47:13 -08:00
Brian Ng d9ea466cd3 Fix FunctionExpression parens issues (#250) 2017-01-16 12:52:55 -05:00
Brian Ng 86c65d1f81 Fix missing parenthesis for typeof and arrow functions (#249) 2017-01-16 09:08:46 -08:00
Brian Ng 470f80c17a Fix issue with ArrowFunctionExpression parens (#236) 2017-01-15 22:42:42 -08:00