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

Object literal & type line break after { #2408

Closed
Tracked by #2403
MichaReiser opened this issue Apr 13, 2022 · 0 comments · Fixed by #2458
Closed
Tracked by #2403

Object literal & type line break after { #2408

MichaReiser opened this issue Apr 13, 2022 · 0 comments · Fixed by #2458
Assignees
Labels
A-Formatter Area: formatter good first issue Good for newcomers I-Normal Implementation: normal understanding of the tool and awareness

Comments

@MichaReiser
Copy link
Contributor

Rome formatter tries to fit all object or object literal type members on a single line. Prettier does the same, but formats each member on a single line if the object literal or object literal type has a line break between the opening { and the first member.

Input

// Print each member on a new line if there's a line break between `{` and the first member
({ 
a: "test",
b: "test" });


type Test = { 
a: string };

// Fit on single line if line break is after first member
type Test2 = { a: string
};

({ a: "test",
b: "test" });

Prettier

// Print each member on a new line if there's a line break between `{` and the first member
({
	a: "test",
	b: "test",
});

type Test = {
	a: string;
};

// Fit on single line if line break is after first member
type Test2 = { a: string };

Rome

// Print each member on a new line if there's a line break between `{` and the first member
({ a: "test", b: "test" });

type Test = { a: string };

// Fit on single line if line break is after first member
type Test2 = { a: string };

({ a: "test", b: "test" });

Expected

Rome to match Prettiers formatting. Format object literal and object-literal type members each on their own line if the first member has a leading line break.

@MichaReiser MichaReiser added good first issue Good for newcomers A-Formatter Area: formatter labels Apr 13, 2022
@ematipico ematipico added the I-Normal Implementation: normal understanding of the tool and awareness label May 5, 2022
@MichaReiser MichaReiser moved this to Done in Rome 2022 May 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Formatter Area: formatter good first issue Good for newcomers I-Normal Implementation: normal understanding of the tool and awareness
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants