Skip to content
This repository was archived by the owner on Aug 31, 2023. It is now read-only.
This repository was archived by the owner on Aug 31, 2023. It is now read-only.

🐛 Incorrect formatting of type on new line with index signature  #4165

@hwallis93

Description

@hwallis93

Environment information

N/A - Reproduced this in the playground

What happened?

Formatting a type that is split over multiple lines and has an index signature behaves strangely. It moves the closing } onto its own line. Formatting for a second time then moves the top { onto its own line too

Before any formatting - https://docs.rome.tools/playground/?code=dAB5AHAAZQAgAEwAbwBuAGcATgBhAG0AZQBIAGUAcgBlAFQAbwBDAGEAdQBzAGUATABpAG4AZQBCAHIAZQBhAGsAXwBhAGEAYQBhAGEAYQBhAGEAYQBhAGEAYQBhAGEAYQBhAGEAYQBhAGEAYQBhAGEAYQBhAGEAYQBhAGEAYQBhAGEAYQBhAGEAYQBhAGEAYQBhAGEAYQBhAGEAYQBhAGEAIAA9AHsAIABbAEsAIABpAG4AIAAiAGYAbwBvACIAXQA6ACAAcwB0AHIAaQBuAGcAfQA7AAoA

After 1 round of formatting - https://docs.rome.tools/playground/?code=dAB5AHAAZQAgAEwAbwBuAGcATgBhAG0AZQBIAGUAcgBlAFQAbwBDAGEAdQBzAGUATABpAG4AZQBCAHIAZQBhAGsAXwBhAGEAYQBhAGEAYQBhAGEAYQBhAGEAYQBhAGEAYQBhAGEAYQBhAGEAYQBhAGEAYQBhAGEAYQBhAGEAYQBhAGEAYQBhAGEAYQBhAGEAYQBhAGEAYQBhAGEAYQBhAGEAIAA9AAoACQB7ACAAWwBLACAAaQBuACAAIgBmAG8AbwAiAF0AOgAgAHMAdAByAGkAbgBnAAoACQB9ADsACgA%3D

Expected result

I would expect 2 things:

  • That formatting a second time shouldn't change the code
  • That formatting would match Prettier, neither the first nor second formats above match Prettier

Code of Conduct

  • I agree to follow Rome's Code of Conduct

Metadata

Metadata

Assignees

Labels

A-FormatterArea: formatterS-Bug: confirmedStatus: report has been confirmed as a valid bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions