--- source: crates/biome_formatter_test/src/snapshot_builder.rs info: js/sloppy-mode/function-declaration-in-while.js --- # Input ```js while (false) function foo(){} ``` # Prettier differences ```diff --- Prettier +++ Biome @@ -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 non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if or labelled statement > 1 │ while (false) function foo(){} │ ^^^^^^^^^^^^^^^^ 2 │ i wrap the function in a block statement ```