Skip to content

Commit 16ed1f3

Browse files
authored
[Monorepo] Update spotless (#3507)
## Description This PR bumps `spotless` (android formatter) to version 7.0.3. ## Test plan Run `yarn lint:android`
1 parent 5140914 commit 16ed1f3

42 files changed

Lines changed: 537 additions & 380 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/react-native-gesture-handler/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ buildscript {
1212
dependencies {
1313
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")
1414
classpath("com.android.tools.build:gradle:7.2.1")
15-
classpath("com.diffplug.spotless:spotless-plugin-gradle:6.7.2")
15+
classpath("com.diffplug.spotless:spotless-plugin-gradle:7.0.3")
1616
}
1717
}
1818

packages/react-native-gesture-handler/android/noreanimated/src/main/java/com/swmansion/gesturehandler/ReanimatedEventDispatcher.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import com.facebook.react.bridge.ReactContext
44
import com.facebook.react.uimanager.events.Event
55

66
class ReanimatedEventDispatcher {
7-
@Suppress("UNUSED_PARAMETER", "COMMENT_IN_SUPPRESSION")
87
// This is necessary on new architecture
9-
fun <T : Event<T>>sendEvent(event: T, reactApplicationContext: ReactContext) {
8+
@Suppress("UNUSED_PARAMETER", "COMMENT_IN_SUPPRESSION")
9+
fun <T : Event<T>> sendEvent(event: T, reactApplicationContext: ReactContext) {
1010
// no-op
1111
}
1212
}

packages/react-native-gesture-handler/android/package77/src/main/java/com/swmansion/gesturehandler/RNGestureHandlerPackage.kt

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,45 +16,40 @@ import com.swmansion.gesturehandler.react.RNGestureHandlerRootViewManager
1616

1717
@ReactModuleList(
1818
nativeModules = [
19-
RNGestureHandlerModule::class
20-
]
19+
RNGestureHandlerModule::class,
20+
],
2121
)
22-
class RNGestureHandlerPackage : BaseReactPackage(), ViewManagerOnDemandReactPackage {
22+
class RNGestureHandlerPackage :
23+
BaseReactPackage(),
24+
ViewManagerOnDemandReactPackage {
2325
private val viewManagers: Map<String, ModuleSpec> by lazy {
2426
mapOf(
2527
RNGestureHandlerRootViewManager.REACT_CLASS to ModuleSpec.viewManagerSpec {
2628
RNGestureHandlerRootViewManager()
2729
},
2830
RNGestureHandlerButtonViewManager.REACT_CLASS to ModuleSpec.viewManagerSpec {
2931
RNGestureHandlerButtonViewManager()
30-
}
32+
},
3133
)
3234
}
3335

3436
override fun createViewManagers(reactContext: ReactApplicationContext) =
35-
listOf<ViewManager<*, *>>(
36-
RNGestureHandlerRootViewManager(),
37-
RNGestureHandlerButtonViewManager()
38-
)
37+
listOf<ViewManager<*, *>>(RNGestureHandlerRootViewManager(), RNGestureHandlerButtonViewManager())
3938

40-
override fun getViewManagerNames(reactContext: ReactApplicationContext) =
41-
viewManagers.keys.toList()
39+
override fun getViewManagerNames(reactContext: ReactApplicationContext) = viewManagers.keys.toList()
4240

4341
override fun getViewManagers(reactContext: ReactApplicationContext): MutableList<ModuleSpec> =
4442
viewManagers.values.toMutableList()
4543

46-
override fun createViewManager(
47-
reactContext: ReactApplicationContext,
48-
viewManagerName: String
49-
) = viewManagers[viewManagerName]?.provider?.get() as? ViewManager<*, *>
44+
override fun createViewManager(reactContext: ReactApplicationContext, viewManagerName: String) =
45+
viewManagers[viewManagerName]?.provider?.get() as? ViewManager<*, *>
5046

51-
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
52-
return if (name == RNGestureHandlerModule.NAME) {
47+
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? =
48+
if (name == RNGestureHandlerModule.NAME) {
5349
RNGestureHandlerModule(reactContext)
5450
} else {
5551
null
5652
}
57-
}
5853

5954
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
6055
try {
@@ -72,8 +67,8 @@ class RNGestureHandlerPackage : BaseReactPackage(), ViewManagerOnDemandReactPack
7267
reactModule.canOverrideExistingModule,
7368
reactModule.needsEagerInit,
7469
reactModule.isCxxModule,
75-
true
76-
)
70+
true,
71+
),
7772
)
7873
}
7974
} catch (e: InstantiationException) {

packages/react-native-gesture-handler/android/packageDeprecated/src/main/java/com/swmansion/gesturehandler/RNGestureHandlerPackage.kt

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,45 +16,40 @@ import com.swmansion.gesturehandler.react.RNGestureHandlerRootViewManager
1616

1717
@ReactModuleList(
1818
nativeModules = [
19-
RNGestureHandlerModule::class
20-
]
19+
RNGestureHandlerModule::class,
20+
],
2121
)
22-
class RNGestureHandlerPackage : BaseReactPackage(), ViewManagerOnDemandReactPackage {
22+
class RNGestureHandlerPackage :
23+
BaseReactPackage(),
24+
ViewManagerOnDemandReactPackage {
2325
private val viewManagers: Map<String, ModuleSpec> by lazy {
2426
mapOf(
2527
RNGestureHandlerRootViewManager.REACT_CLASS to ModuleSpec.viewManagerSpec {
2628
RNGestureHandlerRootViewManager()
2729
},
2830
RNGestureHandlerButtonViewManager.REACT_CLASS to ModuleSpec.viewManagerSpec {
2931
RNGestureHandlerButtonViewManager()
30-
}
32+
},
3133
)
3234
}
3335

3436
override fun createViewManagers(reactContext: ReactApplicationContext) =
35-
listOf<ViewManager<*, *>>(
36-
RNGestureHandlerRootViewManager(),
37-
RNGestureHandlerButtonViewManager()
38-
)
37+
listOf<ViewManager<*, *>>(RNGestureHandlerRootViewManager(), RNGestureHandlerButtonViewManager())
3938

40-
override fun getViewManagerNames(reactContext: ReactApplicationContext?) =
41-
viewManagers.keys.toList()
39+
override fun getViewManagerNames(reactContext: ReactApplicationContext?) = viewManagers.keys.toList()
4240

4341
override fun getViewManagers(reactContext: ReactApplicationContext?): MutableList<ModuleSpec> =
4442
viewManagers.values.toMutableList()
4543

46-
override fun createViewManager(
47-
reactContext: ReactApplicationContext?,
48-
viewManagerName: String?
49-
) = viewManagers[viewManagerName]?.provider?.get() as? ViewManager<*, *>
44+
override fun createViewManager(reactContext: ReactApplicationContext?, viewManagerName: String?) =
45+
viewManagers[viewManagerName]?.provider?.get() as? ViewManager<*, *>
5046

51-
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
52-
return if (name == RNGestureHandlerModule.NAME) {
47+
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? =
48+
if (name == RNGestureHandlerModule.NAME) {
5349
RNGestureHandlerModule(reactContext)
5450
} else {
5551
null
5652
}
57-
}
5853

5954
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
6055
try {
@@ -72,8 +67,8 @@ class RNGestureHandlerPackage : BaseReactPackage(), ViewManagerOnDemandReactPack
7267
reactModule.canOverrideExistingModule,
7368
reactModule.needsEagerInit,
7469
reactModule.isCxxModule,
75-
true
76-
)
70+
true,
71+
),
7772
)
7873
}
7974
} catch (e: InstantiationException) {

packages/react-native-gesture-handler/android/paper/src/main/java/com/swmansion/gesturehandler/ReactContextExtensions.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ fun ReactContext.dispatchEvent(event: Event<*>) {
88
try {
99
this.getNativeModule(UIManagerModule::class.java)!!.eventDispatcher.dispatchEvent(event)
1010
} catch (e: NullPointerException) {
11-
throw Exception("Couldn't get an instance of UIManagerModule. Gesture Handler is unable to send an event.", e)
11+
throw Exception(
12+
"Couldn't get an instance of UIManagerModule. Gesture Handler is unable to send an event.",
13+
e,
14+
)
1215
}
1316
}

packages/react-native-gesture-handler/android/paper77/src/main/java/com/swmansion/gesturehandler/ReactContextExtensions.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ fun ReactContext.dispatchEvent(event: Event<*>) {
88
try {
99
this.getNativeModule(UIManagerModule::class.java)!!.eventDispatcher.dispatchEvent(event)
1010
} catch (e: NullPointerException) {
11-
throw Exception("Couldn't get an instance of UIManagerModule. Gesture Handler is unable to send an event.", e)
11+
throw Exception(
12+
"Couldn't get an instance of UIManagerModule. Gesture Handler is unable to send an event.",
13+
e,
14+
)
1215
}
1316
}

packages/react-native-gesture-handler/android/reanimated/src/main/java/com/swmansion/gesturehandler/ReanimatedEventDispatcher.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import com.swmansion.reanimated.ReanimatedModule
77
class ReanimatedEventDispatcher {
88
private var reanimatedModule: ReanimatedModule? = null
99

10-
fun <T : Event<T>>sendEvent(event: T, reactApplicationContext: ReactContext) {
10+
fun <T : Event<T>> sendEvent(event: T, reactApplicationContext: ReactContext) {
1111
if (reanimatedModule == null) {
1212
reanimatedModule = reactApplicationContext.getNativeModule(ReanimatedModule::class.java)
1313
}

packages/react-native-gesture-handler/android/spotless.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ apply plugin: "com.diffplug.spotless"
33
spotless {
44
kotlin {
55
target "**/*.kt"
6-
ktlint().editorConfigOverride([indent_size: 2])
6+
ktlint().editorConfigOverride([indent_size: 2, max_line_length: 120])
77
trimTrailingWhitespace()
8-
indentWithSpaces()
8+
leadingTabsToSpaces()
99
endWithNewline()
1010
}
1111
}

packages/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/core/FlingGestureHandler.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@ class FlingGestureHandler : GestureHandler<FlingGestureHandler>() {
3939

4040
val velocityVector = Vector.fromVelocity(velocityTracker!!)
4141

42-
fun getVelocityAlignment(
43-
direction: Int,
44-
maxDeviationCosine: Double,
45-
): Boolean = (
42+
fun getVelocityAlignment(direction: Int, maxDeviationCosine: Double): Boolean = (
4643
(this.direction and direction) == direction &&
4744
velocityVector.isSimilar(Vector.fromDirection(direction), maxDeviationCosine)
4845
)

0 commit comments

Comments
 (0)