Skip to content

Commit

Permalink
Remove ModifierComposable rule (#395)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmans0n authored Dec 10, 2024
1 parent ffe7032 commit 3a7f3cd
Show file tree
Hide file tree
Showing 10 changed files with 2 additions and 168 deletions.
4 changes: 0 additions & 4 deletions docs/detekt.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ Compose:
active: true
# -- You can optionally add your own Modifier types
# customModifiers: BananaModifier,PotatoModifier
ModifierComposable:
active: true
# -- You can optionally add your own Modifier types
# customModifiers: BananaModifier,PotatoModifier
ModifierComposed:
active: true
# -- You can optionally add your own Modifier types
Expand Down
6 changes: 2 additions & 4 deletions docs/rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -621,15 +621,13 @@ More info: [Modifier documentation](https://developer.android.com/reference/kotl

### Avoid Modifier extension factory functions

Using `@Composable` builder functions for modifiers is not recommended, as they cause unnecessary recompositions. To avoid this, you should use [Modifier.Node](https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier.Node) instead. It will allow you to accomplish the same things while being very performant.

There is another API for creating custom modifiers, `composed {}`. This API is no longer recommended due to the performance issues it created, and like with the extension factory functions case, Modifier.Node is recommended instead.
For `@Composable` extension factory functions, there is an API for creating custom modifiers, `composed {}`. This API is no longer recommended due to the performance issues it created, and like with the extension factory functions case, Modifier.Node is recommended instead.

More info: [Modifier.Node](https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier.Node), [Compose Modifier.Node and where to find it, by Merab Tato Kutalia](https://proandroiddev.com/compose-modifier-node-and-where-to-find-it-merab-tato-kutalia-66f891c0e8), [Compose modifiers deep dive, with Leland Richardson](https://www.youtube.com/watch?v=BjGX2RftXsU) and [Composed modifier docs](https://developer.android.com/reference/kotlin/androidx/compose/ui/package-summary#(androidx.compose.ui.Modifier).composed(kotlin.Function1,kotlin.Function1)).

!!! info ""

:material-chevron-right-box: [compose:modifier-composable-check](https://github.com/mrmans0n/compose-rules/blob/main/rules/common/src/main/kotlin/io/nlopez/compose/rules/ModifierComposable.kt) and [compose:modifier-composed-check](https://github.com/mrmans0n/compose-rules/blob/main/rules/common/src/main/kotlin/io/nlopez/compose/rules/ModifierComposed.kt) ktlint :material-chevron-right-box: [ModifierComposable](https://github.com/mrmans0n/compose-rules/blob/main/rules/common/src/main/kotlin/io/nlopez/compose/rules/ModifierComposable.kt) and [ModifierComposed](https://github.com/mrmans0n/compose-rules/blob/main/rules/common/src/main/kotlin/io/nlopez/compose/rules/ModifierComposed.kt) detekt
:material-chevron-right-box: [compose:modifier-composed-check](https://github.com/mrmans0n/compose-rules/blob/main/rules/common/src/main/kotlin/io/nlopez/compose/rules/ModifierComposed.kt) ktlint :material-chevron-right-box: [ModifierComposed](https://github.com/mrmans0n/compose-rules/blob/main/rules/common/src/main/kotlin/io/nlopez/compose/rules/ModifierComposed.kt) detekt

## ComponentDefaults

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class ComposeRuleSetProvider : RuleSetProvider {
LambdaParameterInRestartableEffectCheck(config),
Material2Check(config),
ModifierClickableOrderCheck(config),
ModifierComposableCheck(config),
ModifierComposedCheck(config),
ModifierMissingCheck(config),
ModifierNamingCheck(config),
Expand Down

This file was deleted.

2 changes: 0 additions & 2 deletions rules/detekt/src/main/resources/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ Compose:
active: false
ModifierClickableOrder:
active: true
ModifierComposable:
active: true
ModifierComposed:
active: true
ModifierMissing:
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class ComposeRuleSetProvider :
RuleProvider { LambdaParameterInRestartableEffectCheck() },
RuleProvider { Material2Check() },
RuleProvider { ModifierClickableOrderCheck() },
RuleProvider { ModifierComposableCheck() },
RuleProvider { ModifierComposedCheck() },
RuleProvider { ModifierMissingCheck() },
RuleProvider { ModifierNamingCheck() },
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit 3a7f3cd

Please sign in to comment.