Document the repository formatting command (#58458)

Summary:
Pull Request resolved: https://github.com/react/react-native/pull/58458

Document `yarn format`, `yarn format-check`, every `format-<language>` / `format-check-<language>` command, and the prerequisite checks that warn and skip unavailable language toolchains.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D119487619

fbshipit-source-id: b9a46f2eaf5ee1cdb73c2340ec761fc74d77d665
This commit is contained in:
Nicola Corti authored and meta-codesync[bot] committed 2026-09-16 07:26:19 -07:00
1 parent 7e02fc7e68
commit 7fc66ccda5
1 file changed
+6 -1
+6 -1
View File
@@ -34,10 +34,15 @@ Architecture notes live in `__docs__` directories beside the code they describe,
| `yarn fantom <path>` | [Fantom](private/react-native-fantom/__docs__/README.md) integration tests, named `*-itest.js` — builds a native tester on first run |
| `yarn lint` | ESLint (`--max-warnings 0`) |
| `yarn flow-check` | Flow |
| `yarn format` | Prettier and clang-format (`yarn format-check` for Prettier only) |
| `yarn format` | Format JavaScript/TypeScript, C/C++/Objective-C/protobuf, Kotlin, Java, Python, and Swift sources |
| `yarn format-check` | Check all repository formatting without changing files |
| `yarn format-<language>` | Format one language: `javascript`, `cpp`, `kotlin`, `java`, `python`, or `swift` |
| `yarn format-check-<language>` | Check one language without changing files |
JavaScript CI is the `lint`, `test_js`, and `build_js_types` jobs in [`.github/workflows/test-all.yml`](.github/workflows/test-all.yml); Fantom and the native platforms have their own jobs.
The formatting command uses pinned npm packages for Kotlin and Java and installs pinned Ruff through Python. To format every language, install a JDK with Java 17 or newer, Python 3 with pip, and a Swift 6.3 or newer toolchain in addition to Node and Yarn. Each language wrapper checks its own requirements and prints installation guidance when something is missing; `yarn format` then skips that language and continues formatting the others. Swift formatting accepts either `swift-format` or `swift format` from the installed toolchain.
### Verification: Running RNTester
Needed only for changes that have to be seen running, such as user interface behavior.