Skip to content

Track the current Biome release #545

Description

@sehkone

Background

biomejs/setup-biome@v2 pins version: 2.4.9, while the rest of the organisation tracks latest (2.5.7 today). Biome runs here with --error-on-warnings, so simply moving the pin turns CI red: 2.5.7 reports eleven findings that 2.4.9 did not.

They are worth fixing rather than pinning away.

lint/correctness/noUnsafeOptionalChaining — 4 occurrences. Two each in src/lib/dashboard/analytics.ts and src/lib/dashboard/attention.ts, all the same shape:

Array.isArray(config?.excluded_user_ids)
  ? (config?.excluded_user_ids as string[]).filter(...)
  : []

The Array.isArray guard already establishes that the value is an array, so the code is safe in practice — but the optional chain is re-evaluated inside the branch, and the linter cannot see the narrowing through ?. plus the cast. If config were nullish the member access would throw.

lint/complexity/useOptionalChain — 7 occurrences. All !x || x.y !== "literal", which reads more directly as x?.y !== "literal".

Configuration deprecations — 2. The declared $schema is 2.4.9 while a newer Biome runs, and linter.rules.recommended is deprecated in favour of preset; it is removed in Biome 3.x.

Scope

  • .github/workflows/ci.yml: change the Biome pin from 2.4.9 to latest.
  • src/lib/dashboard/analytics.ts, src/lib/dashboard/attention.ts: hoist each optional access into a local before the Array.isArray guard, so the branch no longer re-evaluates the optional chain. The as string[] cast stays, so inference is untouched and behaviour is identical.
  • Six files: apply the useOptionalChain rewrite. Every case compares against a string literal and every subject is an object from a GraphQL or database result, so !x and x?. cover the same inputs.
  • biome.json, via biome migrate --write: schema to 2.5.7, recommended to preset.

Acceptance criteria

  • CI installs Biome latest.
  • biome ci --error-on-warnings . passes with no warnings and no deprecation notices.
  • tsc --noEmit still passes.

Verification already done

  • biome ci --error-on-warnings . at 2.5.7 on this change: exit 0, Checked 412 files, no findings.
  • pnpm run typecheck (tsc --noEmit): exit 0.
  • Before the change, the same command at 2.5.7 exited 1 with 7 warnings, 4 correctness findings and 2 deprecation notices.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions