--- source: crates/biome_formatter_test/src/snapshot_builder.rs info: js/binary-expressions/tuple-and-record.js --- # Input ```js foo = foo || [ // comment a, ] foo = foo || #[ // comment a, ] foo = foo || { // comment a, } foo = foo || #{ // comment a, } ``` # Prettier differences ```diff --- Prettier +++ Biome @@ -3,7 +3,8 @@ a, ]; -foo = foo || #[ +foo = foo || #; +[ // comment a, ]; @@ -13,7 +14,8 @@ a, }; -foo = foo || #{ +foo = foo || #; +{ // comment a, -}; +} ``` # Output ```js foo = foo || [ // comment a, ]; foo = foo || #; [ // comment a, ]; foo = foo || { // comment a, }; foo = foo || #; { // comment a, } ``` # Errors ``` tuple-and-record.js:6:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an identifier but instead found '['. 4 │ ] 5 │ > 6 │ foo = foo || #[ │ ^ 7 │ // comment 8 │ a, i Expected an identifier here. 4 │ ] 5 │ > 6 │ foo = foo || #[ │ ^ 7 │ // comment 8 │ a, tuple-and-record.js:6:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression 4 │ ] 5 │ > 6 │ foo = foo || #[ │ ^ 7 │ // comment 8 │ a, tuple-and-record.js:6:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none 4 │ ] 5 │ > 6 │ foo = foo || #[ │ ^ 7 │ // comment 8 │ a, i An explicit or implicit semicolon is expected here... 4 │ ] 5 │ > 6 │ foo = foo || #[ │ ^ 7 │ // comment 8 │ a, i ...Which is required to end this statement 4 │ ] 5 │ > 6 │ foo = foo || #[ │ ^^^^^^^^^^^^^^^ 7 │ // comment 8 │ a, tuple-and-record.js:16:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an identifier but instead found '{'. 14 │ } 15 │ > 16 │ foo = foo || #{ │ ^ 17 │ // comment 18 │ a, i Expected an identifier here. 14 │ } 15 │ > 16 │ foo = foo || #{ │ ^ 17 │ // comment 18 │ a, tuple-and-record.js:16:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression 14 │ } 15 │ > 16 │ foo = foo || #{ │ ^ 17 │ // comment 18 │ a, tuple-and-record.js:16:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none 14 │ } 15 │ > 16 │ foo = foo || #{ │ ^ 17 │ // comment 18 │ a, i An explicit or implicit semicolon is expected here... 14 │ } 15 │ > 16 │ foo = foo || #{ │ ^ 17 │ // comment 18 │ a, i ...Which is required to end this statement 14 │ } 15 │ > 16 │ foo = foo || #{ │ ^^^^^^^^^^^^^^^ 17 │ // comment 18 │ a, tuple-and-record.js:19:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found '}'. 17 │ // comment 18 │ a, > 19 │ } │ ^ 20 │ i Expected an expression here. 17 │ // comment 18 │ a, > 19 │ } │ ^ 20 │ ```