jxxcarlson/elm-review-codeinstaller/6.0.1

NOTE: the latest version is 13.0.0

Install.Function

Replace a function in a given module with a new implementation or add that function definition if it is not present in the module.

-- code for ReviewConfig.elm:
rule =
    Install.Function.init
        "Frontend"
        "view"
        """view model =
   Html.text "This is a test\""""
        |> Install.Function.makeRule

Running this rule will insert or replace the function view in the module Frontend with the new implementation.

makeRule : Config -> Rule

Create a rule that replaces a function in a given module with a new implementation or creates it if it is not present.

init : List String -> String -> String -> Config

Initialize the configuration for the rule.

type alias Config =
{ moduleName : String
, functionName : String
, functionImplementation : String
, theFunctionNodeExpression : Maybe (Node Expression)
, customErrorMessage : CustomError
}

Configuration for makeRule: add a clause to a case expression in a specified function in a specified module.

Custom error message to be displayed when running elm-review --fix or elm-review --fix-all