Skip to content

the-sett/elm-review-architecture

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

elm-review-module-layer-dependency

elm-review rules to detect violation of module importing by you defined layers.

If you defined a layer dependency rule like A <- B, elm-review-module-layer-dependency will detect an error with below importing.

module A

import B.Data

Module A depends on module B (A -> B) is a violation of defined rule.

Configuration

module ReviewConfig exposing (config)

import NoViolationOfModuleLayerDependency exposing (ModuleLayer(..), ModuleLayerDependency(..))
import Review.Rule exposing (Error, Rule)


config : List Rule
config =
    [ NoViolationOfModuleLayerDependency.rule moduleLayerRule
    ]


moduleLayerRule : ModuleLayerDependency
moduleLayerRule =
    ModuleLayerDependency
        [ infraLayer
        , applicationLayer
        , DefaultLayer
        , adapterLayer
        ]


adapterLayer : ModuleLayer
adapterLayer =
    ModuleLayer
        [ [ "Adapter" ]
        , [ "Main" ]
        ]


applicationLayer : ModuleLayer
applicationLayer =
    ModuleLayer
        [ [ "Application" ]
        ]


infraLayer : ModuleLayer
infraLayer =
    ModuleLayer
        [ [ "Infra" ]
        ]

If you want to define a Page layer that is under UI.Pages, write this.

pageLayer : ModuleLayer
pageLayer =
    ModuleLayer
        [ [ "UI", "Pages" ] -- It means "Any modules under UI.Pages.*".
        ]

About

Elm Review rules for enforcing Architecture

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages