SIGN IN SIGN UP
facebook / react-native UNCLAIMED

A framework for building native applications using React

0 0 0 C++

Kotlin: Set up ktfmt in OSS (#52064)

Summary:
This PR adds the basic `ktfmt` setup in OSS to lint Kotlin files before they're imported into the Meta codebase, making collaboration with external contributors smoother for Android related PRs.

I tried to put together certain rules that mimic the current code style and it seems to work well as I get no errors for properly formatted files but this still might need some input to have the correct configuration.

Added two scripts to the main package.json:
- To check the files format you can run: `yarn lint-kotlin-check`
- To apply formatting fixes, run: `yarn lint-kotlin`

## Changelog:

[INTERNAL] - Kotlin: Set up ktfmt in OSS

Pull Request resolved: https://github.com/facebook/react-native/pull/52064

Test Plan:
Unformat any random Kotlin file inside ReactAndroid and then run:
```sh
yarn lint-kotlin-check
yarn lint-kotlin
```

Reviewed By: cipolleschi

Differential Revision: D78272876

Pulled By: cortinico

fbshipit-source-id: 0cf6b976968dfc5c6c478e88d17eb21c18961a34
M
Mateo Guzmán committed
42b8921d910de9d4d983e90fc51a185549b9e288
Parent: f3b6eeb
Committed by Facebook GitHub Bot <[email protected]> on 7/15/2025, 3:31:00 PM