Repository navigation
chore: upgrade biome to 2.6.7 - #1254
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes #1243, which bumps the dependency alone and therefore fails
lintwith: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:$schema1.9.4files.ignore: ["lib"]files.includes: ["**", "!**/lib"]organizeImports: { enabled: true }assist.actions.source.organizeImports: "on"linter.rules.recommended: truelinter.rules.preset: "recommended"Two real findings from biome 2
noReactNativeDeepImports(new rule) — flags the three deepreact-nativeimports. These are deliberate:UIMenuNativeComponent.tsis the codegen spec, and React Native's codegen expectsCodegenTypesandcodegenNativeComponenton those exact paths.I checked whether the rule's advice was actionable:
react-native/index.jsdoes re-export bothcodegenNativeComponentandcodegenNativeCommandsas 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-allrather than a line suppression, because biome anchors the multi-line type import's diagnostic on the closingfrom "..."line, where a statement-level comment can't sit.noUnusedVariables— flags the unused catch binding inreact-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:
yarn lintyarn typescriptyarn testyarn prepare(bob build)yarninstall doesn't runprepareDeliberately out of scope:
yarn formatdriftyarn biome format .reports drift inCLAUDE.md,CONTRIBUTING.md,README.md,package.json,plugin/withAndroidDrawables.jsand the spec file. I left all of it alone:@biomejs/biome@1.9.4against master's config and file flags the identical two lines — a missing trailing comma afterWithDefault, and'large'instead of"large"from feat(ios): preferredElementSize #1202.yarn formatis not part of CI (the Build workflow runslint,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