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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatter instability with same line comments and array holes #4695

Open
1 task done
DavisVaughan opened this issue Dec 5, 2024 · 0 comments
Open
1 task done

Formatter instability with same line comments and array holes #4695

DavisVaughan opened this issue Dec 5, 2024 · 0 comments
Labels
A-Formatter Area: formatter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug S-Help-wanted Status: you're familiar with the code base and want to help the project

Comments

@DavisVaughan
Copy link

DavisVaughan commented Dec 5, 2024

As obscure as it is, it seems like this causes issues in the formatter

[
  , /* this */
]

In particular it seems like the formatting isn't stable? Putting this in the quick_test.rs gives me:

---- quick_test stdout ----
[
  "[",
  group("#array-1", [
    indent([soft_line_break, group([" /* this */"]), ","]),
    soft_line_break
  ]),
  "];",
  hard_line_break
]
[ /* this */,];

Differences (-input|+output):
 [
   "[",
   group("#array-1", [
-    indent([soft_line_break, group(["/* this */ "]), ","]),
+    indent([soft_line_break, group([" /* this */"]), ","]),
     soft_line_break
   ]),
   "];",
   hard_line_break

thread 'quick_test' panicked at /Users/davis/files/programming/biome/crates/biome_formatter_test/src/check_reformat.rs:100:13:
assertion failed: `(left == right)`'
  left: `"[ /* this */,];\n"`
 right: `"[/* this */ ,];\n"`

Differences (-left|+right):
-[ /* this */,];
+[/* this */ ,];

Environment information

I was actually using the dev version, built from scratch locally

Configuration

No response

Playground link

https://biomejs.dev/playground/?code=WwAKACAAIAAsACAALwAqACAAdABoAGkAcwAgACoALwAKAF0A

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@DavisVaughan DavisVaughan added the S-Needs triage Status: this issue needs to be triaged label Dec 5, 2024
@ematipico ematipico added S-Help-wanted Status: you're familiar with the code base and want to help the project A-Formatter Area: formatter S-Bug-confirmed Status: report has been confirmed as a valid bug labels Dec 5, 2024
@github-actions github-actions bot removed the S-Needs triage Status: this issue needs to be triaged label Dec 5, 2024
@ematipico ematipico added L-JavaScript Language: JavaScript and super languages S-Needs triage Status: this issue needs to be triaged labels Dec 5, 2024
@github-actions github-actions bot removed the S-Needs triage Status: this issue needs to be triaged label Dec 5, 2024
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-Bug-confirmed Status: report has been confirmed as a valid bug S-Help-wanted Status: you're familiar with the code base and want to help the project
Projects
None yet
Development

No branches or pull requests

2 participants