jfmengels / elm-review-common / NoImportingEverything

rule : List String -> Review.Rule.Rule

Forbids importing everything from a module.

When you import everything from a module, it becomes harder to know where a function or a type comes from. The official guide even recommends against importing everything.

config =
    [ NoImportingEverything.rule []
    ]

Teams often have an agreement on the list of imports from which it is okay to expose everything, so you can configure a list of exceptions.

config =
    [ NoImportingEverything.rule [ "Html", "Some.Module" ]
    ]

Fail

import A exposing (..)
import A as B exposing (..)

Success

import A as B exposing (B(..), C, d)

-- If configured with `[ "Html" ]`
import Html exposing (..)

Try it out

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

elm-review --template jfmengels/elm-review-common/example --rules NoImportingEverything