KtLint: Function name should start with a lowercase letter for Composable Functions

1k views Asked by At

Function name should start with a lowercase letter (except factory methods) and use camel case (cannot be auto-corrected)

I am trying to disable this warning but the rule I'm trying is not working. Below is the code that I'm using.

id("org.jlleitschuh.gradle.ktlint") version "12.0.3"

ktlint {
    version.set("1.1.0")
    debug.set(true)
    enableExperimentalRules.set(true)
    additionalEditorconfig.set(
        mapOf(
            "max_line_length" to "off",
            "ktlint_function_naming_ignore_when_annotated_with" to "Composable"
        ),
    )
}

Here is the link to the issue and library. JLLeitschuh/ktlint-gradle/issues/736

1

There are 1 answers

4
AndroidLover On

You can use the same rule from the .ediConfig file that you would add in the root of you project. So just add a line:

ktlint_function_naming_ignore_when_annotated_with = Composable