From 0ecf5171febabc11d02db70d9fcf3f97ad01bfc7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Mar 2021 12:37:10 +0000 Subject: [PATCH] Build(deps): Bump @babel/parser from 7.13.11 to 7.13.13 (#10622) --- package.json | 2 +- .../js/async/__snapshots__/jsfmt.spec.js.snap | 14 +++ tests/js/async/exponentiation.js | 1 + .../__snapshots__/jsfmt.spec.js.snap | 108 ++++++++++++++++++ .../misc/errors/js/async-await/jsfmt.spec.js | 8 ++ yarn.lock | 7 +- 6 files changed, 133 insertions(+), 7 deletions(-) create mode 100644 tests/js/async/exponentiation.js diff --git a/package.json b/package.json index 6a2e90d42..606d44139 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "dependencies": { "@angular/compiler": "11.2.7", "@babel/code-frame": "7.12.13", - "@babel/parser": "7.13.11", + "@babel/parser": "7.13.13", "@glimmer/syntax": "0.77.6", "@iarna/toml": "2.2.5", "@typescript-eslint/typescript-estree": "4.19.0", diff --git a/tests/js/async/__snapshots__/jsfmt.spec.js.snap b/tests/js/async/__snapshots__/jsfmt.spec.js.snap index ce5478bba..8e3523352 100644 --- a/tests/js/async/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/async/__snapshots__/jsfmt.spec.js.snap @@ -133,6 +133,20 @@ async function f2() { ================================================================================ `; +exports[`exponentiation.js format 1`] = ` +====================================options===================================== +parsers: ["babel", "flow", "typescript"] +printWidth: 80 + | printWidth +=====================================input====================================== +async () => (await 5) ** 6; + +=====================================output===================================== +async () => (await 5) ** 6; + +================================================================================ +`; + exports[`inline-await.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] diff --git a/tests/js/async/exponentiation.js b/tests/js/async/exponentiation.js new file mode 100644 index 000000000..1125a4216 --- /dev/null +++ b/tests/js/async/exponentiation.js @@ -0,0 +1 @@ +async () => (await 5) ** 6; diff --git a/tests/misc/errors/js/async-await/__snapshots__/jsfmt.spec.js.snap b/tests/misc/errors/js/async-await/__snapshots__/jsfmt.spec.js.snap index fe42d6ef0..867b0924d 100644 --- a/tests/misc/errors/js/async-await/__snapshots__/jsfmt.spec.js.snap +++ b/tests/misc/errors/js/async-await/__snapshots__/jsfmt.spec.js.snap @@ -258,6 +258,12 @@ exports[`snippet: #6 [babel] format 1`] = ` | ^" `; +exports[`snippet: #6 [babel] format 2`] = ` +"Illegal expression. Wrap left hand side or entire exponentiation in parentheses. (1:23) +> 1 | f = async () => await 5 ** 6; + | ^" +`; + exports[`snippet: #6 [espree] format 1`] = ` "Unexpected token { (1:20) > 1 | C = class { static { function f(await) {} } }; @@ -282,6 +288,12 @@ exports[`snippet: #7 [babel] format 1`] = ` | ^" `; +exports[`snippet: #7 [babel] format 2`] = ` +"Illegal expression. Wrap left hand side or entire exponentiation in parentheses. (1:23) +> 1 | f = async () => await -5 ** 6; + | ^" +`; + exports[`snippet: #7 [espree] format 1`] = ` "Unexpected token { (1:20) > 1 | C = class { static { function f(x = await) {} } }; @@ -323,3 +335,99 @@ exports[`snippet: #8 [meriyah] format 1`] = ` > 1 | C = class { static { function f({ [await]: x }) {} } }; | ^" `; + +exports[`snippet: #9 [babel] format 1`] = ` +"Unexpected token (1:27) +> 1 | f = async (a) => await a! ** 6; + | ^" +`; + +exports[`snippet: #9 [espree] format 1`] = ` +"Unexpected token ! (1:25) +> 1 | f = async (a) => await a! ** 6; + | ^" +`; + +exports[`snippet: #9 [flow] format 1`] = ` +"Unexpected token \`!\`, expected the end of an expression statement (\`;\`) (1:25) +> 1 | f = async (a) => await a! ** 6; + | ^" +`; + +exports[`snippet: #9 [meriyah] format 1`] = ` +"[1:25]: Unexpected token: '!' (1:25) +> 1 | f = async (a) => await a! ** 6; + | ^" +`; + +exports[`snippet: #10 [babel] format 1`] = ` +"Unexpected token (1:16) +> 1 | f = (a) => +a! ** 6; + | ^" +`; + +exports[`snippet: #10 [espree] format 1`] = ` +"Unexpected token ! (1:14) +> 1 | f = (a) => +a! ** 6; + | ^" +`; + +exports[`snippet: #10 [flow] format 1`] = ` +"Unexpected token \`!\`, expected the end of an expression statement (\`;\`) (1:14) +> 1 | f = (a) => +a! ** 6; + | ^" +`; + +exports[`snippet: #10 [meriyah] format 1`] = ` +"[1:14]: Unexpected token: '!' (1:14) +> 1 | f = (a) => +a! ** 6; + | ^" +`; + +exports[`snippet: #11 [babel] format 1`] = ` +"Unexpected token, expected \\",\\" (1:22) +> 1 | async (a) => (await a!) ** 6; + | ^" +`; + +exports[`snippet: #11 [espree] format 1`] = ` +"Unexpected token ! (1:22) +> 1 | async (a) => (await a!) ** 6; + | ^" +`; + +exports[`snippet: #11 [flow] format 1`] = ` +"Unexpected token \`!\`, expected the token \`)\` (1:22) +> 1 | async (a) => (await a!) ** 6; + | ^" +`; + +exports[`snippet: #11 [meriyah] format 1`] = ` +"[1:22]: Expected ')' (1:22) +> 1 | async (a) => (await a!) ** 6; + | ^" +`; + +exports[`snippet: #12 [babel] format 1`] = ` +"Illegal expression. Wrap left hand side or entire exponentiation in parentheses. (1:3) +> 1 | (-+5 ** 6); + | ^" +`; + +exports[`snippet: #12 [espree] format 1`] = ` +"Unexpected token ** (1:6) +> 1 | (-+5 ** 6); + | ^" +`; + +exports[`snippet: #12 [flow] format 1`] = ` +"Invalid left-hand side in exponentiation expression (1:2) +> 1 | (-+5 ** 6); + | ^^^" +`; + +exports[`snippet: #12 [meriyah] format 1`] = ` +"[1:7]: Unary expressions as the left operand of an exponentiation expression must be disambiguated with parentheses (1:7) +> 1 | (-+5 ** 6); + | ^" +`; diff --git a/tests/misc/errors/js/async-await/jsfmt.spec.js b/tests/misc/errors/js/async-await/jsfmt.spec.js index 7f51a7d4c..c6f50dc49 100644 --- a/tests/misc/errors/js/async-await/jsfmt.spec.js +++ b/tests/misc/errors/js/async-await/jsfmt.spec.js @@ -21,6 +21,10 @@ run_spec( "C = class { static { function f(await) {} } };", "C = class { static { function f(x = await) {} } };", "C = class { static { function f({ [await]: x }) {} } };", + "f = async (a) => await a! ** 6;", + "f = (a) => +a! ** 6;", + "async (a) => (await a!) ** 6;", + "(-+5 ** 6);", // TODO: Test these two edge case // outdent` // export class C { @@ -61,6 +65,10 @@ run_spec( (foo); } `, + // `espree` and `meriyah` didn't throw + "f = async () => await 5 ** 6;", + // `espree` didn't throw + "f = async () => await -5 ** 6;", ], }, ["babel"] diff --git a/yarn.lock b/yarn.lock index 79aec208e..eb0a2157a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -313,12 +313,7 @@ chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/parser@7.13.11": - version "7.13.11" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.13.11.tgz#f93ebfc99d21c1772afbbaa153f47e7ce2f50b88" - integrity sha512-PhuoqeHoO9fc4ffMEVk4qb/w/s2iOSWohvbHxLtxui0eBg3Lg5gN1U8wp1V1u61hOWkPQJJyJzGH6Y+grwkq8Q== - -"@babel/parser@^7.1.0", "@babel/parser@^7.12.13", "@babel/parser@^7.13.13": +"@babel/parser@7.13.13", "@babel/parser@^7.1.0", "@babel/parser@^7.12.13", "@babel/parser@^7.13.13": version "7.13.13" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.13.13.tgz#42f03862f4aed50461e543270916b47dd501f0df" integrity sha512-OhsyMrqygfk5v8HmWwOzlYjJrtLaFhF34MrfG/Z73DgYCI6ojNUTUp2TYbtnjo8PegeJp12eamsNettCQjKjVw==