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