slackhq / compose-lints

Lint checks to aid with a healthy adoption of Compose
https://slackhq.github.io/compose-lints
Apache License 2.0
388 stars 21 forks source link

ComposeContentEmitterReturningValues incorrectly reports on compose functions with multiple top-level emitters #339

Open acrab opened 4 months ago

acrab commented 4 months ago

Example code:

@Composable
fun Test(modifier: Modifier = Modifier){
    Text(text = "TextOne")
    Text(text = "TextTwo")
}

Expected result: ComposeMultipleContentEmitters lint rule will trigger

Actual result: Both that rule and ComposeContentEmitterReturningValues trigger, leading to a confusing set of warnings!

image

ZacSweers commented 4 months ago

PR welcome!