biomejs / biome

A toolchain for web projects, aimed to provide functionalities to maintain them. Biome offers formatter and linter, usable via CLI and LSP.
https://biomejs.dev
Apache License 2.0
14.95k stars 464 forks source link

📝 overrides.json.formatter.trailingCommas: all does not seem to work #2052

Closed tylerbutler closed 7 months ago

tylerbutler commented 7 months ago

Environment information

CLI:
  Version:                      1.6.0
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           linux

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v18.17.1"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "pnpm/8.6.6"

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

Formatter:
  Format with errors:           true
  Indent style:                 Tab
  Indent size:                  0
  Indent width:                 0
  Line ending:                  Lf
  Line width:                   95
  Attribute position:           Auto
  Ignore:                       []
  Include:                      []

JavaScript Formatter:
  Enabled:                      false
  JSX quote style:              Double
  Quote properties:             Preserve
  Trailing comma:               All
  Semicolons:                   Always
  Arrow parentheses:            Always
  Bracket spacing:              true
  Bracket same line:            false
  Quote style:                  Double
  Indent style:                 unset
  Indent size:                  unset
  Indent width:                 unset
  Line ending:                  unset
  Line width:                   unset
  Attribute position:           Auto

JSON Formatter:
  Enabled:                      false
  Indent style:                 Tab
  Indent width:                 unset
  Indent size:                  unset
  Line ending:                  unset
  Line width:                   unset
  Trailing Commas:              unset

Workspace:
  Open Documents:               0

Configuration

{
    "$schema": "https://biomejs.dev/schemas/1.6.0/schema.json",
    "files": {
        "ignoreUnknown": true,
        "ignore": ["**/_api-extractor-temp/**", "**/oclif.manifest.json"]
    },
    "vcs": {
        "enabled": true,
        "clientKind": "git",
        "useIgnoreFile": true
    },
    "organizeImports": {
        "enabled": false
    },
    "linter": {
        "enabled": false,
        "rules": {
            "recommended": true
        }
    },
    "formatter": {
        "enabled": true,
        "formatWithErrors": true,
        "indentStyle": "tab",
        "lineWidth": 95,
        "lineEnding": "lf"
    },
    "javascript": {
        "formatter": {
            "arrowParentheses": "always",
            "jsxQuoteStyle": "double",
            "semicolons": "always",
            "trailingComma": "all",
            "quoteProperties": "preserve",
            "quoteStyle": "double",
            "bracketSpacing": true
        }
    },
    "json": {
        "formatter": {
            "indentStyle": "tab"
        }
    },
    "overrides": [
        {
            "include": [".vscode/*.json"],
            "formatter": {
                "formatWithErrors": true
            },
            "json": {
                "parser": {
                    "allowComments": true,
                    "allowTrailingCommas": true
                },
                "formatter": {
                    "trailingCommas": "all"
                }
            }
        }
    ]
}

Playground link

The codebox link below is a slightly different set up than mine. I updated the sandbox to format files in .codesandbox instead of .vscode, since .vscode isn't visible in codesandbox. If you add a trailing comma to one of those files, then run npm run format, the trailing comma will be removed.

https://codesandbox.io/p/devbox/musing-hooks-32w42r?layout=%257B%2522sidebarPanel%2522%253A%2522EXPLORER%2522%252C%2522rootPanelGroup%2522%253A%257B%2522direction%2522%253A%2522horizontal%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522id%2522%253A%2522ROOT_LAYOUT%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522cltn9nllq00053j6f6kjpx43a%2522%252C%2522sizes%2522%253A%255B70%252C30%255D%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522EDITOR%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522id%2522%253A%2522cltn9nllp00023j6fbina2abj%2522%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522SHELLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522id%2522%253A%2522cltn9nllp00033j6f53ytgazk%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522DEVTOOLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522id%2522%253A%2522cltn9nllp00043j6fpafckyp0%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%252C%2522sizes%2522%253A%255B50%252C50%255D%257D%252C%2522tabbedPanels%2522%253A%257B%2522cltn9nllp00023j6fbina2abj%2522%253A%257B%2522id%2522%253A%2522cltn9nllp00023j6fbina2abj%2522%252C%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522cltn9oxxr003i3j6fr8r4hmv0%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522FILE%2522%252C%2522initialSelections%2522%253A%255B%257B%2522startLineNumber%2522%253A4%252C%2522startColumn%2522%253A24%252C%2522endLineNumber%2522%253A4%252C%2522endColumn%2522%253A24%257D%255D%252C%2522filepath%2522%253A%2522%252Fbiome.json%2522%252C%2522state%2522%253A%2522IDLE%2522%257D%255D%252C%2522activeTabId%2522%253A%2522cltn9oxxr003i3j6fr8r4hmv0%2522%257D%252C%2522cltn9nllp00043j6fpafckyp0%2522%253A%257B%2522tabs%2522%253A%255B%255D%252C%2522id%2522%253A%2522cltn9nllp00043j6fpafckyp0%2522%257D%252C%2522cltn9nllp00033j6f53ytgazk%2522%253A%257B%2522id%2522%253A%2522cltn9nllp00033j6f53ytgazk%2522%252C%2522activeTabId%2522%253A%2522cltn9qyme00fe3j6f5h1vofrw%2522%252C%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522cltn9qyme00fe3j6f5h1vofrw%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TERMINAL%2522%252C%2522shellId%2522%253A%2522cltn9qyks003udjip6uf77di6%2522%257D%255D%257D%257D%252C%2522showDevtools%2522%253Atrue%252C%2522showShells%2522%253Atrue%252C%2522showSidebar%2522%253Atrue%252C%2522sidebarPanelSize%2522%253A15%257D

Code of Conduct

tylerbutler commented 7 months ago

I can reproduce this with tsconfig files as well. It seems like overrides either don't work the way I think they do or the "trailingCommas": "all" option doesn't work in overrides.

ematipico commented 7 months ago

Closing. It's been reported and fixed. We will release it soon

tylerbutler commented 7 months ago

@ematipico Can you link the issue/PR? Thanks!

ematipico commented 7 months ago

https://github.com/biomejs/biome/pull/2025