pinterest / ktlint

An anti-bikeshedding Kotlin linter with built-in formatter
https://pinterest.github.io/ktlint/
MIT License
6.25k stars 507 forks source link

Backing property in a companion object triggers a backing-property-naming violation #2877

Open ygnessin opened 4 days ago

ygnessin commented 4 days ago

Thank you so much for maintaining this library and for your attention to this issue.

Is this a bug, or is it intended behavior? If intended, I can open a feature request, because I don't think this should be a violation.

Expected Behavior

no ktlint violations

Observed Behavior

Lint error > [standard:backing-property-naming] Backing property is only allowed when a matching property or function exists

Steps to Reproduce

    companion object {
        private var _isEnabled = false
    }

    val isEnabled: Boolean
        get() = _isEnabled

Your Environment