Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"dependencies": {
"@angular/compiler": "8.2.13",
"@babel/code-frame": "7.5.5",
"@babel/parser": "7.7.2",
"@babel/parser": "7.7.3",
"@glimmer/syntax": "0.41.0",
"@iarna/toml": "2.2.3",
"@typescript-eslint/typescript-estree": "2.6.1",
Expand Down
4 changes: 2 additions & 2 deletions src/language-js/printer-estree.js
Original file line number Diff line number Diff line change
Expand Up @@ -1625,8 +1625,8 @@ function printPathNoParens(path, options, print, args) {
case "NumericLiteral": // Babel 6 Literal split
return printNumber(n.extra.raw);
case "BigIntLiteral":
// babel: n.extra.raw, typescript: n.raw
return (n.extra ? n.extra.raw : n.raw).toLowerCase();
// babel: n.extra.raw, typescript: n.raw, flow: n.bigint
return (n.bigint || (n.extra ? n.extra.raw : n.raw)).toLowerCase();
case "BooleanLiteral": // Babel 6 Literal split
case "StringLiteral": // Babel 6 Literal split
case "Literal": {
Expand Down
2 changes: 1 addition & 1 deletion tests/big-int/__snapshots__/jsfmt.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`literal.js 1`] = `
====================================options=====================================
parsers: ["babel", "typescript"]
parsers: ["babel", "typescript", "flow"]
printWidth: 80
| printWidth
=====================================input======================================
Expand Down
2 changes: 1 addition & 1 deletion tests/big-int/jsfmt.spec.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
run_spec(__dirname, ["babel", "typescript"]);
run_spec(__dirname, ["babel", "typescript", "flow"]);
7 changes: 7 additions & 0 deletions tests_integration/__tests__/__snapshots__/format.js.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`'Adjacent JSX' error should not be swallowed by Babel's error recovery 1`] = `
"Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>? (2:1)
1 | <a></a>
> 2 | <b></b>
| ^"
`;

exports[`html parser should handle CRLF correctly 1`] = `"\\"<!--\\\\r\\\\n test\\\\r\\\\n test\\\\r\\\\n-->\\\\r\\\\n\\""`;

exports[`markdown parser should handle CRLF correctly 1`] = `"\\"\`\`\`\\\\r\\\\n\\\\r\\\\n\\\\r\\\\n\`\`\`\\\\r\\\\n\\""`;
Expand Down
5 changes: 5 additions & 0 deletions tests_integration/__tests__/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,8 @@ test("should work with foo plugin instance", () => {
`"\\"{\\\\\\"tabWidth\\\\\\":8,\\\\\\"bracketSpacing\\\\\\":false}\\""`
);
});

test("'Adjacent JSX' error should not be swallowed by Babel's error recovery", () => {
const input = "<a></a>\n<b></b>";
expect(() => prettier.format(input)).toThrowErrorMatchingSnapshot();
});
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -378,10 +378,10 @@
esutils "^2.0.2"
js-tokens "^4.0.0"

"@babel/parser@7.7.2", "@babel/parser@^7.1.2", "@babel/parser@^7.1.5", "@babel/parser@^7.4.5", "@babel/parser@^7.5.5", "@babel/parser@^7.7.0", "@babel/parser@^7.7.2":
version "7.7.2"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.7.2.tgz#ea8334dc77416bfd9473eb470fd00d8245b3943b"
integrity sha512-DDaR5e0g4ZTb9aP7cpSZLkACEBdoLGwJDWgHtBhrGX7Q1RjhdoMOfexICj5cqTAtpowjGQWfcvfnQG7G2kAB5w==
"@babel/parser@7.7.3", "@babel/parser@^7.1.2", "@babel/parser@^7.1.5", "@babel/parser@^7.4.5", "@babel/parser@^7.5.5", "@babel/parser@^7.7.0", "@babel/parser@^7.7.2":
version "7.7.3"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.7.3.tgz#5fad457c2529de476a248f75b0f090b3060af043"
integrity sha512-bqv+iCo9i+uLVbI0ILzKkvMorqxouI+GbV13ivcARXn9NNEabi2IEz912IgNpT/60BNXac5dgcfjb94NjsF33A==

"@babel/plugin-proposal-async-generator-functions@^7.7.0":
version "7.7.0"
Expand Down