Open AfigAliyev opened 2 years ago
Currently these rules ignore only @Composable
trailing lambdas, because non-composable trailing lambdas are usually event handlers and they should follow the optional/required placement rule. We have discussed this in #12.
LazyColumn
seems to be an exception here, because it's a DSL for building content
, instead of content
being a @Composable
function.
I'm not sure yet how to best approach this:
LazyListScope
specifically sounds like something flaky, other such "exceptions" may surface laterBrainstorming (they are not good ideas, they are just random ideas that maybe help to find a solution):
content
.LazyListScope
as a default value.LazyListScope.() -> Unit
.I like the second option (ignore specified receivers) and the fourth one (ignore all trailing lambdas). Maybe they both can be added as configuration parameters, although the ignoring all lambdas set to true
will effectively override whatever is configured with second option, but this should not be too confusing.
I like the second option too, but I would like to add that it only makes sense to apply it to the last parameter of a function due to the DSL.
Did a little search. There is a similar library for compose [https://github.com/mrmans0n/compose-rules] (fork from Twitter library). And there this rule for argument order works correctly for lambdas (ContentTrailingLambda: https://mrmans0n.github.io/compose-rules/rules/#ordering-composable-parameters-properly).
Thank you!
I plan to also merge the rule ModifierParameterPosition
to the rule ComposableParameterOrdering
, because the latter supersedes the former.
ModifierParameterPosition
andComposableParametersOrdering
raise an issue. Thecontent
parameter should be the last parameter.