Find non-private MutableStateFlow properties

Proprietary

Convention pattern: private val _state = MutableStateFlow(...); val state: StateFlow<T> = _state.asStateFlow(). A non-private MutableStateFlow property exposes the writable handle to consumers — anyone who can read it can also call .value = … or tryEmit(...), breaking the unidirectional-data-flow contract the ViewModel is supposed to enforce. Make the field private and expose a read-only StateFlow view.

org.openrewrite.kotlin.compose.FindPublicMutableStateFlowProperty$KtRecipe
mod run . --recipe='org.openrewrite.kotlin.compose.FindPublicMutableStateFlowProperty$KtRecipe'

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.