Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a custom modifier using a composable modifier factory is now recommended, however it is still failing "Avoid Modifier extension factory functions" #130

Open
YingChen0605 opened this issue Aug 5, 2024 · 3 comments

Comments

@YingChen0605
Copy link

YingChen0605 commented Aug 5, 2024

Describe the bug

https://twitter.github.io/compose-rules/rules/#avoid-modifier-extension-factory-functions is no longer true now. Refer to the official documentation:

Note: In previous versions of Compose, we recommended against this approach and suggested using composed {} instead via a lint rule. Now that composed {} is not recommended, the lint rule has been removed.

To Reproduce
Steps to reproduce the behavior:
Adding a new Composable:

@Composable
private fun Modifier.modify(viewModel: xxViewModel) =  this then Modifier.viewable(onView = viewModel.onView)
        .margin(margin = viewModel.margin)

Expected behavior
It should not be flagged as a violation.

Screenshots
Screenshot 2024-08-05 at 12 21 31 PM

Environment
com.twitter.compose.rules.detekt of 0.0.26

@kenyee
Copy link
Contributor

kenyee commented Aug 5, 2024

@YingChen0605
Copy link
Author

YingChen0605 commented Aug 5, 2024

@kenyee Thank you for getting back so quickly and informing about the migration! 👍
Assuming https://github.com/twitter/[compose-rules](https://github.com/twitter/compose-rules) is now deprecated.
Would you suggest choosing between https://github.com/mrmans0n/compose-rules(ktlint and detekt) and
https://slackhq.github.io/compose-lints/(lint) for use? Do their rules overlap to some extent?

@kenyee
Copy link
Contributor

kenyee commented Aug 5, 2024

use the one that fits your usage best. Slack's is done using Android lint. The original was ktlint+detekt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants