mrmans0n/compose-rules

Multiple modifier param composables

Closed this issue · 1 comments

Hello,

How can I have multiple modifier params without triggering detekt issues?

I.e i want to have a function similar to below:

@Composable
private fun XComponent(
    xData: XData,
    loadingModifier: Modifier,
    modifier: Modifier = Modifier,
) {

Detekt fails for line loadingModifier with ComposableParamOrder or ModifierWithoutDefault rules.

Add the default Modifier and move the loading one to be second.

@Composable
private fun XComponent(
    xData: XData,
    modifier: Modifier = Modifier,
    loadingModifier: Modifier = Modifier,
) {

All modifiers must have a default, and the ordering has to be "modifier" first and then the rest.