Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump flow-parser from 0.121.0 to 0.122.0 #7935

Merged
merged 5 commits into from
Apr 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -35,7 +35,7 @@
"fast-glob": "3.2.2",
"find-parent-dir": "0.3.0",
"find-project-root": "1.1.1",
"flow-parser": "0.121.0",
"flow-parser": "0.122.0",
"get-stream": "5.1.0",
"globby": "11.0.0",
"graphql": "14.6.0",
Expand Down
1 change: 0 additions & 1 deletion src/language-js/needs-parens.js
Expand Up @@ -729,7 +729,6 @@ function isStatement(node) {
node.type === "ExportDefaultDeclaration" ||
node.type === "ExportNamedDeclaration" ||
node.type === "ExpressionStatement" ||
node.type === "ForAwaitStatement" ||
node.type === "ForInStatement" ||
node.type === "ForOfStatement" ||
node.type === "ForStatement" ||
Expand Down
17 changes: 3 additions & 14 deletions src/language-js/printer-estree.js
Expand Up @@ -801,7 +801,6 @@ function printPathNoParens(path, options, print, args) {
return concat(["%", n.name]);
case "SpreadElement":
case "SpreadElementPattern":
case "RestProperty":
case "SpreadProperty":
case "SpreadPropertyPattern":
case "RestElement":
Expand Down Expand Up @@ -1421,9 +1420,7 @@ function printPathNoParens(path, options, print, args) {
const canHaveTrailingSeparator = !(
n.inexact ||
(lastElem &&
(lastElem.type === "RestProperty" ||
lastElem.type === "RestElement" ||
hasNodeIgnoreComment(lastElem)))
(lastElem.type === "RestElement" || hasNodeIgnoreComment(lastElem)))
);

let content;
Expand Down Expand Up @@ -1754,8 +1751,7 @@ function printPathNoParens(path, options, print, args) {
const isParentForLoop =
parentNode.type === "ForStatement" ||
parentNode.type === "ForInStatement" ||
parentNode.type === "ForOfStatement" ||
parentNode.type === "ForAwaitStatement";
parentNode.type === "ForOfStatement";

const hasValue = n.declarations.some((decl) => decl.init);

Expand Down Expand Up @@ -1953,16 +1949,10 @@ function printPathNoParens(path, options, print, args) {
);

case "ForOfStatement":
case "ForAwaitStatement": {
// Babel 7 removed ForAwaitStatement in favor of ForOfStatement
// with `"await": true`:
// https://github.com/estree/estree/pull/138
const isAwait = n.type === "ForAwaitStatement" || n.await;

return group(
concat([
"for",
isAwait ? " await" : "",
n.await ? " await" : "",
" (",
path.call(print, "left"),
" of ",
Expand All @@ -1971,7 +1961,6 @@ function printPathNoParens(path, options, print, args) {
adjustClause(n.body, path.call(print, "body")),
])
);
}

case "DoWhileStatement": {
const clause = adjustClause(n.body, path.call(print, "body"));
Expand Down
47 changes: 47 additions & 0 deletions tests/for_await/__snapshots__/jsfmt.spec.js.snap
@@ -0,0 +1,47 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`for-await.js 1`] = `
====================================options=====================================
parsers: ["babel", "flow", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
async function foo() {
for await (num of asyncIterable) {
console.log(num);
}
for await (num of asyncGeneratorFunc()) {
console.log(num);
}
}

(async () => {
for await (num of asyncIterable) {
console.log(num);
}
for await (const x of delegate_yield()) {
x;
}
})();

=====================================output=====================================
async function foo() {
for await (num of asyncIterable) {
console.log(num);
}
for await (num of asyncGeneratorFunc()) {
console.log(num);
}
}

(async () => {
for await (num of asyncIterable) {
console.log(num);
}
for await (const x of delegate_yield()) {
x;
}
})();

================================================================================
`;
17 changes: 17 additions & 0 deletions tests/for_await/for-await.js
@@ -0,0 +1,17 @@
async function foo() {
for await (num of asyncIterable) {
console.log(num);
}
for await (num of asyncGeneratorFunc()) {
console.log(num);
}
}

(async () => {
for await (num of asyncIterable) {
console.log(num);
}
for await (const x of delegate_yield()) {
x;
}
})();
1 change: 1 addition & 0 deletions tests/for_await/jsfmt.spec.js
@@ -0,0 +1 @@
run_spec(__dirname, ["babel", "flow", "typescript"]);
8 changes: 4 additions & 4 deletions yarn.lock
Expand Up @@ -3627,10 +3627,10 @@ flatten@^1.0.2:
resolved "https://registry.yarnpkg.com/flatten/-/flatten-1.0.3.tgz#c1283ac9f27b368abc1e36d1ff7b04501a30356b"
integrity sha512-dVsPA/UwQ8+2uoFe5GHtiBMu48dWLTdsuEd7CKGlZlD78r1TTWBvDuFaFGKCo/ZfEr95Uk56vZoX86OsHkUeIg==

flow-parser@0.121.0:
version "0.121.0"
resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.121.0.tgz#9f9898eaec91a9f7c323e9e992d81ab5c58e618f"
integrity sha512-1gIBiWJNR0tKUNv8gZuk7l9rVX06OuLzY9AoGio7y/JT4V1IZErEMEq2TJS+PFcw/y0RshZ1J/27VfK1UQzYVg==
flow-parser@0.122.0:
version "0.122.0"
resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.122.0.tgz#f8258ba4200b2bec66c18ce00a323e3330e42b1a"
integrity sha512-rb4pLIb7JAWn4dnO+fB9YLTUOM0SvY1ZN2yeu2NOyL7f2JeXBp9Nevqf+h4OluQcdI+9CnGa/if/HUy1YOX0dA==

flush-write-stream@^1.0.0:
version "1.1.1"
Expand Down