Skip to content

chore: upgrade biome to 2.6.7 - #1254

Merged
Naturalclar merged 3 commits into
masterfrom
chore/biome-2
Nov 15, 2026
Merged

Naturalclar merged 3 commits into
masterfrom
chore/biome-2

Conversation

@Naturalclar

Copy link
Copy Markdown
Member

Supersedes #1243, which bumps the dependency alone and therefore fails lint with:

× Biome exited because the configuration resulted in errors. Please fix them.
  $ biome migrate

biome 2 cannot read a v1 config, so the upgrade needs the migration and two code changes alongside the version bump.

Config migration

Produced by biome migrate, not hand-written:

v1 v2
$schema 1.9.4 2.6.7
files.ignore: ["lib"] files.includes: ["**", "!**/lib"]
organizeImports: { enabled: true } assist.actions.source.organizeImports: "on"
linter.rules.recommended: true linter.rules.preset: "recommended"

Two real findings from biome 2

noReactNativeDeepImports (new rule) — flags the three deep react-native imports. These are deliberate: UIMenuNativeComponent.ts is the codegen spec, and React Native's codegen expects CodegenTypes and codegenNativeComponent on those exact paths.

I checked whether the rule's advice was actionable: react-native/index.js does re-export both codegenNativeComponent and codegenNativeCommands as top-level getters, so the imports could technically be rewritten. I chose not to — rewriting imports that codegen parses risks breaking native builds for no functional gain, and CLAUDE.md explicitly warns against restructuring that file. Suppressed with the reasoning recorded inline so the rule stays active for genuinely accidental deep imports elsewhere.

One mechanical detail: the spec file needs a file-level biome-ignore-all rather than a line suppression, because biome anchors the multi-line type import's diagnostic on the closing from "..." line, where a statement-level comment can't sit.

noUnusedVariables — flags the unused catch binding in react-native.config.js. Fixed with an optional catch binding (} catch {), since the error was never used.

Verification

CI covers less of this than it looks like it does, so I ran the gaps locally:

Check Result In CI?
yarn lint clean, 27 files yes
yarn typescript clean yes
yarn test 1 suite passed, 1 todo no — there is no test job
yarn prepare (bob build) all 3 targets written no — yarn install doesn't run prepare

Deliberately out of scope: yarn format drift

yarn biome format . reports drift in CLAUDE.md, CONTRIBUTING.md, README.md, package.json, plugin/withAndroidDrawables.js and the spec file. I left all of it alone:

  • The markdown is new scope. biome 2 formats Markdown; 1.9 did not. Reformatting three docs would bury the upgrade.
  • The spec file's drift is pre-existing and unrelated. I verified this rather than assuming: running @biomejs/biome@1.9.4 against master's config and file flags the identical two lines — a missing trailing comma after WithDefault, and 'large' instead of "large" from feat(ios): preferredElementSize #1202.

yarn format is not part of CI (the Build workflow runs lint, tsc, android, ios), so none of this gates anything. Worth a follow-up PR if you want the repo format-clean under biome 2.

Note on #1243

Once this merges, #1243 is redundant and dependabot should close it, since the dependency will already be at 2.6.7.

🤖 Generated with Claude Code

Naturalclar and others added 3 commits November 15, 2026 15:46
Dependabot's #1243 bumps the dependency alone, which is why its lint job
fails with "Biome exited because the configuration resulted in errors":
biome 2 cannot read a v1 config. The upgrade needs the config migration and
two code changes alongside it.

biome.json, via `biome migrate`:
- $schema 1.9.4 -> 2.6.7
- files.ignore: ["lib"] -> files.includes: ["**", "!**/lib"]
- organizeImports -> assist.actions.source.organizeImports
- linter.rules.recommended: true -> linter.rules.preset: "recommended"

biome 2 then surfaced two real findings:

`noReactNativeDeepImports` is new, and flags the three deep react-native
imports. These are deliberate: UIMenuNativeComponent.ts is a codegen spec, and
React Native's codegen expects CodegenTypes and codegenNativeComponent on those
exact paths. react-native/index.js does re-export codegenNativeComponent and
codegenNativeCommands, so the rule's advice is technically actionable, but
rewriting imports the codegen parses risks breaking native builds for no gain.
Suppressed with the reasoning recorded inline, so the rule stays active for
genuinely accidental deep imports. The spec file needs a file-level
`biome-ignore-all` rather than a line suppression, because biome anchors the
multi-line type import's diagnostic on the closing `from` line.

`noUnusedVariables` flags the unused catch binding in react-native.config.js.
Fixed with an optional catch binding, since the error was never used.

Verified beyond CI, which covers less of this than it appears to: `yarn lint`
clean, `yarn typescript` clean, `yarn test` passes (1 suite, 1 todo -- CI has
no test job), and `yarn prepare` builds all three bob targets (CI never runs
prepare).

Left alone deliberately: `yarn format` reports drift in the markdown files,
package.json, plugin/withAndroidDrawables.js and the spec file. The markdown is
new scope -- biome 2 formats Markdown and 1.9 did not. The spec file's drift is
pre-existing and unrelated: biome 1.9.4 flags the same two lines (a missing
trailing comma and `'large'` from #1202) on master. `yarn format` is not part of
CI, so none of it gates anything, and reformatting it here would bury the
upgrade in an unrelated diff.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Self-review of the previous commit: `biome-ignore-all` switched
noReactNativeDeepImports off for the entire spec file, so a genuinely
accidental deep import added later would go unreported.

biome 2 supports range suppressions, which are a better fit. Verified
empirically rather than assumed: with biome-ignore-start/-end around the
codegen import block, the two intended imports are suppressed while a probe
deep import added after the end marker is still flagged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
… entry

Review of the previous commit found the suppression on this import was
justified by a false claim. UIMenuView.android.tsx is not a codegen spec:
RN 0.81 selects spec files by content, matching
/export\s+default\s+\(?codegenNativeComponent</ or /extends TurboModule/
(@react-native/codegen/lib/cli/combine/combine-js-to-schema.js), and this file
matches neither -- it exports a forwardRef component over
requireNativeComponent. Codegen never parses it, so the import path cannot
"match what codegen generates".

codegenNativeCommands is a public top-level export (react-native/index.js:189,
a getter returning the same module's default), so the deep import bought
nothing while carrying real risk: React Native has been relocating Libraries/
into src/private, and when that path moves, importing this package fails at
Metro resolution on Android for every consumer. The suppression is what would
have kept the lint quiet about it.

Switching to the public entry point removes the hazard and the suppression.
The spec file's own suppression stays -- codegen does parse that one.

Also pin the formatter to the file types biome 1.9 handled. biome 2 formats
Markdown and YAML, which silently enlists the repo's docs and, because
vcs.useIgnoreFile is false, generated trees like example/ios/Pods and
example/android/build once someone has run `yarn pods` or `yarn android`.
The documented `yarn format` would then rewrite files nobody intended to
touch, including the hand-written comments in .github/dependabot.yml.
Formatter drift is now exactly the three files 1.9.4 already flagged, so this
upgrade changes the tool without changing formatting scope.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Naturalclar
Naturalclar merged commit ec6390f into master Nov 15, 2026
5 checks passed
@Naturalclar
Naturalclar deleted the chore/biome-2 branch November 15, 2026 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant