Skip to content

Commit

Permalink
fix: JSON modules disable named exports (prettier#13035)
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung authored and medikoo committed Jan 4, 2024
1 parent b86d64d commit 0f8ae2a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
Expand Up @@ -69,23 +69,23 @@ export * as bar from "bar.json";
`;

exports[`re-export.js - {"bracketSpacing":false} [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 |"
`;

exports[`re-export.js - {"bracketSpacing":false} [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 |"
`;

exports[`re-export.js - {"bracketSpacing":false} [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 |"
`;

Expand All @@ -96,10 +96,10 @@ parsers: ["babel"]
printWidth: 80
| printWidth
=====================================input======================================
export { foo2 } from "foo.json" assert { type: "json" };
export { default as foo2 } 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"};
================================================================================
`;
Expand Down
@@ -1 +1 @@
export { foo2 } from "foo.json" assert { type: "json" };
export { default as foo2 } from "foo.json" assert { type: "json" };
6 changes: 3 additions & 3 deletions tests/format/misc/errors/js/__snapshots__/jsfmt.spec.js.snap
Expand Up @@ -12,9 +12,9 @@ exports[`html-like-comments.js [babel] format 1`] = `
`;

exports[`import-assertions-for-export-without-from.js [babel] format 1`] = `
"Missing semicolon. (1:15)
> 1 | export { foo } assert { type: "json" };
| ^
"Missing semicolon. (1:26)
> 1 | export { default as foo } assert { type: "json" };
| ^
2 |"
`;

Expand Down
@@ -1 +1 @@
export { foo } assert { type: "json" };
export { default as foo } assert { type: "json" };

0 comments on commit 0f8ae2a

Please sign in to comment.