--- source: crates/biome_formatter_test/src/snapshot_builder.rs info: js/babel-plugins/pipeline-operator-hack.js --- # Input ```js // https://babeljs.io/docs/en/babel-plugin-proposal-pipeline-operator // https://github.com/js-choi/proposal-hack-pipes return list |> take(prefix.length, %) |> equals(%, prefix); // (The % token isn't final; it might instead be @ or ? or #.) ``` # Prettier differences ```diff --- Prettier +++ Biome @@ -1,6 +1,8 @@ // https://babeljs.io/docs/en/babel-plugin-proposal-pipeline-operator // https://github.com/js-choi/proposal-hack-pipes -return list |> take(prefix.length, %) |> equals(%, prefix); +return list + |> take(prefix.length, %) + |> equals(%, prefix); // (The % token isn't final; it might instead be @ or ? or #.) ``` # Output ```js // https://babeljs.io/docs/en/babel-plugin-proposal-pipeline-operator // https://github.com/js-choi/proposal-hack-pipes return list |> take(prefix.length, %) |> equals(%, prefix); // (The % token isn't final; it might instead be @ or ? or #.) ``` # Errors ``` pipeline-operator-hack.js:5:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression for the left hand side of the `>` operator. 4 │ return list > 5 │ |> take(prefix.length, %) │ ^ 6 │ |> equals(%, prefix); 7 │ i This operator requires a left hand side value pipeline-operator-hack.js:5:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression for the left hand side of the `%` operator. 4 │ return list > 5 │ |> take(prefix.length, %) │ ^ 6 │ |> equals(%, prefix); 7 │ i This operator requires a left hand side value pipeline-operator-hack.js:5:26 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found ')'. 4 │ return list > 5 │ |> take(prefix.length, %) │ ^ 6 │ |> equals(%, prefix); 7 │ i Expected an expression here. 4 │ return list > 5 │ |> take(prefix.length, %) │ ^ 6 │ |> equals(%, prefix); 7 │ pipeline-operator-hack.js:6:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression for the left hand side of the `>` operator. 4 │ return list 5 │ |> take(prefix.length, %) > 6 │ |> equals(%, prefix); │ ^ 7 │ 8 │ // (The % token isn't final; it might instead be @ or ? or #.) i This operator requires a left hand side value pipeline-operator-hack.js:6:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression for the left hand side of the `%` operator. 4 │ return list 5 │ |> take(prefix.length, %) > 6 │ |> equals(%, prefix); │ ^ 7 │ 8 │ // (The % token isn't final; it might instead be @ or ? or #.) i This operator requires a left hand side value pipeline-operator-hack.js:6:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found ','. 4 │ return list 5 │ |> take(prefix.length, %) > 6 │ |> equals(%, prefix); │ ^ 7 │ 8 │ // (The % token isn't final; it might instead be @ or ? or #.) i Expected an expression here. 4 │ return list 5 │ |> take(prefix.length, %) > 6 │ |> equals(%, prefix); │ ^ 7 │ 8 │ // (The % token isn't final; it might instead be @ or ? or #.) pipeline-operator-hack.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal return statement outside of a function 2 │ // https://github.com/js-choi/proposal-hack-pipes 3 │ > 4 │ return list │ ^^^^^^^^^^^ > 5 │ |> take(prefix.length, %) > 6 │ |> equals(%, prefix); │ ^^^^^^^^^^^^^^^^^^^^^ 7 │ 8 │ // (The % token isn't final; it might instead be @ or ? or #.) ```