slackhq/compose-lints

Sample/documentation to use the lint rules for compose mpp projects

sureshg opened this issue ยท 2 comments

As per the current documentation, compose-lint should work for non-android projects by adding the following dependency and android lint plugin.

Just add the dependency to the lintChecks configuration. Note for non-android projects, you must apply the com.android.lint Gradle plugin to use this.

dependencies {
  lintChecks("com.slack.lint.compose:compose-lint-checks:<version>")
}

But it's not working as expected for a compose mpp project as it can't find the main sourceset. So it would be great if you can provide some samples/documentation on how to configure this lint rules for compose mpp projects.

PRs welcome, I've never tried to apply it in a multiplatform project so I don't know off-hand. non-android really kinda means just jvm projects in this context, I'm not sure lint supports multiplatform.

Redwood may have some solutions

so the setup for multiplatform, js, jvm, and android kotlin plugins are all here: https://github.com/cashapp/redwood/blob/65be6c3ceec60d8b44eb304af8e93584ce3641fb/redwood-gradle-plugin/src/main/kotlin/app/cash/redwood/gradle/RedwoodLintPlugin.kt.

the task is in there as well, although it just forks a JVM to run the CLI which depends on lint. The lint setup within the CLI is here: https://github.com/cashapp/redwood/blob/65be6c3ceec60d8b44eb304af8e93584ce3641fb/redwood-cli/src/main/kotlin/app/cash/redwood/cli/LintCommand.kt