Skip to content

Commit

Permalink
Build(deps): Bump @babel/parser from 7.10.3 to 7.10.4 (#8688)
Browse files Browse the repository at this point in the history
* Build(deps): Bump @babel/parser from 7.10.3 to 7.10.4

Bumps [@babel/parser](https://github.com/babel/babel/tree/HEAD/packages/babel-parser) from 7.10.3 to 7.10.4.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.10.4/packages/babel-parser)

Signed-off-by: dependabot[bot] <support@github.com>

* Add `delete obj?.#x.a` test

* Add new `tuple` and `record` tests. Fix old test

* Fix test

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: fisker <lionkay@gmail.com>
  • Loading branch information
dependabot[bot] and fisker committed Jul 2, 2020
1 parent a0e2efc commit 35ac6f0
Show file tree
Hide file tree
Showing 11 changed files with 125 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"dependencies": {
"@angular/compiler": "10.0.2",
"@babel/code-frame": "7.10.4",
"@babel/parser": "7.10.3",
"@babel/parser": "7.10.4",
"@glimmer/syntax": "0.54.0",
"@iarna/toml": "2.2.5",
"@typescript-eslint/typescript-estree": "3.5.0",
Expand Down
13 changes: 12 additions & 1 deletion src/language-js/parser-babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,18 @@ function createParse(parseMethod, ...pluginCombinations) {
babelOptions({ sourceType, extraPlugins })
)
);
} catch (error) {
} catch (_error) {
// babel@7.10.4 throws `undefined`, when parsing
// ```js
// alert(
// <!-- comment
// 'hello world'
// )
// ```
// #8688

const error = _error || { message: "Unknown error" };

throw createError(
// babel error prints (l:c) with cols that are zero indexed
// so we need our custom error
Expand Down
37 changes: 37 additions & 0 deletions tests/js/classes-private-fields/__snapshots__/jsfmt.spec.js.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,42 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`optional-chaining.js - {"semi":false} format 1`] = `
====================================options=====================================
parsers: ["babel"]
printWidth: 80
semi: false
| printWidth
=====================================input======================================
// https://github.com/babel/babel/pull/11669
delete obj?.#x.a
=====================================output=====================================
// https://github.com/babel/babel/pull/11669
delete obj?.#x.a
================================================================================
`;

exports[`optional-chaining.js format 1`] = `
====================================options=====================================
parsers: ["babel"]
printWidth: 80
| printWidth
=====================================input======================================
// https://github.com/babel/babel/pull/11669
delete obj?.#x.a
=====================================output=====================================
// https://github.com/babel/babel/pull/11669
delete obj?.#x.a;
================================================================================
`;

exports[`private_fields.js - {"semi":false} format 1`] = `
====================================options=====================================
parsers: ["babel"]
Expand Down
3 changes: 3 additions & 0 deletions tests/js/classes-private-fields/optional-chaining.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// https://github.com/babel/babel/pull/11669

delete obj?.#x.a
30 changes: 30 additions & 0 deletions tests/js/record/__snapshots__/jsfmt.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,36 @@ assert(rest.c === 3);
================================================================================
`;

exports[`invalid-record-method.js format 1`] = `
====================================options=====================================
parsers: ["babel"]
printWidth: 80
| printWidth
=====================================input======================================
// Invalid, https://github.com/babel/babel/pull/11652/
#{
a() {},
async b() {},
get c() {},
set d(_) {},
*e() {}
}
=====================================output=====================================
// Invalid, https://github.com/babel/babel/pull/11652/
#{
a() {},
async b() {},
get c() {},
set d(_) {},
*e() {},
};
================================================================================
`;

exports[`record.js format 1`] = `
====================================options=====================================
parsers: ["babel"]
Expand Down
9 changes: 9 additions & 0 deletions tests/js/record/invalid-record-method.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Invalid, https://github.com/babel/babel/pull/11652/

#{
a() {},
async b() {},
get c() {},
set d(_) {},
*e() {}
}
28 changes: 28 additions & 0 deletions tests/js/tuple/__snapshots__/jsfmt.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,20 @@ assert(rest[1] === 3);
================================================================================
`;

exports[`invalid-tuple-holes.js format 1`] = `
====================================options=====================================
parsers: ["babel"]
printWidth: 80
| printWidth
=====================================input======================================
#[,]
=====================================output=====================================
#[,];
================================================================================
`;

exports[`syntax.js format 1`] = `
====================================options=====================================
parsers: ["babel"]
Expand Down Expand Up @@ -93,3 +107,17 @@ assert(tuple5 === #[2, 2, 3, 4]);
================================================================================
`;

exports[`tuple-trailing-comma.js format 1`] = `
====================================options=====================================
parsers: ["babel"]
printWidth: 80
| printWidth
=====================================input======================================
#[1,]
=====================================output=====================================
#[1];
================================================================================
`;
1 change: 1 addition & 0 deletions tests/js/tuple/invalid-tuple-holes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#[,]
1 change: 1 addition & 0 deletions tests/js/tuple/tuple-trailing-comma.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#[1,]
8 changes: 2 additions & 6 deletions tests/misc/errors/js/__snapshots__/jsfmt.spec.js.snap
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`html-like-comments.js error test 1`] = `
"Unexpected token (3:1)
"Unknown error (0:0)
1 | // Only support HTML-like comment in HTML
2 | alert(
> 3 | <!-- comment
| ^
4 | 'hello world'
5 | )
6 | "
3 | <!-- comment"
`;

exports[`module-attributes.js error test 1`] = `
Expand Down
7 changes: 1 addition & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,7 @@
chalk "^2.0.0"
js-tokens "^4.0.0"

"@babel/parser@7.10.3":
version "7.10.3"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.10.3.tgz#7e71d892b0d6e7d04a1af4c3c79d72c1f10f5315"
integrity sha512-oJtNJCMFdIMwXGmx+KxuaD7i3b8uS7TTFYW/FNG2BT8m+fmGHoiPYoH0Pe3gya07WuFmM5FCDIr1x0irkD/hyA==

"@babel/parser@^7.1.0", "@babel/parser@^7.10.4", "@babel/parser@^7.7.5":
"@babel/parser@7.10.4", "@babel/parser@^7.1.0", "@babel/parser@^7.10.4", "@babel/parser@^7.7.5":
version "7.10.4"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.10.4.tgz#9eedf27e1998d87739fb5028a5120557c06a1a64"
integrity sha512-8jHII4hf+YVDsskTF6WuMB3X4Eh+PsUkC2ljq22so5rHvH+T8BzyL94VOdyFLNR8tBSVXOTbNHOKpR4TfRxVtA==
Expand Down

0 comments on commit 35ac6f0

Please sign in to comment.