jere

joined 2 years ago
[โ€“] jere@feddit.org 3 points 3 days ago

Well, I recommend you trying to use the spotless plugin for Maven/Gradle and configuring ktlint or ktfmt. Maybe try ktlint first with my configuration tips. If it doesn't work, you could show us your repository or a snippet of it.

[โ€“] jere@feddit.org 3 points 3 days ago* (last edited 2 days ago) (2 children)

I use ktlint with spotless. If you want to remove unused imports and wildcard imports, you need to activate those rules in your .editorconfig file in your project dir.

Please add following lines to your .editorconfig for correct behavior with IntelliJ:

https://pinterest.github.io/ktlint/latest/rules/configuration-intellij-idea/

No unused imports and no wildcard imports are standard rules:

https://pinterest.github.io/ktlint/latest/rules/standard/

Add ktlint rules in the same file:

ktlint_standard_no-wildcard-imports = enabled
ktlint_standard_no-unused-imports = enabled