Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃摑 Unusual formatter output when a JSX node is followed by a text node starting with a single-character-word #1885

Open
1 task done
simon-paris opened this issue Feb 22, 2024 · 4 comments
Labels
A-Formatter Area: formatter L-JavaScript Language: JavaScript and super languages S-Needs discussion Status: needs a discussion to understand criteria

Comments

@simon-paris
Copy link

Environment information

CLI:
  Version:                      1.5.3
  Color support:                true

Platform:
  CPU Architecture:             aarch64
  OS:                           macos

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v20.8.1"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "yarn/1.22.18"

Biome Configuration:
  Status:                       Loaded successfully
  Formatter disabled:           true
  Linter disabled:              false
  Organize imports disabled:    true
  VCS disabled:                 false

Workspace:
  Open Documents:               0

Configuration

{}

Playground link

https://biomejs.dev/playground/?code=aQBtAHAAbwByAHQAIABSAGUAYQBjAHQAIABmAHIAbwBtACAAIgByAGUAYQBjAHQAIgA7AAoACgBlAHgAcABvAHIAdAAgAGYAdQBuAGMAdABpAG8AbgAgAEEAcABwACgAKQAgAHsACgAJAC8ALwAgAFQAaABpAHMAIABpAHMAIABmAG8AcgBtAGEAdAB0AGUAZAAgAGQAaQBmAGYAZQByAGUAbgB0AGwAeQAgAGkAbgAgAHAAcgBlAHQAdABpAGUAcgAgAGEAbgBkACAAYgBpAG8AbQBlACwAIABhAG4AZAAgAEkAIAB0AGgAaQBuAGsAIABiAG8AdABoACAAYQByAGUAIAB3AHIAbwBuAGcALgAKAAkALwAvACAASQB0ACAAaABhAHAAcABlAG4AcwAgAG8AbgBsAHkAIAB3AGgAZQBuACAAdABoAGUAIABmAGkAcgBzAHQAIAB3AG8AcgBkACAAbwBmACAAdABoAGUAIAB0AGUAeAB0ACAAbgBvAGQAZQAgAGgAYQBzACAAbABlAG4AZwB0AGgAPQAxAC4AIABJACAAdABoAGkAbgBrACAAdABoAGUAIABjAG8AcgByAGUAYwB0ACAAbwB1AHQAcAB1AHQAIABzAGgAbwB1AGwAZAAgAGIAZQAgAHQAbwAgAGwAZQBhAHYAZQAgAHQAaABpAHMAIAB1AG4AYwBoAGEAbgBnAGUAZAAsACAAdwBoAGkAYwBoACAAaQBzACAAdwBoAGEAdAAgAGgAYQBwAHAAZQBuAHMAIABpAGYAIAB0AGgAZQAgAGYAaQByAHMAdAAgAHcAbwByAGQAIABpAHMAIABuAG8AdAAgAGwAZQBuAGcAdABoAD0AMQAuAAoACQByAGUAdAB1AHIAbgAgACgACgAJAAkAPAA%2BAAoACQAJAAkAPABzAHAAYQBuACAALwA%2BAAoAIAAgACAAIAAgACAAIAAgACAAIAAgACAAegAgAGoAcwB4ACAAbgBvAGQAZQBzAAoACQAJAAkAPABzAHAAYQBuACAALwA%2BAAoAIAAgACAAIAAgACAAIAAgACAAIAAgACAAegAgAGYAbwBsAGwAbwB3AGUAZAAgAGIAeQAgAHQAZQB4AHQAIABuAG8AZABlAHMACgAJAAkACQA8AHMAcABhAG4AIAAvAD4ACgAgACAAIAAgACAAIAAgACAAIAAgACAAIAB6ACAAdwBoAGkAYwBoACAAcwB0AGEAcgB0ACAAdwBpAHQAaAAgAGEAIABzAGkAbgBnAGwAZQAgAGMAaABhAHIAYQBjAHQAZQByAAoACQAJADwALwA%2BAAoACQApADsACgB9AAoA

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@Conaclos Conaclos added A-Formatter Area: formatter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug labels Feb 22, 2024
@fireairforce
Copy link
Contributor

It seems that prettier allows any single character word to hug the following or previous line. This is a normal scene, please refer to pr: #1075, i am not sure this rule cause u a bug?

@simon-paris
Copy link
Author

simon-paris commented Mar 5, 2024

I understand the special case for not inserting a line after a punctuation mark, but surely it should not forcibly remove a line because the next sentence starts with the word "I" or "A"?

Here's the actual code that triggered this issue for me.

<Text color={theme.urbanGrey60} size="xs">
  Mudah.my
  <br />
  Sdn Bhd [200701024583 (782603-V)]
  <br />
  a Carousell Group company
  <br />
</Text>

@arendjr
Copy link
Contributor

arendjr commented Mar 5, 2024

I agree with @simon-paris here. It looks like the PR that is being referred to implemented the change in order to increase Prettier compatibility, but I also think the old Biome behavior made more sense.

@ematipico ematipico added S-Needs discussion Status: needs a discussion to understand criteria and removed S-Bug-confirmed Status: report has been confirmed as a valid bug labels May 22, 2024
@ematipico
Copy link
Member

Maybe we could mark this as a divergence. I also feel like that Biome's behaviour makes more sense

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Formatter Area: formatter L-JavaScript Language: JavaScript and super languages S-Needs discussion Status: needs a discussion to understand criteria
Projects
None yet
Development

No branches or pull requests

5 participants