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

update Babel to 7.7.0 and enable error recovery #6816

Merged
merged 1 commit into from Nov 5, 2019
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
7 changes: 4 additions & 3 deletions cspell.json
Expand Up @@ -91,8 +91,8 @@
"editorconfig",
"ekkhus",
"elektronik",
"ENOENT",
"Eneman",
"ENOENT",
"ericsakmar",
"Ericsburgh",
"Esben",
Expand Down Expand Up @@ -393,6 +393,7 @@
"<!-- prettier-ignore -->\\n(`{3,})\\w*\\n[\\s\\S]+?\\1",
"\\[@\\w+?\\]",
"\\[`\\w+`\\]",
"ve+r+y+(long\\w+)?"
"ve{2,}r{2,}y",
"ve+r+y+long\\w*"
]
}
}
lydell marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -16,7 +16,7 @@
"dependencies": {
"@angular/compiler": "8.2.13",
"@babel/code-frame": "7.5.5",
"@babel/parser": "7.6.4",
"@babel/parser": "7.7.0",
"@glimmer/syntax": "0.41.0",
"@iarna/toml": "2.2.3",
"@typescript-eslint/typescript-estree": "2.6.0",
Expand Down Expand Up @@ -74,8 +74,8 @@
"yaml-unist-parser": "1.1.1"
},
"devDependencies": {
"@babel/core": "7.6.3",
"@babel/preset-env": "7.6.3",
"@babel/core": "7.7.0",
"@babel/preset-env": "7.7.1",
"@rollup/plugin-alias": "2.2.0",
"@rollup/plugin-replace": "2.2.0",
"babel-loader": "8.0.6",
Expand Down
3 changes: 2 additions & 1 deletion src/language-js/clean.js
Expand Up @@ -10,7 +10,8 @@ function clean(ast, newObj, parent) {
"extra",
"start",
"end",
"flags"
"flags",
"errors"
].forEach(name => {
delete newObj[name];
});
Expand Down
1 change: 1 addition & 0 deletions src/language-js/parser-babylon.js
Expand Up @@ -17,6 +17,7 @@ function babelOptions(extraOptions, extraPlugins) {
allowReturnOutsideFunction: true,
allowSuperOutsideMethod: true,
allowUndeclaredExports: true,
errorRecovery: true,
lydell marked this conversation as resolved.
Show resolved Hide resolved
plugins: [
"jsx",
"doExpressions",
Expand Down
1 change: 1 addition & 0 deletions src/language-js/printer-estree-json.js
Expand Up @@ -64,6 +64,7 @@ function clean(node, newNode /*, parent*/) {
delete newNode.extra;
delete newNode.loc;
delete newNode.comments;
delete newNode.errors;

if (node.type === "Identifier") {
return { type: "StringLiteral", value: node.name };
Expand Down
16 changes: 16 additions & 0 deletions tests/js_invalid_code/__snapshots__/jsfmt.spec.js.snap
@@ -0,0 +1,16 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`duplicate_bindings.js 1`] = `
====================================options=====================================
parsers: ["babel"]
printWidth: 80
| printWidth
=====================================input======================================
class A{} class A{}

=====================================output=====================================
class A {}
class A {}

================================================================================
`;
1 change: 1 addition & 0 deletions tests/js_invalid_code/duplicate_bindings.js
@@ -0,0 +1 @@
class A{} class A{}
1 change: 1 addition & 0 deletions tests/js_invalid_code/jsfmt.spec.js
@@ -0,0 +1 @@
run_spec(__dirname, ["babel"]);