fix(javascript): add parens for await in bind (#4778)
parent
d450882289
commit
61d5eeadd3
|
@ -369,6 +369,7 @@ function needsParens(path, options) {
|
|||
case "ExperimentalSpreadProperty":
|
||||
case "TSAsExpression":
|
||||
case "TSNonNullExpression":
|
||||
case "BindExpression":
|
||||
return true;
|
||||
|
||||
case "MemberExpression":
|
||||
|
|
|
@ -1,5 +1,31 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`await.js 1`] = `
|
||||
const doBothThings = async () => {
|
||||
const request = doAsyncThing();
|
||||
return (await request)::doSyncThing();
|
||||
};
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
const doBothThings = async () => {
|
||||
const request = doAsyncThing();
|
||||
return (await request)::doSyncThing();
|
||||
};
|
||||
|
||||
`;
|
||||
|
||||
exports[`await.js 2`] = `
|
||||
const doBothThings = async () => {
|
||||
const request = doAsyncThing();
|
||||
return (await request)::doSyncThing();
|
||||
};
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
const doBothThings = async () => {
|
||||
const request = doAsyncThing()
|
||||
return (await request)::doSyncThing()
|
||||
}
|
||||
|
||||
`;
|
||||
|
||||
exports[`bind_parens.js 1`] = `
|
||||
(a || b)::c;
|
||||
a || (b::c);
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
const doBothThings = async () => {
|
||||
const request = doAsyncThing();
|
||||
return (await request)::doSyncThing();
|
||||
};
|
Loading…
Reference in New Issue