Skip to content

Fix Swift formatter detection when version is main - #59623

Merged
meta-codesync[bot] merged 2 commits into
react:mainfrom
LuisPeixoto:fix/swift-format-version
Oct 30, 2026
Merged

meta-codesync[bot] merged 2 commits into
react:mainfrom
LuisPeixoto:fix/swift-format-version

Conversation

@LuisPeixoto

Copy link
Copy Markdown
Contributor

Summary:

Fixes #59598. Some Swift toolchains report main for swift format --version, so the formatter is skipped even when the toolchain meets the minimum version. When swift format reports main, check swift --version and use it to enforce the existing minimum version. Other formatter candidates still require a parseable formatter version.

Changelog:

[INTERNAL] [FIXED] - Detect the Swift toolchain version when swift format reports main.

Test Plan:

  • Ran NODE_PATH=/Volumes/SSD512/Work/mobile/force-mobile/node_modules /Volumes/SSD512/Work/mobile/force-mobile/node_modules/.bin/jest scripts/__tests__/format-swift-test.js --runInBand --config '{"rootDir":"/tmp/react-native-contribution","testEnvironment":"node","transform":{}}': 2 tests passed. The Swift 6.4 case failed before the change; the Swift 6.2 case remains rejected.
  • Ran git diff --check: passed.
  • Xcode 27.1 was not available for an end-to-end check. The test simulates its reported version output. Full repository checks were not run.

@meta-cla

meta-cla Bot commented Oct 29, 2026

Copy link
Copy Markdown

Hi @LuisPeixoto!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla

meta-cla Bot commented Oct 29, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 29, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Oct 29, 2026
@meta-codesync

meta-codesync Bot commented Oct 29, 2026

Copy link
Copy Markdown

@cortinico has imported this pull request. If you are a Meta employee, you can view this in D128394284.

@meta-codesync
meta-codesync Bot merged commit ede7ebf into react:main Oct 30, 2026
96 checks passed
@react-native-bot react-native-bot added the Merged This PR has been merged. label Oct 30, 2026
@react-native-bot

Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @LuisPeixoto in ede7ebf

When will my fix make it into a release? | How to file a pick request?

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

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

yarn format-swift skips formatting with Xcode 27.1, whose swift-format reports its version as main

3 participants