jeremymailen / kotlinter-gradle

Painless, fast ktlint plugin for Gradle

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Remove trailing comma

hantsy opened this issue · comments

Upgraded to the latest version 3.14.0, when formatting the codes, it adds the trailing comma back by default.

I have tried to add the following .editorconfig according to the Ktlint docs, it does not work(all data classes, fun parameters still add commas).

[*.{kt,kts}]
ktlint_code_style=official
ij_kotlin_allow_trailing_comma_on_call_site=false
ktlint_standard_trailing-comma-on-call-site=false
ij_kotlin_allow_trailing_comma=false
ktlint_standard_trailing-comma-on-declaration-site=false

This got me too the first time, but see here.
The value to use is disabled rather that false.

@jeremymailen Which one use disabled, the example config in the doc https://pinterest.github.io/ktlint/rules/configuration-ktlint/#trailing-comma-on-call-site uses a false there.

Thanks @jeremymailen

[*.{kt,kts}]
ktlint_code_style=official
ij_kotlin_allow_trailing_comma_on_call_site=false
ktlint_standard_trailing-comma-on-call-site=disabled
ij_kotlin_allow_trailing_comma=false
ktlint_standard_trailing-comma-on-declaration-site=disabled

It works.

Another format I can not find in Ktlint config. I want to keep the ; in the enum class, I've created a new issue to describe it, #319