Closed pokk closed 1 year ago
I'm also facing the same problem. I set previewPublicOnlyIfParams false. https://twitter.github.io/compose-rules/detekt/ related Issue: https://github.com/twitter/compose-rules/issues/95
PreviewPublic:
active: true
# You can optionally disable that only previews with @PreviewParameter are flagged
# previewPublicOnlyIfParams: false
Discussing here. https://github.com/mrmans0n/compose-rules/issues/24
Will close since there is the same discussion
Describe the bug According to Preview composables should not be public, a preview function should give us a lint error/warning. However, it doesn't.
To Reproduce Steps to reproduce the behavior:
Expected behavior It should have a lint error/warning for a public preview function.
Screenshots
Environment lib version:
detekt-twitter-compose-0.0.26-all.jar
Android Studio: Android Studio Giraffe | 2022.3.1 Beta 1 OS: macOs Ventura 13.3.1Additional context Only a preview function with
@PreviewParameter
will have a lint error/warning.https://github.com/twitter/compose-rules/blob/main/rules/common/src/main/kotlin/com/twitter/compose/rules/ComposePreviewPublic.kt#L22-L28 Just guessing, it might have the intention to do this. According to Preview composables should not be public, it doesn't describe clearly. Either one might be wrong 🤔