appKODE / detekt-rules-compose

A collection of Detekt rules for Jetpack Compose
MIT License
136 stars 8 forks source link

Not detekt on CompositionLocalProvider due to Modifier wrong level #20

Closed Robotjan closed 1 year ago

Robotjan commented 2 years ago

Composable uses "modifier" on the wrong level, non-direct children should use "Modifier"

fun Button(modifier: Modifier, ...) {
    CompositionLocalProvider(LocalRippleTheme provides TextButtonRippleTheme) {
        MaterialTextButton(
            modifier = modifier,
            ...
        )
    }
}
dimsuz commented 1 year ago

This is a known issue, expected to be fixed by switching this rule to use type resolution (detekt feature), see #5 For now you can use @Suppress("ReusedModifierInstance") for this case.