Yagger / elm-review-no-url-string-concatenation / NoUrlStringConcatenation

rule : Review.Rule.Rule

Reports expressions concatenating strings with forward slash

config =
    [ NoUrlStringConcatenation.rule
    ]

Fail

a =
    baseUrl ++ "/items/" ++ itemId

Success

a =
    Url.Builder.crossOrigin baseUrl [ "items", "itemId" ]

When (not) to enable this rule

This rule is useful when there are many expressions that build URL using string concatenation. This rule is not useful when there are plenty of expressions concatenating non-url strings that contain forward slash.

Try it out

You can try this rule out by running the following command:

elm-review --template Yagger/elm-review-no-url-string-concatenation/example --rules NoUrlStringConcatenation