mirror of
https://github.com/jfmengels/elm-review.git
synced 2024-12-24 18:23:09 +03:00
Extract moduleVisitorSchema in project rules to get better error messages
This commit is contained in:
parent
89a3a3d1b4
commit
b4b70ef582
@ -54,16 +54,7 @@ unused modules in your application or package.
|
||||
rule : Rule
|
||||
rule =
|
||||
Rule.newProjectRuleSchema "NoUnused.Exports"
|
||||
{ moduleVisitorSchema =
|
||||
\schema ->
|
||||
schema
|
||||
|> Scope.addModuleVisitors
|
||||
{ set = \scope context -> { context | scope = scope }
|
||||
, get = .scope
|
||||
}
|
||||
|> Rule.withModuleDefinitionVisitor moduleDefinitionVisitor
|
||||
|> Rule.withDeclarationListVisitor declarationListVisitor
|
||||
|> Rule.withExpressionVisitor expressionVisitor
|
||||
{ moduleVisitorSchema = moduleVisitorSchema
|
||||
, initProjectContext = initProjectContext
|
||||
, fromProjectToModule = fromProjectToModule
|
||||
, fromModuleToProject = fromModuleToProject
|
||||
@ -79,6 +70,18 @@ rule =
|
||||
|> Rule.fromProjectRuleSchema
|
||||
|
||||
|
||||
moduleVisitorSchema : Rule.ModuleRuleSchema {} ModuleContext -> Rule.ModuleRuleSchema { hasAtLeastOneVisitor : () } ModuleContext
|
||||
moduleVisitorSchema schema =
|
||||
schema
|
||||
|> Scope.addModuleVisitors
|
||||
{ set = \scope context -> { context | scope = scope }
|
||||
, get = .scope
|
||||
}
|
||||
|> Rule.withModuleDefinitionVisitor moduleDefinitionVisitor
|
||||
|> Rule.withDeclarationListVisitor declarationListVisitor
|
||||
|> Rule.withExpressionVisitor expressionVisitor
|
||||
|
||||
|
||||
|
||||
-- CONTEXT
|
||||
|
||||
|
@ -47,11 +47,7 @@ unused modules in your application or package.
|
||||
rule : Rule
|
||||
rule =
|
||||
Rule.newProjectRuleSchema "NoUnused.Modules"
|
||||
{ moduleVisitorSchema =
|
||||
\schema ->
|
||||
schema
|
||||
|> Rule.withImportVisitor importVisitor
|
||||
|> Rule.withDeclarationListVisitor declarationListVisitor
|
||||
{ moduleVisitorSchema = moduleVisitorSchema
|
||||
, initProjectContext = initProjectContext
|
||||
, fromProjectToModule = fromProjectToModule
|
||||
, fromModuleToProject = fromModuleToProject
|
||||
@ -62,6 +58,13 @@ rule =
|
||||
|> Rule.fromProjectRuleSchema
|
||||
|
||||
|
||||
moduleVisitorSchema : Rule.ModuleRuleSchema {} ModuleContext -> Rule.ModuleRuleSchema { hasAtLeastOneVisitor : () } ModuleContext
|
||||
moduleVisitorSchema schema =
|
||||
schema
|
||||
|> Rule.withImportVisitor importVisitor
|
||||
|> Rule.withDeclarationListVisitor declarationListVisitor
|
||||
|
||||
|
||||
|
||||
-- CONTEXT
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user