Skip to content

Commit b0201e0

Browse files
authored
fix: JSON modules disable named exports (#13031)
1 parent fde0b49 commit b0201e0

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -177,27 +177,27 @@ assert({ type: "json" });
177177
`;
178178

179179
exports[`re-export.js [acorn] format 1`] = `
180-
"Unexpected token (1:33)
181-
> 1 | export { foo2 } from "foo.json" assert { type: "json" };
182-
| ^
180+
"Unexpected token (1:44)
181+
> 1 | export { default as foo2 } from "foo.json" assert { type: "json" };
182+
| ^
183183
2 | export * from "foo.json" assert { type: "json" };
184184
3 | export * as foo3 from "foo.json" assert { type: "json" };
185185
4 |"
186186
`;
187187

188188
exports[`re-export.js [espree] format 1`] = `
189-
"Unexpected token assert (1:33)
190-
> 1 | export { foo2 } from "foo.json" assert { type: "json" };
191-
| ^
189+
"Unexpected token assert (1:44)
190+
> 1 | export { default as foo2 } from "foo.json" assert { type: "json" };
191+
| ^
192192
2 | export * from "foo.json" assert { type: "json" };
193193
3 | export * as foo3 from "foo.json" assert { type: "json" };
194194
4 |"
195195
`;
196196

197197
exports[`re-export.js [meriyah] format 1`] = `
198-
"Unexpected token: 'identifier' (1:38)
199-
> 1 | export { foo2 } from "foo.json" assert { type: "json" };
200-
| ^
198+
"Unexpected token: 'identifier' (1:49)
199+
> 1 | export { default as foo2 } from "foo.json" assert { type: "json" };
200+
| ^
201201
2 | export * from "foo.json" assert { type: "json" };
202202
3 | export * as foo3 from "foo.json" assert { type: "json" };
203203
4 |"
@@ -209,12 +209,12 @@ parsers: ["babel", "typescript"]
209209
printWidth: 80
210210
| printWidth
211211
=====================================input======================================
212-
export { foo2 } from "foo.json" assert { type: "json" };
212+
export { default as foo2 } from "foo.json" assert { type: "json" };
213213
export * from "foo.json" assert { type: "json" };
214214
export * as foo3 from "foo.json" assert { type: "json" };
215215
216216
=====================================output=====================================
217-
export { foo2 } from "foo.json" assert { type: "json" };
217+
export { default as foo2 } from "foo.json" assert { type: "json" };
218218
export * from "foo.json" assert { type: "json" };
219219
export * as foo3 from "foo.json" assert { type: "json" };
220220
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export { foo2 } from "foo.json" assert { type: "json" };
1+
export { default as foo2 } from "foo.json" assert { type: "json" };
22
export * from "foo.json" assert { type: "json" };
33
export * as foo3 from "foo.json" assert { type: "json" };

0 commit comments

Comments
 (0)