--- source: crates/biome_formatter_test/src/snapshot_builder.rs info: js/babel-plugins/partial-application.js --- # Input ```js // https://babeljs.io/docs/en/babel-plugin-proposal-partial-application function add(x, y) { return x + y; } const addOne = add(1, ?); // apply from the left addOne(2); // 3 const addTen = add(?, 10); // apply from the right addTen(2); // 12 let newScore = player.score |> add(7, ?) |> clamp(0, 100, ?); // shallow stack, the pipe to `clamp` is the same frame as the pipe to `add`. f(x, ?) // partial application from left f(?, x) // partial application from right f(?, x, ?) // partial application for any arg o.f(x, ?) // partial application from left o.f(?, x) // partial application from right o.f(?, x, ?) // partial application for any arg super.f(?) // partial application allowed for call on |SuperProperty| ``` # Prettier differences ```diff --- Prettier +++ Biome @@ -10,7 +10,9 @@ const addTen = add(?, 10); // apply from the right addTen(2); // 12 -let newScore = player.score |> add(7, ?) |> clamp(0, 100, ?); // shallow stack, the pipe to `clamp` is the same frame as the pipe to `add`. +let newScore = player.score + |> add(7, ?) + |> clamp(0, 100, ?); // shallow stack, the pipe to `clamp` is the same frame as the pipe to `add`. f(x, ?); // partial application from left f(?, x); // partial application from right ``` # Output ```js // https://babeljs.io/docs/en/babel-plugin-proposal-partial-application function add(x, y) { return x + y; } const addOne = add(1, ?); // apply from the left addOne(2); // 3 const addTen = add(?, 10); // apply from the right addTen(2); // 12 let newScore = player.score |> add(7, ?) |> clamp(0, 100, ?); // shallow stack, the pipe to `clamp` is the same frame as the pipe to `add`. f(x, ?); // partial application from left f(?, x); // partial application from right f(?, x, ?); // partial application for any arg o.f(x, ?); // partial application from left o.f(?, x); // partial application from right o.f(?, x, ?); // partial application for any arg super.f(?); // partial application allowed for call on |SuperProperty| ``` # Errors ``` partial-application.js:5:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found '?'. 3 │ function add(x, y) { return x + y; } 4 │ > 5 │ const addOne = add(1, ?); // apply from the left │ ^ 6 │ addOne(2); // 3 7 │ i Expected an expression here. 3 │ function add(x, y) { return x + y; } 4 │ > 5 │ const addOne = add(1, ?); // apply from the left │ ^ 6 │ addOne(2); // 3 7 │ partial-application.js:8:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found '?, 10'. 6 │ addOne(2); // 3 7 │ > 8 │ const addTen = add(?, 10); // apply from the right │ ^^^^^ 9 │ addTen(2); // 12 10 │ i Expected an expression here. 6 │ addOne(2); // 3 7 │ > 8 │ const addTen = add(?, 10); // apply from the right │ ^^^^^ 9 │ addTen(2); // 12 10 │ partial-application.js:12:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression for the left hand side of the `>` operator. 11 │ let newScore = player.score > 12 │ |> add(7, ?) │ ^ 13 │ |> clamp(0, 100, ?); // shallow stack, the pipe to `clamp` is the same frame as the pipe to `add`. 14 │ i This operator requires a left hand side value partial-application.js:12:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found '?'. 11 │ let newScore = player.score > 12 │ |> add(7, ?) │ ^ 13 │ |> clamp(0, 100, ?); // shallow stack, the pipe to `clamp` is the same frame as the pipe to `add`. 14 │ i Expected an expression here. 11 │ let newScore = player.score > 12 │ |> add(7, ?) │ ^ 13 │ |> clamp(0, 100, ?); // shallow stack, the pipe to `clamp` is the same frame as the pipe to `add`. 14 │ partial-application.js:13:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression for the left hand side of the `>` operator. 11 │ let newScore = player.score 12 │ |> add(7, ?) > 13 │ |> clamp(0, 100, ?); // shallow stack, the pipe to `clamp` is the same frame as the pipe to `add`. │ ^ 14 │ 15 │ f(x, ?) // partial application from left i This operator requires a left hand side value partial-application.js:13:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found '?'. 11 │ let newScore = player.score 12 │ |> add(7, ?) > 13 │ |> clamp(0, 100, ?); // shallow stack, the pipe to `clamp` is the same frame as the pipe to `add`. │ ^ 14 │ 15 │ f(x, ?) // partial application from left i Expected an expression here. 11 │ let newScore = player.score 12 │ |> add(7, ?) > 13 │ |> clamp(0, 100, ?); // shallow stack, the pipe to `clamp` is the same frame as the pipe to `add`. │ ^ 14 │ 15 │ f(x, ?) // partial application from left partial-application.js:15:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found '?'. 13 │ |> clamp(0, 100, ?); // shallow stack, the pipe to `clamp` is the same frame as the pipe to `add`. 14 │ > 15 │ f(x, ?) // partial application from left │ ^ 16 │ f(?, x) // partial application from right 17 │ f(?, x, ?) // partial application for any arg i Expected an expression here. 13 │ |> clamp(0, 100, ?); // shallow stack, the pipe to `clamp` is the same frame as the pipe to `add`. 14 │ > 15 │ f(x, ?) // partial application from left │ ^ 16 │ f(?, x) // partial application from right 17 │ f(?, x, ?) // partial application for any arg partial-application.js:16:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found '?, x'. 15 │ f(x, ?) // partial application from left > 16 │ f(?, x) // partial application from right │ ^^^^ 17 │ f(?, x, ?) // partial application for any arg 18 │ o.f(x, ?) // partial application from left i Expected an expression here. 15 │ f(x, ?) // partial application from left > 16 │ f(?, x) // partial application from right │ ^^^^ 17 │ f(?, x, ?) // partial application for any arg 18 │ o.f(x, ?) // partial application from left partial-application.js:17:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found '?, x, ?'. 15 │ f(x, ?) // partial application from left 16 │ f(?, x) // partial application from right > 17 │ f(?, x, ?) // partial application for any arg │ ^^^^^^^ 18 │ o.f(x, ?) // partial application from left 19 │ o.f(?, x) // partial application from right i Expected an expression here. 15 │ f(x, ?) // partial application from left 16 │ f(?, x) // partial application from right > 17 │ f(?, x, ?) // partial application for any arg │ ^^^^^^^ 18 │ o.f(x, ?) // partial application from left 19 │ o.f(?, x) // partial application from right partial-application.js:18:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found '?'. 16 │ f(?, x) // partial application from right 17 │ f(?, x, ?) // partial application for any arg > 18 │ o.f(x, ?) // partial application from left │ ^ 19 │ o.f(?, x) // partial application from right 20 │ o.f(?, x, ?) // partial application for any arg i Expected an expression here. 16 │ f(?, x) // partial application from right 17 │ f(?, x, ?) // partial application for any arg > 18 │ o.f(x, ?) // partial application from left │ ^ 19 │ o.f(?, x) // partial application from right 20 │ o.f(?, x, ?) // partial application for any arg partial-application.js:19:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found '?, x'. 17 │ f(?, x, ?) // partial application for any arg 18 │ o.f(x, ?) // partial application from left > 19 │ o.f(?, x) // partial application from right │ ^^^^ 20 │ o.f(?, x, ?) // partial application for any arg 21 │ super.f(?) // partial application allowed for call on |SuperProperty| i Expected an expression here. 17 │ f(?, x, ?) // partial application for any arg 18 │ o.f(x, ?) // partial application from left > 19 │ o.f(?, x) // partial application from right │ ^^^^ 20 │ o.f(?, x, ?) // partial application for any arg 21 │ super.f(?) // partial application allowed for call on |SuperProperty| partial-application.js:20:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found '?, x, ?'. 18 │ o.f(x, ?) // partial application from left 19 │ o.f(?, x) // partial application from right > 20 │ o.f(?, x, ?) // partial application for any arg │ ^^^^^^^ 21 │ super.f(?) // partial application allowed for call on |SuperProperty| 22 │ i Expected an expression here. 18 │ o.f(x, ?) // partial application from left 19 │ o.f(?, x) // partial application from right > 20 │ o.f(?, x, ?) // partial application for any arg │ ^^^^^^^ 21 │ super.f(?) // partial application allowed for call on |SuperProperty| 22 │ partial-application.js:21:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found '?'. 19 │ o.f(?, x) // partial application from right 20 │ o.f(?, x, ?) // partial application for any arg > 21 │ super.f(?) // partial application allowed for call on |SuperProperty| │ ^ 22 │ i Expected an expression here. 19 │ o.f(?, x) // partial application from right 20 │ o.f(?, x, ?) // partial application for any arg > 21 │ super.f(?) // partial application allowed for call on |SuperProperty| │ ^ 22 │ ``` # Lines exceeding max width of 80 characters ``` 15: |> clamp(0, 100, ?); // shallow stack, the pipe to `clamp` is the same frame as the pipe to `add`. ```