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

📝 arrowParentheses asNeeds breaks the code #1106

Closed
1 task done
anonrig opened this issue Dec 7, 2023 · 1 comment ¡ Fixed by #1449
Closed
1 task done

📝 arrowParentheses asNeeds breaks the code #1106

anonrig opened this issue Dec 7, 2023 · 1 comment ¡ Fixed by #1449
Assignees
Labels
A-Formatter Area: formatter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug

Comments

@anonrig
Copy link
Contributor

anonrig commented Dec 7, 2023

Environment information

❯ biome rage
CLI:
  Version:                      1.4.1
  Color support:                true

Platform:
  CPU Architecture:             aarch64
  OS:                           macos

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         "alacritty"
  JS_RUNTIME_VERSION:           "v20.10.0"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         unset

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

Workspace:
  Open Documents:               0

What happened?

  1. Go to https://github.com/getsentry/sentry
  2. Clone it
  3. Copy the following biome.json
{
  "$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
  "vcs": {
    "enabled": true,
    "clientKind": "git",
    "useIgnoreFile": true
  },
  "organizeImports": {
    "enabled": false
  },
  "linter": {
    "enabled": false
  },
  "files": {
    "ignoreUnknown": true
  },
  "formatter": {
    "enabled": true,
    "formatWithErrors": true,
    "ignore": [
      "api-docs",
      ".github",
      "tests",
      "fixtures",
      "scripts",
      "src",
      "static/app/data/world.json",
      "static/app/**/*trace.json",
      "package.json"
    ]
  },
  "javascript": {
    "formatter": {
      "enabled": true,
      "bracketSpacing": false,
      "bracketSameLine": false,
      "lineWidth": 90,
      "semicolons": "always",
      "quoteStyle": "single",
      "indentWidth": 2,
      "trailingComma": "es5",
      "arrowParentheses": "asNeeded",
      "indentStyle": "space",
      "jsxQuoteStyle": "double",
      "quoteProperties": "asNeeded"
    }
  },
  "json": {
    "formatter": {
      "enabled": true,
      "indentStyle": "space"
    }
  }
}
  1. Run the following:
npx @biomejs/biome check ./static/app/components/charts/eventsRequest.tsx

Expected result

The produced code is wrong:

❯ npx @biomejs/biome check ./static/app/components/charts/eventsRequest.tsx
./static/app/components/charts/eventsRequest.tsx format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  ℹ Formatter would have printed the following content:

    394 394 │     calculateTotalsPerTimestamp(
    395 395 │       data: EventsStatsData,
    396     │ - ····getName:·(
    397     │ - ······timestamp:·number,
    398     │ - ······countArray:·{count:·number}[],
    399     │ - ······i:·number
    400     │ - ····)·=>·number·=·timestamp·=>·timestamp·*·1000
        396 │ + ····getName:·(timestamp:·number,·countArray:·{count:·number}[],·i:·number)·=>·number·=
        397 │ + ······timestamp
        398 │ + ····=>·timestamp·*·1000
    401 399 │     ): SeriesDataUnit[] {
    402 400 │       return data.map(([timestamp, countArray], i) => ({

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@ematipico ematipico 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 Dec 7, 2023
@Conaclos Conaclos changed the title 🐛 arrowParentheses asNeeds breaks the code 📝 arrowParentheses asNeeds breaks the code Dec 7, 2023
@faultyserver
Copy link
Contributor

I reduced this down to a minimal repro here: Playground Link

There are two issues that combine here:

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
Projects
None yet
3 participants