From c141fdb1aebf99722a8361f40abf90bdc4960877 Mon Sep 17 00:00:00 2001 From: Jeroen Engels Date: Sun, 8 Mar 2020 00:54:18 +0100 Subject: [PATCH] Rename module rule's phantom fields to canCollectProjectData --- src/Review/Rule.elm | 10 +++++----- src/Scope.elm | 4 ++-- tests/ScopeTest.elm | 3 +-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/Review/Rule.elm b/src/Review/Rule.elm index c9fa49c7..b1422d92 100644 --- a/src/Review/Rule.elm +++ b/src/Review/Rule.elm @@ -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 } diff --git a/src/Scope.elm b/src/Scope.elm index b4ead062..53fcf051 100644 --- a/src/Scope.elm +++ b/src/Scope.elm @@ -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 diff --git a/tests/ScopeTest.elm b/tests/ScopeTest.elm index 9d379b71..7ace6cef 100644 --- a/tests/ScopeTest.elm +++ b/tests/ScopeTest.elm @@ -33,8 +33,7 @@ testRule rule string = baseRule : Rule.ModuleRuleSchema { hasAtLeastOneVisitor : () - , withDependenciesModuleVisitor : () - , withElmJsonModuleVisitor : () + , canCollectProjectData : () } Context baseRule =