Ktlint doesn't allow wildcard import? (Using IntelliJ auto import feature)

Viewed 10705

I am running a Kotlin project with ktlint maven plugin (first time user). but whenever I do a maven build. I often see the failure along the lines of

src/main/kotlin/com/myproject/model/User.kt:7:1: Wildcard import (cannot be auto-corrected)

Since I use IntelliJ, I often rely on auto import where many subpackages are grouped into a wildcard (*). Is this what ktline used to enforce good import practices?

2 Answers

I was using ktlint-gradle and using the command ./gradlew ktlintCheck and my .editorconfig wasn't getting picked up. I solved it by adding this to build.gradle

ktlint {
    disabledRules.set(setOf("no-wildcard-imports"))
}
Related