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

🐛 Incorrect formatting of interfaces declared inside functions #4253

Closed
1 task done
public opened this issue Mar 3, 2023 · 0 comments · Fixed by #4256
Closed
1 task done

🐛 Incorrect formatting of interfaces declared inside functions #4253

public opened this issue Mar 3, 2023 · 0 comments · Fixed by #4256
Assignees
Labels
A-Formatter Area: formatter S-Bug: confirmed Status: report has been confirmed as a valid bug

Comments

@public
Copy link

public commented Mar 3, 2023

Environment information

CLI:
  Version:              11.0.0
  Color support:        true

Platform:
  CPU Architecture:     aarch64
  OS:                   macos

Environment:
  ROME_LOG_DIR:         unset
  NO_COLOR:             unset
  TERM:                 "xterm-256color"

Rome Configuration:
  Status:               loaded
  Formatter disabled:   false
  Linter disabled:      true

Workspace:
  Open Documents:       0

Discovering running Rome servers...

Incompatible Rome Server: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

ℹ Rage discovered this running server using an incompatible version of Rome.

Server:
  Version:              <=10.0.0

What happened?

When given code like this:

x.y(() => {
  interface Wrong {
    a: {
      b: string;
    };
    p: {
      q: string;
    }
  }
});

The formatter misses new lines between the interface members:

x.y(() => {
  interface Wrong {
    a: {
      b: string;
    }; p: {
      q: string;
    }
  }
});

https://docs.rome.tools/playground/?indentStyle=space&quoteStyle=single&trailingComma=es5&code=ZgAoACgAKQAgAD0APgAgAHsACgAgACAAaQBuAHQAZQByAGYAYQBjAGUAIABXAHIAbwBuAGcAIAB7AAoAIAAgACAAIABhADoAIAB7AAoAIAAgACAAIAAgACAAYgA6ACAAcwB0AHIAaQBuAGcAOwAKACAAIAAgACAAfQA7AAoAIAAgACAAIABwADoAIAB7ACAALwAvACAAVwBoAHkAIABpAHMAIABwACAAbgBvAHQAIABvAG4AIABpAHQAJwBzACAAbwB3AG4AIABsAGkAbgBlAD8ACgAgACAAIAAgACAAIABxADoAIABzAHQAcgBpAG4AZwA7AAoAIAAgACAAIAB9AAoAIAAgAH0ACgB9ACkAOwA%3D&jsx=false

Everything works fine if you have an interface in an arrow function but once you put pass it directly to a function call it starts missing the newlines.

Expected result

Prettier produces the output I'd expect:

x.y(() => {
  interface Wrong {
    a: {
      b: string;
    };
    p: {
      q: string;
    };
  }
});

Code of Conduct

  • I agree to follow Rome's Code of Conduct
@public public added the S-To triage Status: user report of a possible bug that needs to be triaged label Mar 3, 2023
@nissy-dev nissy-dev added S-Bug: confirmed Status: report has been confirmed as a valid bug A-Formatter Area: formatter and removed S-To triage Status: user report of a possible bug that needs to be triaged labels Mar 4, 2023
@denbezrukov denbezrukov self-assigned this Mar 4, 2023
denbezrukov added a commit to denbezrukov/tools that referenced this issue Mar 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Formatter Area: formatter S-Bug: confirmed Status: report has been confirmed as a valid bug
Projects
None yet
3 participants