Skip to content
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

feat: switch ktlint for spotless #1093

Merged
merged 2 commits into from
Sep 6, 2021

Conversation

kacperkapusciak
Copy link
Member

@kacperkapusciak kacperkapusciak commented Sep 1, 2021

Description

Using ktlint directly as gradle task is very powerful and flexible but due to problems (#1085, #1090) we've decided to use formatting/linting framework - Spotless.

PR based on expo/expo#12545

For formatting per file -PspotlessIdeHook flag is used

The Spotless plugin for Gradle accepts a command-line argument -PspotlessIdeHook=${ABSOLUTE_PATH_TO_FILE}. In this mode, spotlessCheck is disabled, and spotlessApply will apply only to that one file.

As stated above, Spotless doesn't support linting per file. It makes it impossible to use spotlessCheck with lint-staged. Formatting per file with spotlessApply works fine.

Fixes #1090
Fixes #1085

Changes

  • Use ktlint within spotless plugin
  • Adjust format-android.js script
  • Remove lint-android.js script

Checklist

  • Ensured that CI passes

Copy link
Member

@WoLewicki WoLewicki left a comment

Choose a reason for hiding this comment

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

Good job! Make sure it fixes the issues and we can merge it then!

@brunorafaeI
Copy link

Waiting for this fix to merge! 👍

@kacperkapusciak kacperkapusciak merged commit b5254c2 into master Sep 6, 2021
@kacperkapusciak kacperkapusciak deleted the @kacperkapusciak/add-spotless branch September 6, 2021 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants