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 ci always produce errors in GHA but not locally #3137

Closed
1 task done
motss opened this issue Jun 9, 2024 · 1 comment
Closed
1 task done

📝 biome ci always produce errors in GHA but not locally #3137

motss opened this issue Jun 9, 2024 · 1 comment
Labels
A-CLI Area: CLI S-Bug-confirmed Status: report has been confirmed as a valid bug

Comments

@motss
Copy link

motss commented Jun 9, 2024

Environment information

CLI:
  Version:                      1.8.0
  Color support:                true

Platform:
  CPU Architecture:             aarch64
  OS:                           macos

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v22.1.0"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "pnpm/9.2.0"

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

Formatter:
  Format with errors:           false
  Indent style:                 Space
  Indent width:                 2
  Line ending:                  Lf
  Line width:                   80
  Attribute position:           Multiline
  Ignore:                       []
  Include:                      []

JavaScript Formatter:
  Enabled:                      true
  JSX quote style:              Double
  Quote properties:             AsNeeded
  Trailing commas:              Es5
  Semicolons:                   Always
  Arrow parentheses:            Always
  Bracket spacing:              true
  Bracket same line:            true
  Quote style:                  Single
  Indent style:                 unset
  Indent width:                 unset
  Line ending:                  Lf
  Line width:                   unset
  Attribute position:           Multiline

JSON Formatter:
  Enabled:                      true
  Indent style:                 unset
  Indent width:                 unset
  Line ending:                  unset
  Line width:                   unset
  Trailing Commas:              None

CSS Formatter:
  Enabled:                      true
  Indent style:                 Tab
  Indent width:                 0
  Line ending:                  Lf
  Line width:                   LineWidth(80)
  Quote style:                  Double

Workspace:
  Open Documents:               0

Configuration

{
  "$schema": "https://biomejs.dev/schemas/1.8.0/schema.json",
  "formatter": {
    "attributePosition": "multiline",
    "enabled": true,
    "formatWithErrors": false,
    "indentStyle": "space",
    "indentWidth": 2,
    "lineEnding": "lf",
    "lineWidth": 80
  },
  "css": {
    "formatter": {
      "enabled": true,
      "quoteStyle": "double"
    },
    "linter": {
      "enabled": true
    },
    "parser": {
      "cssModules": true
    }
  },
  "javascript": {
    "formatter": {
      "arrowParentheses": "always",
      "attributePosition": "multiline",
      "bracketSameLine": true,
      "bracketSpacing": true,
      "enabled": true,
      "jsxQuoteStyle": "double",
      "lineEnding": "lf",
      "quoteProperties": "asNeeded",
      "quoteStyle": "single",
      "semicolons": "always",
      "trailingCommas": "es5"
    }
  },
  "json": {
    "formatter": {
      "enabled": true,
      "trailingCommas": "none"
    },
    "linter": {
      "enabled": true
    },
    "parser": {
      "allowComments": false,
      "allowTrailingCommas": false
    }
  },
  "vcs": {
    "clientKind": "git",
    "defaultBranch": "main",
    "enabled": true,
    "root": ".",
    "useIgnoreFile": true
  },
  "organizeImports": {
    "enabled": false
  },
  "linter": {
    "enabled": true,
    "rules": {
      "recommended": true,
      "a11y": {
        "all": true
      },
      "complexity": {
        "all": true,
        "noStaticOnlyClass": "off",
        "noUselessSwitchCase": "off",
        "noExcessiveCognitiveComplexity": "off"
      },
      "correctness": {
        "all": true
      },
      "nursery": {
        "all": true,
        "noConsole": "off",
        "useImportRestrictions": "off"
      },
      "performance": {
        "all": true
      },
      "security": {
        "all": true
      },
      "style": {
        "all": true,
        "useNamingConvention": {
          "level": "error",
          "options": {
            "strictCase": false
          }
        }
      },
      "suspicious": {
        "all": true,
        "useAwait": "off"
      }
    }
  },
  "overrides": [
    {
      "include": [
        "commitlint.config.*js",
        "eslint.config.*js",
        "nano-staged.*js",
        "vite.config.ts",
        "vitest.workspace.ts"
      ],
      "linter": {
        "enabled": true,
        "rules": {
          "style": {
            "noDefaultExport": "off"
          }
        }
      }
    },
    {
      "include": ["eslint.config.*js"],
      "linter": {
        "enabled": true,
        "rules": {
          "nursery": {
            "noUndeclaredDependencies": "off"
          }
        }
      }
    },
    {
      "include": ["src/**/*.test.ts*"],
      "linter": {
        "rules": {
          "nursery": {
            /**
             * fixme: remove the override when [#3133] gets resolved.
             *
             * [#3133]: https://github.com/biomejs/biome/issues/3133
             */
            "useDateNow": "off"
          }
        }
      }
    }
  ]
}

