plugins icon indicating copy to clipboard operation
plugins copied to clipboard

trunk fmt does not surface `biome format` errors

Open sxlijin opened this issue 9 months ago • 1 comments

👋 hullo!

trunk doesn't appear to surface biome format errors, not sure why, haven't dug into it. still on WSL.

here's a malformed biome config that complains correctly when run with pnpm biome format .:

❯ cat biome.json
{
        "$schema": "https://biomejs.dev/schemas/1.7.3/schema.json",
        "organizeImports": {
                "enabled": true
        },
        "linter": {
                "enabled": true,
                "rules": {
                        "recommended": true
                }
        },
        "formatter": {
                "enabled": true,
                "rules": {
                        "recommended": true,
                        "formatWithErrors": true,
                        "indentStyle": "spaces",
                        "indentWidth": 2,
                        "lineEnding": "lf",
                        "lineWidth": 120
                }
        },
        "javascript": {
                "formatter": {
                        "quoteStyle": "single",
                        "jsxQuoteStyle": "single",
                        "semicolons": "asNeeded",
                        "trailingComma": "all"
                }
        }
}

sxlijin avatar May 06 '24 22:05 sxlijin

Howdy! 😄

Did a quick investigation and looks like this case is getting swallowed up in the exit code 1 output. I'll put up a fix for this, but in the meantime you can override with:

lint:
  definitions:
    - name: biome
      commands:
        - name: fmt
          success_codes: [0]

Unfortunately we can't do this for the lint subcommand easily because it's a regex linter and all biome errors and diagnostics output an exit code 1. Nevertheless, fixing this for format should be sufficient! Thanks for flagging this!

TylerJang27 avatar May 07 '24 00:05 TylerJang27