Skip to content

Commit 361fd2d

Browse files
thorn0lydell
authored andcommitted
fix printing bigint literals parsed by Flow (prettier#6883)
1 parent ea70396 commit 361fd2d

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/language-js/printer-estree.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,8 +1625,8 @@ function printPathNoParens(path, options, print, args) {
16251625
case "NumericLiteral": // Babel 6 Literal split
16261626
return printNumber(n.extra.raw);
16271627
case "BigIntLiteral":
1628-
// babel: n.extra.raw, typescript: n.raw
1629-
return (n.extra ? n.extra.raw : n.raw).toLowerCase();
1628+
// babel: n.extra.raw, typescript: n.raw, flow: n.bigint
1629+
return (n.bigint || (n.extra ? n.extra.raw : n.raw)).toLowerCase();
16301630
case "BooleanLiteral": // Babel 6 Literal split
16311631
case "StringLiteral": // Babel 6 Literal split
16321632
case "Literal": {

tests/big-int/__snapshots__/jsfmt.spec.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
exports[`literal.js 1`] = `
44
====================================options=====================================
5-
parsers: ["babel", "typescript"]
5+
parsers: ["babel", "typescript", "flow"]
66
printWidth: 80
77
| printWidth
88
=====================================input======================================

tests/big-int/jsfmt.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
run_spec(__dirname, ["babel", "typescript"]);
1+
run_spec(__dirname, ["babel", "typescript", "flow"]);

0 commit comments

Comments
 (0)