react-native-gesture-handler icon indicating copy to clipboard operation
react-native-gesture-handler copied to clipboard

Add pre-commit hook and linters for Android and iOS code

Open j-piasecki opened this issue 2 years ago • 0 comments

Description

This PR:

  • Removes unnecessary .gitignore, build.gradle and proguard-rules.pro files from the lib/ directory. I believe those were leftovers from when Gesture Handler could be used as a native Android library
  • Adds Gradle wrapper in the android/ directory
  • Adds Spotless for linting the Android code, similarly to how it's done in Screens
  • Adds .clang-format for linting the iOS code, the config is the same as in Screens and Reanimated
  • Adds a pre-commit hook similarly to how it's implemented in Screens
  • Adds workflow that lints Android code
  • Formats Android code so that it passes spotlessCheck

While this PR formats Android code, it doesn't modify the iOS one. On Android there weren't that many changes and the number of affected files was low. On iOS there are more changes needed in more files. The idea behind that is that the changed files from now on will have to be reformatted, so the style changes will be more gradual without one huge commit changing the whole codebase. After some time we could make one commit that updates the remaining files, which should result in a clearer history.

Also, at some point in the future we should think about updating the prettier version the root project is using to match the one in example apps, although it would require reformatting the code. This would allow for handling core, Example and FabricExample code using the same lint-staged rule, instead of each one of those having their own.

j-piasecki avatar Jun 27 '22 12:06 j-piasecki