Fix: Add parens for unary arrow function
Fixes T7157
This commit is contained in:
parent
6aff776124
commit
ec3c183668
@ -204,6 +204,10 @@ export function ArrowFunctionExpression(node: Object, parent: Object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (t.isUnaryExpression(parent)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return UnaryLike(node, parent);
|
||||
}
|
||||
|
||||
|
||||
3
packages/babel-generator/test/fixtures/parentheses/unary-arrow-function/actual.js
vendored
Normal file
3
packages/babel-generator/test/fixtures/parentheses/unary-arrow-function/actual.js
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
void (() => {});
|
||||
typeof (() => {});
|
||||
!(() => {});
|
||||
3
packages/babel-generator/test/fixtures/parentheses/unary-arrow-function/expected.js
vendored
Normal file
3
packages/babel-generator/test/fixtures/parentheses/unary-arrow-function/expected.js
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
void (() => {});
|
||||
typeof (() => {});
|
||||
!(() => {});
|
||||
Loading…
x
Reference in New Issue
Block a user