Skip to content

Kotlin: Set up ktfmt in OSS #52064

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
Closed

Conversation

mateoguzmana
Copy link
Collaborator

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

Test Plan:

Unformat any random Kotlin file inside ReactAndroid and then run:

yarn lint-kotlin-check
yarn lint-kotlin

@facebook-github-bot facebook-github-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 Jun 16, 2025
@mateoguzmana mateoguzmana mentioned this pull request Jun 17, 2025
@mateoguzmana mateoguzmana requested a review from cortinico June 17, 2025 21:16
@mateoguzmana mateoguzmana marked this pull request as ready for review June 17, 2025 21:16
@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Jun 17, 2025
facebook-github-bot pushed a commit that referenced this pull request Jun 18, 2025
Summary:
Following up from #52064 (comment), this PR removes lint-java and its related files.

The codebase is moving entirely to Kotlin and a Kotlin linter is being setup as well, the usage of the Java linter will become unnecessary.

## Changelog:

[INTERNAL] - Remove lint-java

Pull Request resolved: #52092

Test Plan: Relying on CI here to be green.

Reviewed By: cortinico

Differential Revision: D76880712

Pulled By: sbuggay

fbshipit-source-id: 2736772e7347f435b17d007e0322e1afc2fb2d7b
@mateoguzmana mateoguzmana requested a review from cortinico July 2, 2025 17:57
Copy link
Contributor

@cortinico cortinico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested it and it looks great to me 👍 Just a couple of nits

@mateoguzmana mateoguzmana requested a review from cortinico July 12, 2025 12:31
@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Jul 15, 2025
@facebook-github-bot
Copy link
Contributor

@cortinico merged this pull request in 42b8921.

@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by @mateoguzmana in 42b8921

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.

4 participants