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

🐛 In JSX, some spaces are removed #3211

Closed
1 task done
pradel opened this issue Sep 13, 2022 · 4 comments · Fixed by #3251
Closed
1 task done

🐛 In JSX, some spaces are removed #3211

pradel opened this issue Sep 13, 2022 · 4 comments · Fixed by #3251
Assignees
Labels
A-Formatter Area: formatter S-Bug: confirmed Status: report has been confirmed as a valid bug
Milestone

Comments

@pradel
Copy link
Contributor

pradel commented Sep 13, 2022

Environment information

Hey all, I was trying Rome in one of my codebases using prettier and found an issue with spaces in JSX expressions.
As you can see in this playground, a space right after the `a` tag is removed, prettier is behaving normally and keeping that space.

[Playground link](https://play.rome.tools/?code=const+a+%3D+%3Cdiv%3E%0A++Text+%3Ca+data-very-long-prop-breakline-rome-playground+data-other%3E%0A++++++++++++++some+link%0A++++++++++++%3C%2Fa%3E%7B%27+%27%7D%0A++++++++++++%7C+some+other+text%2C%7B%27+%27%7D%0A++++++++++++++++%3C%2Fdiv%3E&lineWidth=80&indentStyle=tab&quoteStyle=double&quoteProperties=as-needed&indentWidth=2&sourceType=module&typescript=false&jsx=false#YwBvAG4AcwB0ACAAYQAgAD0AIAA8AGQAaQB2AD4ACgAgACAAVABlAHgAdAAgADwAYQAgAGQAYQB0AGEALQB2AGUAcgB5AC0AbABvAG4AZwAtAHAAcgBvAHAALQBiAHIAZQBhAGsAbABpAG4AZQAtAHIAbwBtAGUALQBwAGwAYQB5AGcAcgBvAHUAbgBkACAAZABhAHQAYQAtAG8AdABoAGUAcgA+AAoAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAHMAbwBtAGUAIABsAGkAbgBrAAoAIAAgACAAIAAgACAAIAAgACAAIAAgACAAPAAvAGEAPgB7ACcAIAAnAH0ACgAgACAAIAAgACAAIAAgACAAIAAgACAAIAB8ACAAcwBvAG0AZQAgAG8AdABoAGUAcgAgAHQAZQB4AHQALAB7ACcAIAAnAH0ACgAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgADwALwBkAGkAdgA+AA==)

What happened?

  1. Open the playground
  2. Check the Rome result and compare it to prettier to see the missing space after the a tag.

Expected result

That the space is preserver like this

const a = (
	<div>
		Text <a data-very-long-prop-breakline-rome-playground data-other>
			some link
		</a>{" "}
		| some other text,{" "}
	</div>
);

Code of Conduct

  • I agree to follow Rome's Code of Conduct
@pradel pradel added the S-To triage Status: user report of a possible bug that needs to be triaged label Sep 13, 2022
@MichaReiser MichaReiser 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 Sep 13, 2022
@denbezrukov
Copy link
Contributor

@MichaReiser
If you don't mind I can try to look this issue (=

@ematipico ematipico added this to the 0.10.0 milestone Sep 14, 2022
@MichaReiser
Copy link
Contributor

MichaReiser commented Sep 14, 2022

@MichaReiser If you don't mind I can try to look this issue (=

That would be awesome. Be warned, our JSX formatting differs from Prettier in thus that we use custom intermediate representation for children before turning it into format elements.

Let me know if it would help to get some explanations. I then try to remember how it works :P

@denbezrukov
Copy link
Contributor

denbezrukov commented Sep 17, 2022

Need to check also:
case1
case2
case3

denbezrukov added a commit to denbezrukov/tools that referenced this issue Sep 19, 2022
denbezrukov added a commit to denbezrukov/tools that referenced this issue Sep 22, 2022
denbezrukov added a commit to denbezrukov/tools that referenced this issue Sep 22, 2022
denbezrukov added a commit to denbezrukov/tools that referenced this issue Sep 28, 2022
denbezrukov added a commit to denbezrukov/tools that referenced this issue Sep 28, 2022
denbezrukov added a commit to denbezrukov/tools that referenced this issue Sep 28, 2022
denbezrukov added a commit to denbezrukov/tools that referenced this issue Sep 28, 2022
denbezrukov added a commit to denbezrukov/tools that referenced this issue Sep 28, 2022
denbezrukov added a commit to denbezrukov/tools that referenced this issue Sep 29, 2022
denbezrukov added a commit to denbezrukov/tools that referenced this issue Sep 30, 2022
denbezrukov added a commit to denbezrukov/tools that referenced this issue Sep 30, 2022
denbezrukov added a commit to denbezrukov/tools that referenced this issue Oct 1, 2022
@github-actions
Copy link

github-actions bot commented Oct 3, 2022

This issue is stale because it has been open 14 days with no activity.

@ematipico ematipico removed the S-Stale label Oct 3, 2022
@ematipico ematipico modified the milestones: 0.10.0, 10.0.0 Oct 3, 2022
denbezrukov added a commit to denbezrukov/tools that referenced this issue Oct 6, 2022
denbezrukov added a commit to denbezrukov/tools that referenced this issue Oct 10, 2022
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
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants