Skip to content

Commit 9dd761a

Browse files
authored
fix: JSON modules disable named exports (#13035)
1 parent b0201e0 commit 9dd761a

4 files changed

Lines changed: 16 additions & 16 deletions

File tree

tests/format/js/import-assertions/bracket-spacing/__snapshots__/jsfmt.spec.js.snap

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,23 +69,23 @@ export * as bar from "bar.json";
6969
`;
7070

7171
exports[`re-export.js - {"bracketSpacing":false} [acorn] format 1`] = `
72-
"Unexpected token (1:33)
73-
> 1 | export { foo2 } from "foo.json" assert { type: "json" };
74-
| ^
72+
"Unexpected token (1:44)
73+
> 1 | export { default as foo2 } from "foo.json" assert { type: "json" };
74+
| ^
7575
2 |"
7676
`;
7777

7878
exports[`re-export.js - {"bracketSpacing":false} [espree] format 1`] = `
79-
"Unexpected token assert (1:33)
80-
> 1 | export { foo2 } from "foo.json" assert { type: "json" };
81-
| ^
79+
"Unexpected token assert (1:44)
80+
> 1 | export { default as foo2 } from "foo.json" assert { type: "json" };
81+
| ^
8282
2 |"
8383
`;
8484

8585
exports[`re-export.js - {"bracketSpacing":false} [meriyah] format 1`] = `
86-
"Unexpected token: 'identifier' (1:38)
87-
> 1 | export { foo2 } from "foo.json" assert { type: "json" };
88-
| ^
86+
"Unexpected token: 'identifier' (1:49)
87+
> 1 | export { default as foo2 } from "foo.json" assert { type: "json" };
88+
| ^
8989
2 |"
9090
`;
9191

@@ -96,10 +96,10 @@ parsers: ["babel"]
9696
printWidth: 80
9797
| printWidth
9898
=====================================input======================================
99-
export { foo2 } from "foo.json" assert { type: "json" };
99+
export { default as foo2 } from "foo.json" assert { type: "json" };
100100
101101
=====================================output=====================================
102-
export {foo2} from "foo.json" assert {type: "json"};
102+
export {default as foo2} from "foo.json" assert {type: "json"};
103103
104104
================================================================================
105105
`;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export { foo2 } from "foo.json" assert { type: "json" };
1+
export { default as foo2 } from "foo.json" assert { type: "json" };

tests/format/misc/errors/js/__snapshots__/jsfmt.spec.js.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ exports[`html-like-comments.js [babel] format 1`] = `
1212
`;
1313

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export { foo } assert { type: "json" };
1+
export { default as foo } assert { type: "json" };

0 commit comments

Comments
 (0)