Skip to content

formatter: Diff with Prettier on nested sequence expressions #18972

Description

@StyleShit

Input

const nestedSequenceAbomination =
  (1,
  2,
  (1,
  2,
  3,
  (1, 2, 3, 4),
  (1, 2, 3, 4, 5, [1, 2, 3, 4, 5, 6].filter(x => x % 2 == 0)))['0']);

Config

{}

Oxfmt output

Oxfmt version: latest

const nestedSequenceAbomination =
  (1,
  2,
  (1,
  2,
  3,
  1, 2, 3, 4,
  1, 2, 3, 4, 5, [1, 2, 3, 4, 5, 6].filter((x) => x % 2 == 0))["0"]);

Oxfmt playground link

https://playground.oxc.rs/?code=const+nestedSequenceAbomination+%3D%0A++%281%2C%0A++2%2C%0A++%281%2C%0A++2%2C%0A++3%2C%0A++%281%2C+2%2C+3%2C+4%29%2C%0A++%281%2C+2%2C+3%2C+4%2C+5%2C+%5B1%2C+2%2C+3%2C+4%2C+5%2C+6%5D.filter%28x+%3D%3E+x+%25+2+%3D%3D+0%29%29%29%5B%270%27%5D%29%3B&t=formatter&formatterPanels=output%2Cprettier

Prettier output

Prettier version: 3.8.1

const nestedSequenceAbomination =
  (1,
  2,
  (1,
  2,
  3,
  (1, 2, 3, 4),
  (1, 2, 3, 4, 5, [1, 2, 3, 4, 5, 6].filter((x) => x % 2 == 0)))["0"]);

Prettier playground link

No response

Additional notes

Taken from:

https://github.com/typescript-eslint/typescript-eslint/blob/843bd98f467c2aae39b5a110a136cca52e1d660e/packages/eslint-plugin/tests/rules/prefer-find.test.ts#L512-L519

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Fields

    Priority

    None yet

    Effort

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions