Skip to content

Commit

Permalink
Small rule tweaks to m3 (#79)
Browse files Browse the repository at this point in the history
This makes it an H2 header and also specifies configuration via lint.xml
  • Loading branch information
ZacSweers authored Mar 7, 2023
1 parent c713528 commit 904cf86
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions docs/rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,21 +295,29 @@ More info: [Modifier extensions](https://developer.android.com/reference/kotlin/

Related rule: [`ComposeComposableModifier`](https://github.com/slackhq/compose-lints/blob/main/compose-lint-checks/src/main/java/slack/lint/compose/ModifierComposableDetector.kt)

### Use Material 3
## Use Material 3

Rule: [`ComposeM2Api`](https://github.com/slackhq/compose-lints/blob/main/compose-lint-checks/src/main/java/slack/lint/compose/M2ApiDetector.kt)

Material 3 (M3) reached stable in October 2022. In apps that have migrated to M3, there may be `androidx.compose.material` (M2) APIs still remaining on the classpath from libraries or dependencies that can cause confusing imports due to the many similar or colliding Composable names in the two libraries. The `ComposeM2Api` rule can prevent these from being used.

!!! warning "Lint Configuration"
This rule is set to `IGNORE` by default and is **opt-in**. You can make it an error via `lint` in Gradle.
This rule is set to `IGNORE` by default and is **opt-in**.

You can make it an error via the `lint` DSL in Gradle:
```kotlin
android {
lint {
error += "ComposeM2Api"
}
}
```
Or in `lint.xml`:
```xml
<lint>
<issue id="ComposeM2Api" severity="error" />
</lint>
```
More lint configuration docs can be found [here](https://developer.android.com/studio/write/lint#gradle).

!!! note "Allow-list Configuration"
Expand Down

0 comments on commit 904cf86

Please sign in to comment.