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

💅 Biome is adding a comma in the last line inside ReactDOM.createRoot.render method in main.tsx file when executing npx biome check --apply ./src #2906

Open
1 task done
CarmeloRicarte opened this issue May 17, 2024 · 3 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

@CarmeloRicarte
Copy link

CarmeloRicarte commented May 17, 2024

Environment information

CLI:
  Version:                      1.7.1
  Color support:                true

Platform:
  CPU Architecture:             aarch64
  OS:                           macos

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v18.15.0"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "npm/9.5.0"

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

Linter:
  Recommended:                  true
  All:                          false
  Rules:
Workspace:
  Open Documents:               0

Rule name

no specific rule added

Playground link

https://codesandbox.io/p/devbox/biomejs-bug-react-render-xtw6n7

Expected result

It should not add this comma after </React.StrictMode> like in this example:

import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App.tsx";
import "./index.css";

ReactDOM.createRoot(document.getElementById("root")!).render(
  <React.StrictMode>
    <App />
  </React.StrictMode>
);

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@CarmeloRicarte CarmeloRicarte changed the title 💅 Biome is adding a comma in the last line inside ReactDOM.createRoot.render method in main.tsx file 💅 Biome is adding a comma in the last line inside ReactDOM.createRoot.render method in main.tsx file when executing npx biome check --apply ./src May 17, 2024
@ah-yu ah-yu 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 May 20, 2024
@ematipico
Copy link
Member

Interestingly, Prettier has the same issue.

@ah-yu
Copy link
Contributor

ah-yu commented May 21, 2024

It seems they behave differently when setting trailing_comma to es5. playground

@ematipico
Copy link
Member

ematipico commented May 21, 2024

I believe this is expected and it's not a bug.

When the list of parameters breaks on multiple lines, the formatter always adds a leading comma for the last parameter. In this case, the last is also the first.

However, the es5 trialing comma is definitely buggy, and we should fix it (with low priority I suppose)

@Conaclos Conaclos added the S-Help-wanted Status: you're familiar with the code base and want to help the project label Jul 16, 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

4 participants