rule : List ( List String, List String ) -> Review.Rule.Rule
Reports uses of certain functions outside of certain modules.
config =
[ NoFunctionOutsideOfModules.rule [ ( [ "Html.input" ], [ "View.Input" ] ) ]
]
Using a qualified name outside of module
module Main exposing (main)
import Html
main : Html.Html a
main =
Html.input [] []
Using an exposed name outside of module
module Main exposing (main)
import Html exposing (input)
main : Html.Html a
main =
input [] []
module View.Input exposing (customInput)
import Html
customInput : Html.Html a
customInput =
Html.input [] []
This rule is useful when you want people to only use a certain function in certain modules. This is useful especially for input fields or design elements, so your app looks consistent overall. This rule is not useful when you don't think it's worth it to trade consistency over flexibility.
Consider changing your API before enabling this rule. It's usually better to have a good API that can enforce usage patterns than to rely on a rule.
You can try this rule out by running the following command:
elm-review --template henriquecbuss/elm-review-no-function-outside-of-modules/example-with-no-html-input-outside-of-view --rules NoFunctionOutsideOfModules