slackhq/compose-lints

Idea: Add a check for functions that don't need to be annotated with `@Composable` but are.

yogurtearl opened this issue · 3 comments

Some functions don't need to be @Composable but are.

Maybe the function originally used some other @Composable thing but it was removed at some point, would be nice to have a lint check that reported "@Composable can be removed from function foo()"

Hmm, would a simple example of that be something like

@Composable fun example() = println("derp")

?

Yes. :)

That would trigger the issue to say "@Composable is not needed for this function/property"

Ideally any function/property that compiles just fine and works the same if you remove the @Composable annotation should trigger the warning, but even just covering basic cases would still be useful as some cases might be harder to detect.

This scenario can be hard to visually detect in code review for non-trivial functions, especially if you are not in an IDE.