Huáng Jùnliàng
146ea4176e
fix: check parenthesis between optional chain and other types ( #11325 )
2020-03-24 08:28:47 +01:00
Justin Ridgewell
b1a589f0aa
Fix printing edge cases in Nullish Coalescing and Optional Ch… ( #11255 )
...
This is a mix of changes, most importantly:
- Always print parens when mixing nullish coalescing and another logical
- Fixes assignment in the callee of an optional chain, which now blocks #11248
Also, cleans up a bit of code, and removes an unnecessary parens around `class A extends new B {}`
2020-03-13 16:35:28 +01:00
Sergey Melyukov
cb9d28c42c
Force parentheses around array and conditional infer ( #11227 )
2020-03-10 12:27:52 -04:00
Sagiv ben giat
a39beda58b
print parenthesis around forced calls of optional chains ( #11190 )
2020-02-28 18:43:43 -05:00
Siddhant N Trivedi
6ad7e19a27
Fix parentheses removal in nullish-coalescing operation ( #11014 )
...
* Added precedence for nullish-coalescing-operator
* Made precedence equal to logical OR
* Renamed the folders made for testing
* Fixed the output test file of nullish-coalescing op
2020-01-15 23:30:28 +01:00
Brian Ng
e28c8ac612
Fix generator missing parens around an arrow returning function type ( #10519 )
2019-10-11 21:22:42 -04:00
Tan Li Hau
bbb4d7b6d7
Fix typescript generator params ( #9524 )
...
* Fix typescript generator params
* add TSOptionalType, TSRestType, add more test
2019-02-18 08:22:22 +01:00
Tan Li Hau
5bb1bb080f
Fix flow babel-generator function parantheses ( #9523 )
2019-02-18 00:17:52 +01:00
Paul Happ
2bb24f996f
Fix yield expression transform ( #9076 )
2018-11-27 09:45:06 -06:00
Brian Ng
9f407e0735
Fix some missing parens cases with OptionalMemberExpression in generator ( #8751 )
2018-09-23 10:54:13 -05:00
Nicolò Ribaudo
18c8d97c3d
UpdateExpressions as callees must be parenthesized ( #6922 )
2017-11-27 23:31:24 +01:00
Brian Ng
881fc14329
Add handling parens for extends clause in generator ( #6897 )
2017-11-27 12:08:35 -06:00
Henry Zhu
cde0054227
Scoped: change src imports to @babel/ [skip ci]
2017-10-16 22:49:56 -04:00
Brian Ng
832408e85d
Fix generator missing parens on Flow union types ( #6334 )
2017-09-29 14:43:38 -04:00
Brian Ng
7f390b0282
Make terminator paren comment check more strict ( #5651 )
2017-09-15 11:06:24 -07:00
Andy
c1d07fd6db
babel-generator: Add TypeScript support ( #5896 )
...
* babel-generator: Add TypeScript support
* Remove type declarations; not published from babylon
* Remove TODOs
* Consistently use `this.word` for tokens that are words
2017-07-28 16:07:05 -04:00
Brian Ng
e4b35f680d
Run prettier
2017-06-27 12:15:00 -05:00
Brian Ng
cce83a0cea
Fix parens issues with exponentiation in generator ( #5830 )
2017-06-09 11:10:16 -04:00
Nicolò Ribaudo
b0524427c1
Wrap an arrow function in parentheses if it the test of a conditional expression ( #5820 )
...
* Wrap an arrow function in parentheses if it the test of a conditional expression
Fixes #5819
* Use ConditionalExpresion to check if () => {} should be wrapped
* Move `t.isTaggedTemplateExpression()` from ArrowFunctionExpression to
ConditionalExpresion
* [test] `await (() => {})` needs the parentheses
* [test] (a ? b : c)`` needs the parentheses
2017-06-05 12:39:28 -04:00
Aaron Ang
3d987ed6c0
Keep parentheses for logical expression when in await expression ( fix #5428 ) ( #5433 )
2017-03-09 09:13:53 -05:00
Artem Gurzhii
6888a2c51b
Code refactoring for the babel-generator ( #5344 )
...
* refactoring code for babel-generator package
* removing spaces and refactoring if statement
* fixing warnings
2017-03-07 16:41:49 -05:00
Brian Ng
8a82cc060a
Run new lint rules ( #5413 )
2017-03-04 10:46:01 -05:00
Zachary Miller
6614a63b3b
Wrap some generated do expressions in parens ( #5339 )
2017-02-22 07:50:58 -05:00
Erik Desjardins
e9d7757433
Emit parens for await (but not yield) of ternary expressions ( #5270 )
2017-02-06 09:06:48 -08:00
Brian Ng
b69dc51be0
Fix missing parens when function expressions is tag ( #5193 )
2017-01-23 08:45:57 -08:00
Brian Ng
8c35b320d3
Bump eslint-config-babel and fix lint ( #5129 )
2017-01-17 10:51:16 +01:00
Henry Zhu
672adba9a1
enable prefer const ( #5113 )
2017-01-14 09:48:52 -05:00
Bruno Jouhier
f9ccee9d83
fixed babel/babel#4632 - missing parentheses around yield expression … ( #4633 )
...
* fixed babel/babel#4632 - missing parentheses around yield expression in conditional test
* babel/babel#4632 - added test
2016-10-01 12:58:59 -04:00
Logan Smyth
256c0100cb
Wrap parens around default exports starting with function/class - fixes T7136
2016-03-12 15:31:16 -08:00
Amjad Masad
2fbe28cc88
Remove remaining @flow annotations
2016-03-03 15:10:59 -08:00
Amjad Masad
12ee11a0a4
Revert "Remove Flow annotations and pragmas"
...
This reverts commit 4252244d06b225ab26a02d52c04f9940a3e4d6a2.
2016-03-03 15:03:55 -08:00
Henry Zhu
1271d2cd52
Merge pull request #3380 from babel/unary-arrow
...
Fix: Add parens for unary arrow function
2016-02-29 12:18:12 -05:00
Henry Zhu
ec3c183668
Fix: Add parens for unary arrow function
...
Fixes T7157
2016-02-28 21:56:22 -05:00
Sam Goldman
4252244d06
Remove Flow annotations and pragmas
2016-02-28 13:18:57 -10:00
Amjad Masad
3d3b30eb45
[T7047]Consider arrow functions when parenthesizing object expressions
2016-02-02 16:26:31 -08:00
Amjad Masad
139503e86f
Parenthesize await/yield expression in binary expr
2016-01-06 17:35:39 -08:00
Amjad Masad
6abee425d3
Revert "babel-types: add Binary alias to AssignmentExpression definition (fixes T6887)"
...
This was causing problems with parenthesizing assignment expression
This reverts commit b5cf529d6b342b3dd8dd49c50cc9cd5fed4fc5a7.
2016-01-06 15:59:39 -08:00
Amjad Masad
e79c625091
Merge pull request #3229 from hzoo/T6913
...
Add a check for parentheses for AwaitExpressions (fixes T6913)
2016-01-06 14:22:54 -06:00
Henry Zhu
cf41c321af
Don't overparenthesize, add yield tests
2016-01-05 18:12:25 -05:00
Henry Zhu
ab2135bc9f
Add a check for parentheses for AwaitExpressions (fixes T6913)
2016-01-04 08:31:07 -05:00
Henry Zhu
b5cf529d6b
babel-types: add Binary alias to AssignmentExpression definition (fixes T6887)
2016-01-01 14:44:28 -05:00
Amjad Masad
ed5a057e4e
Fix various print inefficiencies/bugs
2015-12-27 01:24:19 -08:00
Amjad Masad
10c9d26983
Also use for object expressions
2015-12-24 15:01:46 -08:00
Amjad Masad
0d8e5a9e86
Fix over-parenthesizing of function expressions
2015-12-24 14:55:51 -08:00
Amjad Masad
4aaaeb9ccf
decouple arrow functions from function exprs
2015-12-17 23:31:52 -08:00
Amjad Masad
c889ef4058
Parenthesize arrow function when part of logical or binary expression
2015-12-17 23:18:43 -08:00
Amjad Masad
07df8515b9
Parenthesize object expression when it could end up at the start of an expression T6811
2015-12-11 18:04:16 -08:00
Amjad Masad
19daae6d96
Don't print on throw statements with sequence exprs
2015-12-07 02:48:11 -08:00
Sebastian McKenzie
cdeff2fbb1
simplify parentheses logic and properly parenthesise unaries - fixes #2711
2015-11-03 10:49:24 +00:00
Sebastian McKenzie
370b7913b4
add ArrowFunctionExpression parentheses logic
2015-10-30 22:51:02 +00:00