pinterest/ktlint

Relax `FileName` rule to allow a single top-level extension

igorwojda opened this issue · 1 comments

FileName rule

Sample:

File MutableLiveDataExt.kt

package com.igorwojda.showcase.base.presentation.ext

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData

@Suppress("detekt.UnsafeCast")
fun <T> MutableLiveData<T>.asLiveData() = this as LiveData<T>

Expected Behavior

Ignore this rule for files containing a single tope-level extension

Current Behavior

/Users/igorwojda/StudioProjects/android-showcase/feature_base/src/main/kotlin/com/igorwojda/showcase/base/presentation/ext/MutableLiveDataExt.kt:1:1: File 'MutableLiveDataExt.kt' contains a single top level declaration and should be named 'AsLiveData.kt' [Filename]

Additional information

4.61.0

This was already fixed in ktlint 0.47.0.