--- source: crates/rome_formatter_test/src/snapshot_builder.rs info: test_file: js/partial-application/test.js --- # Input ```js const addOne = add(1, ?); // apply from the left addOne(2); // 3 const addTen = add(?, 10); // apply from the right addTen(2); // 12 // with pipeline let newScore = player.score |> add(7, ?) |> clamp(0, 100, ?); // shallow stack, the pipe to `clamp` is the same frame as the pipe to `add`. ``` # Prettier differences ```diff --- Prettier +++ Rome @@ -5,4 +5,6 @@ addTen(2); // 12 // with pipeline -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`. ``` # Output ```js const addOne = add(1, ?); // apply from the left addOne(2); // 3 const addTen = add(?, 10); // apply from the right addTen(2); // 12 // with pipeline let newScore = player.score |> add(7, ?) |> clamp(0, 100, ?); // shallow stack, the pipe to `clamp` is the same frame as the pipe to `add`. ``` # Errors ``` test.js:1:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected an expression but instead found '?' > 1 │ const addOne = add(1, ?); // apply from the left │ ^ 2 │ addOne(2); // 3 3 │ i Expected an expression here > 1 │ const addOne = add(1, ?); // apply from the left │ ^ 2 │ addOne(2); // 3 3 │ test.js:4:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected an expression but instead found '?, 10' 2 │ addOne(2); // 3 3 │ > 4 │ const addTen = add(?, 10); // apply from the right │ ^^^^^ 5 │ addTen(2); // 12 6 │ i Expected an expression here 2 │ addOne(2); // 3 3 │ > 4 │ const addTen = add(?, 10); // apply from the right │ ^^^^^ 5 │ addTen(2); // 12 6 │ test.js:9:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression for the left hand side of the `>` operator. 7 │ // with pipeline 8 │ let newScore = player.score > 9 │ |> add(7, ?) │ ^ 10 │ |> clamp(0, 100, ?); // shallow stack, the pipe to `clamp` is the same frame as the pipe to `add`. 11 │ i This operator requires a left hand side value test.js:9:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected an expression but instead found '?' 7 │ // with pipeline 8 │ let newScore = player.score > 9 │ |> add(7, ?) │ ^ 10 │ |> clamp(0, 100, ?); // shallow stack, the pipe to `clamp` is the same frame as the pipe to `add`. 11 │ i Expected an expression here 7 │ // with pipeline 8 │ let newScore = player.score > 9 │ |> add(7, ?) │ ^ 10 │ |> clamp(0, 100, ?); // shallow stack, the pipe to `clamp` is the same frame as the pipe to `add`. 11 │ test.js:10:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression for the left hand side of the `>` operator. 8 │ let newScore = player.score 9 │ |> add(7, ?) > 10 │ |> clamp(0, 100, ?); // shallow stack, the pipe to `clamp` is the same frame as the pipe to `add`. │ ^ 11 │ i This operator requires a left hand side value test.js:10:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected an expression but instead found '?' 8 │ let newScore = player.score 9 │ |> add(7, ?) > 10 │ |> clamp(0, 100, ?); // shallow stack, the pipe to `clamp` is the same frame as the pipe to `add`. │ ^ 11 │ i Expected an expression here 8 │ let newScore = player.score 9 │ |> add(7, ?) > 10 │ |> clamp(0, 100, ?); // shallow stack, the pipe to `clamp` is the same frame as the pipe to `add`. │ ^ 11 │ ``` # Lines exceeding max width of 80 characters ``` 10: |> clamp(0, 100, ?); // shallow stack, the pipe to `clamp` is the same frame as the pipe to `add`. ```