Rename module rule's phantom fields to canCollectProjectData

This commit is contained in:
Jeroen Engels 2020-03-08 00:54:18 +01:00
parent 0d33ab05e7
commit c141fdb1ae
3 changed files with 8 additions and 9 deletions

View File

@ -516,7 +516,7 @@ take a look at [`withInitialContext`](#withInitialContext) and "with\*" function
newModuleRuleSchema :
String
-> moduleContext
-> ModuleRuleSchema { withElmJsonModuleVisitor : (), withDependenciesModuleVisitor : () } moduleContext
-> ModuleRuleSchema { canCollectProjectData : () } moduleContext
newModuleRuleSchema name_ moduleContext =
emptySchema name_ moduleContext
@ -1671,8 +1671,8 @@ The following example forbids exposing a file in an "Internal" directory in your
-}
withElmJsonModuleVisitor :
(Maybe Elm.Project.Project -> moduleContext -> moduleContext)
-> ModuleRuleSchema { anything | withElmJsonModuleVisitor : () } moduleContext
-> ModuleRuleSchema { anything | withElmJsonModuleVisitor : () } moduleContext
-> ModuleRuleSchema { anything | canCollectProjectData : () } moduleContext
-> ModuleRuleSchema { anything | canCollectProjectData : () } moduleContext
withElmJsonModuleVisitor visitor (ModuleRuleSchema schema) =
ModuleRuleSchema { schema | elmJsonVisitors = visitor :: schema.elmJsonVisitors }
@ -1681,8 +1681,8 @@ withElmJsonModuleVisitor visitor (ModuleRuleSchema schema) =
-}
withDependenciesModuleVisitor :
(Dict String Review.Project.Dependency.Dependency -> moduleContext -> moduleContext)
-> ModuleRuleSchema { anything | withDependenciesModuleVisitor : () } moduleContext
-> ModuleRuleSchema { anything | withDependenciesModuleVisitor : () } moduleContext
-> ModuleRuleSchema { anything | canCollectProjectData : () } moduleContext
-> ModuleRuleSchema { anything | canCollectProjectData : () } moduleContext
withDependenciesModuleVisitor visitor (ModuleRuleSchema schema) =
ModuleRuleSchema { schema | dependenciesVisitors = visitor :: schema.dependenciesVisitors }

View File

@ -83,8 +83,8 @@ emptyScope =
addVisitors :
Rule.ModuleRuleSchema { anything | withDependenciesModuleVisitor : () } { context | scope : Context }
-> Rule.ModuleRuleSchema { anything | withDependenciesModuleVisitor : (), hasAtLeastOneVisitor : () } { context | scope : Context }
Rule.ModuleRuleSchema { anything | canCollectProjectData : () } { context | scope : Context }
-> Rule.ModuleRuleSchema { anything | canCollectProjectData : (), hasAtLeastOneVisitor : () } { context | scope : Context }
addVisitors schema =
schema
|> Rule.withDependenciesModuleVisitor

View File

@ -33,8 +33,7 @@ testRule rule string =
baseRule :
Rule.ModuleRuleSchema
{ hasAtLeastOneVisitor : ()
, withDependenciesModuleVisitor : ()
, withElmJsonModuleVisitor : ()
, canCollectProjectData : ()
}
Context
baseRule =