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

Assignment of array/object literals #2410

Closed
Tracked by #2403
MichaReiser opened this issue Apr 13, 2022 · 1 comment · Fixed by #2698
Closed
Tracked by #2403

Assignment of array/object literals #2410

MichaReiser opened this issue Apr 13, 2022 · 1 comment · Fixed by #2698
Assignees
Labels
A-Formatter Area: formatter I-Easy Implementation: easy task, usually a good fit for new contributors

Comments

@MichaReiser
Copy link
Contributor

MichaReiser commented Apr 13, 2022

Prettier keeps the opening [ or { on the same line as the assignment expression when it exceeds the line width. Rome formats the whole array or object literal on a new line.

Input

bifornCringerMoshedPerplex.bifornCringerMoshedPerplexSawder.arrayOfNumbers = [1, 2, 3, 4, 5];
bifornCringerMoshedPerplex.bifornCringerMoshedPerplexSawder.arrayOfNumbers = { a: 10 };
bifornCringerMoshedPerplex.bifornCringerMoshedPerplexSawder = bifornCringerMoshedPerplex.bifornCringerMoshedPerplexSawderArrayNumbes = { a: 10 };

Prettier

bifornCringerMoshedPerplex.bifornCringerMoshedPerplexSawder.arrayOfNumbers = [
	1, 2, 3, 4, 5,
];
bifornCringerMoshedPerplex.bifornCringerMoshedPerplexSawder.arrayOfNumbers = {
	a: 10,
};
bifornCringerMoshedPerplex.bifornCringerMoshedPerplexSawder =
	bifornCringerMoshedPerplex.bifornCringerMoshedPerplexSawderArrayNumbes = {
		a: 10,
	};

Rome

bifornCringerMoshedPerplex.bifornCringerMoshedPerplexSawder.arrayOfNumbers =
	[1, 2, 3, 4, 5];
bifornCringerMoshedPerplex.bifornCringerMoshedPerplexSawder.arrayOfNumbers =
	{ a: 10 };
bifornCringerMoshedPerplex.bifornCringerMoshedPerplexSawder =
	bifornCringerMoshedPerplex.bifornCringerMoshedPerplexSawderArrayNumbes =
		{ a: 10 };

Expected

Rome's formatting should match Prettiers formatting by putting the opening { and [ tokens on the same line as the = token.

Playground

@MichaReiser MichaReiser added the A-Formatter Area: formatter label Apr 13, 2022
@ematipico ematipico added the I-Easy Implementation: easy task, usually a good fit for new contributors label May 5, 2022
@ematipico
Copy link
Contributor

I will look after this

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Formatter Area: formatter I-Easy Implementation: easy task, usually a good fit for new contributors
Projects
Status: Done
2 participants