--- source: crates/rome_formatter_test/src/snapshot_builder.rs info: test_file: js/module-blocks/comments.js --- # Input ```js const m = /*A1*/ module /*A2*/ { /*A3*/ /*A4*/ export const foo = "foo"; export { foo }; /*A5*/ /*A6*/ }/*A7*/;/*A8*/ const m2 = module/* B1 */{ /* B2 */ }; ``` # Prettier differences ```diff --- Prettier +++ Rome @@ -1,12 +1,13 @@ -const m = /*A1*/ module { - /*A2*/ /*A3*/ +const m = /*A1*/ module; /*A2*/ +{ + /*A3*/ /*A4*/ export const foo = "foo"; export { foo }; /*A5*/ /*A6*/ -}; /*A7*/ /*A8*/ +} /*A7*/ /*A8*/ -const m2 = module { - /* B1 */ +const m2 = module; /* B1 */ +{ /* B2 */ -}; +} ``` # Output ```js const m = /*A1*/ module; /*A2*/ { /*A3*/ /*A4*/ export const foo = "foo"; export { foo }; /*A5*/ /*A6*/ } /*A7*/ /*A8*/ const m2 = module; /* B1 */ { /* B2 */ } ``` # Errors ``` comments.js:1:32 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none > 1 │ const m = /*A1*/ module /*A2*/ { /*A3*/ │ ^ 2 │ /*A4*/ 3 │ export const foo = "foo"; i An explicit or implicit semicolon is expected here... > 1 │ const m = /*A1*/ module /*A2*/ { /*A3*/ │ ^ 2 │ /*A4*/ 3 │ export const foo = "foo"; i ...Which is required to end this statement > 1 │ const m = /*A1*/ module /*A2*/ { /*A3*/ │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2 │ /*A4*/ 3 │ export const foo = "foo"; comments.js:3:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of an export declaration not at the top level 1 │ const m = /*A1*/ module /*A2*/ { /*A3*/ 2 │ /*A4*/ > 3 │ export const foo = "foo"; │ ^^^^^^^^^^^^^^^^^^^^^^^^^ 4 │ export { foo }; /*A5*/ 5 │ /*A6*/ i move this declaration to the top level comments.js:4:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of an export declaration not at the top level 2 │ /*A4*/ 3 │ export const foo = "foo"; > 4 │ export { foo }; /*A5*/ │ ^^^^^^^^^^^^^^^ 5 │ /*A6*/ 6 │ }/*A7*/;/*A8*/ i move this declaration to the top level comments.js:8:26 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none 6 │ }/*A7*/;/*A8*/ 7 │ > 8 │ const m2 = module/* B1 */{ │ ^ 9 │ /* B2 */ 10 │ }; i An explicit or implicit semicolon is expected here... 6 │ }/*A7*/;/*A8*/ 7 │ > 8 │ const m2 = module/* B1 */{ │ ^ 9 │ /* B2 */ 10 │ }; i ...Which is required to end this statement 6 │ }/*A7*/;/*A8*/ 7 │ > 8 │ const m2 = module/* B1 */{ │ ^^^^^^^^^^^^^^^^^^^^^^^^^ 9 │ /* B2 */ 10 │ }; ```