jxxcarlson/elm-review-codeinstaller/9.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. The form of the rule is the same for nested modules:

rule =
    Install.Function.init
        "Foo.Bar"
        "earnInterest"
        "hoho model = { model | interest = 1.03 * model.interest }"
        |> Install.Function.makeRule
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 : String -> String -> String -> Config

Initialize the configuration for the rule.

type Config

Configuration for makeRule: add (or replace if function already exists) a function in a specified module.

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

Add the function after a specified declaration. Just give the name of a function, type, type alias or port and the function will be added after that declaration. Only work if the function is being added and not replaced.