From a7707b395b865ef9dd807b17ae4350c59cce2998 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Mon, 20 Jun 2022 16:14:51 -0400 Subject: [PATCH] fix: JSON modules disable named exports --- .../__snapshots__/jsfmt.spec.js.snap | 22 +++++++++---------- .../format/js/import-assertions/re-export.js | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/format/js/import-assertions/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/import-assertions/__snapshots__/jsfmt.spec.js.snap index df7c210729b6..d6ea22a64305 100644 --- a/tests/format/js/import-assertions/__snapshots__/jsfmt.spec.js.snap +++ b/tests/format/js/import-assertions/__snapshots__/jsfmt.spec.js.snap @@ -177,27 +177,27 @@ assert({ type: "json" }); `; exports[`re-export.js [acorn] format 1`] = ` -"Unexpected token (1:33) -> 1 | export { foo2 } from "foo.json" assert { type: "json" }; - | ^ +"Unexpected token (1:44) +> 1 | export { default as foo2 } from "foo.json" assert { type: "json" }; + | ^ 2 | export * from "foo.json" assert { type: "json" }; 3 | export * as foo3 from "foo.json" assert { type: "json" }; 4 |" `; exports[`re-export.js [espree] format 1`] = ` -"Unexpected token assert (1:33) -> 1 | export { foo2 } from "foo.json" assert { type: "json" }; - | ^ +"Unexpected token assert (1:44) +> 1 | export { default as foo2 } from "foo.json" assert { type: "json" }; + | ^ 2 | export * from "foo.json" assert { type: "json" }; 3 | export * as foo3 from "foo.json" assert { type: "json" }; 4 |" `; exports[`re-export.js [meriyah] format 1`] = ` -"Unexpected token: 'identifier' (1:38) -> 1 | export { foo2 } from "foo.json" assert { type: "json" }; - | ^ +"Unexpected token: 'identifier' (1:49) +> 1 | export { default as foo2 } from "foo.json" assert { type: "json" }; + | ^ 2 | export * from "foo.json" assert { type: "json" }; 3 | export * as foo3 from "foo.json" assert { type: "json" }; 4 |" @@ -209,12 +209,12 @@ parsers: ["babel", "typescript"] printWidth: 80 | printWidth =====================================input====================================== -export { foo2 } from "foo.json" assert { type: "json" }; +export { default as foo2 } from "foo.json" assert { type: "json" }; export * from "foo.json" assert { type: "json" }; export * as foo3 from "foo.json" assert { type: "json" }; =====================================output===================================== -export { foo2 } from "foo.json" assert { type: "json" }; +export { default as foo2 } from "foo.json" assert { type: "json" }; export * from "foo.json" assert { type: "json" }; export * as foo3 from "foo.json" assert { type: "json" }; diff --git a/tests/format/js/import-assertions/re-export.js b/tests/format/js/import-assertions/re-export.js index dd9640ec20ad..f7f9640a8687 100644 --- a/tests/format/js/import-assertions/re-export.js +++ b/tests/format/js/import-assertions/re-export.js @@ -1,3 +1,3 @@ -export { foo2 } from "foo.json" assert { type: "json" }; +export { default as foo2 } from "foo.json" assert { type: "json" }; export * from "foo.json" assert { type: "json" }; export * as foo3 from "foo.json" assert { type: "json" };