--- source: crates/rome_formatter_test/src/snapshot_builder.rs info: test_file: js/sloppy-mode/function-declaration-in-while.js --- # Input ```js while (false) function foo(){} ``` # Prettier differences ```diff --- Prettier +++ Rome @@ -1 +1 @@ -while (false) function foo() {} +while (false) function foo(){} ``` # Output ```js while (false) function foo(){} ``` # Errors ``` function-declaration-in-while.js:1:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × In strict mode code, functions can only be declared at top level or inside a block > 1 │ while (false) function foo(){} │ ^^^^^^^^^^^^^^^^ 2 │ i wrap the function in a block statement ```