Actual result

Running biome ci in GHA will always produce errors even when the formatter logs Checked 2 files in 1572µs. No fixes needed.. However, running biome ci locally does not see any errors.

> biome ci
 format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  ✖ File content differs from formatting output
  
     3  3 │     "version": "0.0.1",
     4  4 │     "description": "Broken biome ci",
     5    │ - ··"keywords":·[
     6    │ - ····"biome",
     7    │ - ····"ci",
     8    │ - ····"biome-ci",
     9    │ - ····"broken-biome-ci"
    10    │ - ··],
        5 │ + ··"keywords":·["biome""ci""biome-ci""broken-biome-ci"],
    11  6 │     "homepage": "https://github.com/motss/broken-biome-ci",
    12  7 │     "bugs": {
    ····· │ 
    35 [30](https://github.com/ipohjs/broken-biome-ci/actions/runs/9438349120/job/25995224343#step:9:31) │     "module": "./index.js",
    36 [31](https://github.com/ipohjs/broken-biome-ci/actions/runs/9438349120/job/25995224343#step:9:32) │     "types": "./index.js",
    37    │ - ··"files":·[
    38    │ - ····"./index.d.ts",
    39    │ - ····"./index.js"
    40    │ - ··],
    41    │ - ··"workspaces":·[
    42    │ - ····"./packages/*"
    43    │ - ··],
       [32](https://github.com/ipohjs/broken-biome-ci/actions/runs/9438349120/job/25995224343#step:9:33) │ + ··"files":·["./index.d.ts""./index.js"],
       [33](https://github.com/ipohjs/broken-biome-ci/actions/runs/9438349120/job/25995224343#step:9:34) │ + ··"workspaces":·["./packages/*"],
    44 [34](https://github.com/ipohjs/broken-biome-ci/actions/runs/9438349120/job/25995224343#step:9:35) │     "scripts": {
    45 [35](https://github.com/ipohjs/broken-biome-ci/actions/runs/9438349120/job/25995224343#step:9:36) │       "biome.ci": "biome ci",
  

ci ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  ✖ Some errors were emitted while running checks.
  

Checked 2 files in 1572µs. No fixes needed.
Found 1 error.
 ELIFECYCLE  Command failed with exit code 1.
Error: Process completed with exit code 1.

Expected result

Running biome ci locally and in GHA should always produce identical and consistent result.

> biome ci

Checked 2 files in 969µs. No fixes needed.

Playground link

Instead of providing a playground which does not support JSON formatting, you should clone this public repo I created to reproduce the error.

  1. Github repo with reduced test case - link
  2. GHA showing the error message when running biome ci - link

Related issues

  1. 🐛 biome ci passes locally on macOS but fails on Linux on CI (GHA) #3087
  2. 💅 Linting not working in GHA, fine locally #2856

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@ematipico ematipico added A-CLI Area: CLI S-Bug-confirmed Status: report has been confirmed as a valid bug labels Jun 9, 2024
@Sec-ant
Copy link
Member

Sec-ant commented Jun 10, 2024

I don't think this is a bug of Biome.

In your workflow there's a command pnpm pkg delete scripts.postinstall which will format the package.json file in a way that each of the array entry is put into a separated line. And Biome later will in turn put them into a single line according to the lineWidth option.

You can add an override entry for the package.json file to set the lineWidth to 1 so the behavior of the Biome formatter aligns with the pnpm pkg ... command. Or you can ignore the file.

@Sec-ant Sec-ant closed this as not planned Won't fix, can't repro, duplicate, stale Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-CLI Area: CLI S-Bug-confirmed Status: report has been confirmed as a valid bug
Projects
None yet
Development

No branches or pull requests

3 participants