Skip to content

Commit 1df4c17

Browse files
thorn0lydell
authored andcommitted
update Babel to 7.7.0 and enable error recovery (prettier#6816)
1 parent 9d2f5e0 commit 1df4c17

9 files changed

Lines changed: 291 additions & 214 deletions

File tree

cspell.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@
9191
"editorconfig",
9292
"ekkhus",
9393
"elektronik",
94-
"ENOENT",
9594
"Eneman",
95+
"ENOENT",
9696
"ericsakmar",
9797
"Ericsburgh",
9898
"Esben",
@@ -393,6 +393,7 @@
393393
"<!-- prettier-ignore -->\\n(`{3,})\\w*\\n[\\s\\S]+?\\1",
394394
"\\[@\\w+?\\]",
395395
"\\[`\\w+`\\]",
396-
"ve+r+y+(long\\w+)?"
396+
"ve{2,}r{2,}y",
397+
"ve+r+y+long\\w*"
397398
]
398-
}
399+
}

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"dependencies": {
1717
"@angular/compiler": "8.2.13",
1818
"@babel/code-frame": "7.5.5",
19-
"@babel/parser": "7.6.4",
19+
"@babel/parser": "7.7.0",
2020
"@glimmer/syntax": "0.41.0",
2121
"@iarna/toml": "2.2.3",
2222
"@typescript-eslint/typescript-estree": "2.6.0",
@@ -74,8 +74,8 @@
7474
"yaml-unist-parser": "1.1.1"
7575
},
7676
"devDependencies": {
77-
"@babel/core": "7.6.3",
78-
"@babel/preset-env": "7.6.3",
77+
"@babel/core": "7.7.0",
78+
"@babel/preset-env": "7.7.1",
7979
"@rollup/plugin-alias": "2.2.0",
8080
"@rollup/plugin-replace": "2.2.0",
8181
"babel-loader": "8.0.6",

src/language-js/clean.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ function clean(ast, newObj, parent) {
1010
"extra",
1111
"start",
1212
"end",
13-
"flags"
13+
"flags",
14+
"errors"
1415
].forEach(name => {
1516
delete newObj[name];
1617
});

src/language-js/parser-babylon.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ function babelOptions(extraOptions, extraPlugins) {
1717
allowReturnOutsideFunction: true,
1818
allowSuperOutsideMethod: true,
1919
allowUndeclaredExports: true,
20+
errorRecovery: true,
2021
plugins: [
2122
"jsx",
2223
"doExpressions",

src/language-js/printer-estree-json.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ function clean(node, newNode /*, parent*/) {
6464
delete newNode.extra;
6565
delete newNode.loc;
6666
delete newNode.comments;
67+
delete newNode.errors;
6768

6869
if (node.type === "Identifier") {
6970
return { type: "StringLiteral", value: node.name };
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`duplicate_bindings.js 1`] = `
4+
====================================options=====================================
5+
parsers: ["babel"]
6+
printWidth: 80
7+
| printWidth
8+
=====================================input======================================
9+
class A{} class A{}
10+
11+
=====================================output=====================================
12+
class A {}
13+
class A {}
14+
15+
================================================================================
16+
`;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
class A{} class A{}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
run_spec(__dirname, ["babel"]);

0 commit comments

Comments
 (0)