Skip to content

ComposableParamOrder behavior for lambdas with default values #416

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

Open
eygraber opened this issue Jan 23, 2025 · 1 comment
Open

ComposableParamOrder behavior for lambdas with default values #416

eygraber opened this issue Jan 23, 2025 · 1 comment

Comments

@eygraber
Copy link

If I have the following:

@Composable
fun Foo(
  onSelect: (Foo) -> Unit,
  displayMapper: (Foo) -> String = { it.name },
  title: String,
)

then ComposableParamOrder will trigger. To fix it I'd have to move displayMapper to the last position, which would allow it to be a trailing lambda, which isn't ideal in Compose.

@mrmans0n
Copy link
Owner

mrmans0n commented Feb 24, 2025

Yea, got it. What an incredibly unfortunate combo haha

I'll have to check before reporting the lint violation if there's a possible alternative that doesn't trigger the trailing lambda rule 😬 I don't love tying two rules together (because people might be disabling it but I guess being lenient that one time isn't that big of an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants