mirror of
https://github.com/jfmengels/elm-review.git
synced 2024-11-30 23:12:13 +03:00
31 lines
993 B
Elm
31 lines
993 B
Elm
module WithModuleContext_AtMostOnce exposing (rule)
|
|
|
|
{-| We want to forbid `Rule.withModuleContext` from being called twice.
|
|
-}
|
|
|
|
import Review.Rule as Rule exposing (Rule)
|
|
|
|
|
|
rule : Rule
|
|
rule =
|
|
Rule.newProjectRuleSchema "WithModuleContext_AtMostOnce" ()
|
|
|> Rule.withModuleVisitor moduleVisitor
|
|
|> Rule.withModuleContext
|
|
{ fromProjectToModule = \_ _ () -> ()
|
|
, fromModuleToProject = \_ _ () -> ()
|
|
, foldProjectContexts = \_ () -> ()
|
|
}
|
|
|> Rule.withModuleContext
|
|
{ fromProjectToModule = \_ _ () -> ()
|
|
, fromModuleToProject = \_ _ () -> ()
|
|
, foldProjectContexts = \_ () -> ()
|
|
}
|
|
|> Rule.withFinalProjectEvaluation (\_ -> [])
|
|
|> Rule.fromProjectRuleSchema
|
|
|
|
|
|
moduleVisitor : Rule.ModuleRuleSchema {} () -> Rule.ModuleRuleSchema { hasAtLeastOneVisitor : () } ()
|
|
moduleVisitor schema =
|
|
schema
|
|
|> Rule.withModuleDefinitionVisitor (\_ () -> ( [], () ))
|