compose-lints
compose-lints copied to clipboard
Idea: Add a lint that looks for un-remembered instantiation of types or functions whose names end in "State"
This would be similar to the new UnrememberedStateDetector in androidx, but be a warning lint to catch likely cases. @StateFactoryMarker works for functions, but it doesn't help with cases where people instantiate state classes directly.
Thoughts @chrisbanes @mrmans0n?
Sounds good to me! I thought we had something like that already? Or maybe it was an idea we had but never got around to implementing.
We have the view model factory lint but not sure there's anything else
Note for the future - could just be a modified version of the first-party lint https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/runtime/runtime-lint/src/main/java/androidx/compose/runtime/lint/UnrememberedStateDetector.kt