mirror of
https://github.com/jfmengels/elm-review.git
synced 2024-12-24 10:14:04 +03:00
Rename withDependenciesVisitor to withModuleDependenciesVisitor
This commit is contained in:
parent
0cada05fe3
commit
89a3a3d1b4
@ -24,6 +24,6 @@ import Set exposing (Set)
|
||||
rule : Rule
|
||||
rule =
|
||||
Rule.newModuleRuleSchema "NoWithInitialContextAfterHavingAddedAVisitor" ()
|
||||
|> Rule.withDependenciesVisitor (\_ context -> context)
|
||||
|> Rule.withModuleDependenciesVisitor (\_ context -> context)
|
||||
|> Rule.withDeclarationListVisitor (\_ context -> ( [], context ))
|
||||
|> Rule.fromModuleRuleSchema
|
||||
|
@ -4,7 +4,7 @@ module Review.Rule exposing
|
||||
, newModuleRuleSchema, fromModuleRuleSchema
|
||||
, withSimpleModuleDefinitionVisitor, withSimpleCommentsVisitor, withSimpleImportVisitor, withSimpleDeclarationVisitor, withSimpleExpressionVisitor
|
||||
, withModuleDefinitionVisitor, withCommentsVisitor, withImportVisitor, Direction(..), withDeclarationVisitor, withDeclarationListVisitor, withExpressionVisitor, withFinalModuleEvaluation
|
||||
, withModuleElmJsonVisitor, withDependenciesVisitor
|
||||
, withModuleElmJsonVisitor, withModuleDependenciesVisitor
|
||||
, withFixes
|
||||
, Error, error, parsingError, errorRuleName, errorMessage, errorDetails, errorRange, errorFixes, errorFilePath
|
||||
, newProjectRuleSchema, fromProjectRuleSchema, traversingImportedModulesFirst, withProjectElmJsonVisitor, withProjectDependenciesVisitor, withFinalProjectEvaluation
|
||||
@ -24,7 +24,7 @@ contents of the file to analyze to the rule. The order in which things get passe
|
||||
|
||||
- Read project-related info (only collect data in these steps)
|
||||
- The `elm.json` file, visited by [`withModuleElmJsonVisitor`](#withModuleElmJsonVisitor)
|
||||
- The definition for dependencies, visited by [`withDependenciesVisitor`](#withDependenciesVisitor)
|
||||
- The definition for dependencies, visited by [`withModuleDependenciesVisitor`](#withModuleDependenciesVisitor)
|
||||
- Visit the file (in the following order)
|
||||
- The module definition, visited by [`withSimpleModuleDefinitionVisitor`](#withSimpleModuleDefinitionVisitor) and [`withModuleDefinitionVisitor`](#withModuleDefinitionVisitor)
|
||||
- The module's list of comments, visited by [`withSimpleCommentsVisitor`](#withSimpleCommentsVisitor) and [`withCommentsVisitor`](#withCommentsVisitor)
|
||||
@ -175,7 +175,7 @@ patterns you would want to forbid, but that are not handled by the example.
|
||||
|
||||
## Builder functions to analyze the project's data
|
||||
|
||||
@docs withModuleElmJsonVisitor, withDependenciesVisitor
|
||||
@docs withModuleElmJsonVisitor, withModuleDependenciesVisitor
|
||||
|
||||
|
||||
## Automatic fixing
|
||||
@ -363,7 +363,7 @@ take a look at [`withInitialContext`](#withInitialContext) and "with\*" function
|
||||
newModuleRuleSchema :
|
||||
String
|
||||
-> context
|
||||
-> ModuleRuleSchema { withModuleElmJsonVisitor : (), withDependenciesVisitor : () } context
|
||||
-> ModuleRuleSchema { withModuleElmJsonVisitor : (), withModuleDependenciesVisitor : () } context
|
||||
newModuleRuleSchema name_ context =
|
||||
emptySchema name_ context
|
||||
|
||||
@ -1319,11 +1319,11 @@ withModuleElmJsonVisitor visitor (ModuleRuleSchema schema) =
|
||||
ModuleRuleSchema { schema | elmJsonVisitors = visitor :: schema.elmJsonVisitors }
|
||||
|
||||
|
||||
withDependenciesVisitor :
|
||||
withModuleDependenciesVisitor :
|
||||
(Dict String Elm.Docs.Module -> context -> context)
|
||||
-> ModuleRuleSchema { anything | withDependenciesVisitor : () } context
|
||||
-> ModuleRuleSchema { anything | withDependenciesVisitor : () } context
|
||||
withDependenciesVisitor visitor (ModuleRuleSchema schema) =
|
||||
-> ModuleRuleSchema { anything | withModuleDependenciesVisitor : () } context
|
||||
-> ModuleRuleSchema { anything | withModuleDependenciesVisitor : () } context
|
||||
withModuleDependenciesVisitor visitor (ModuleRuleSchema schema) =
|
||||
ModuleRuleSchema { schema | dependenciesVisitors = visitor :: schema.dependenciesVisitors }
|
||||
|
||||
|
||||
|
@ -91,11 +91,11 @@ addVisitors :
|
||||
{ set : Context -> context -> context
|
||||
, get : context -> Context
|
||||
}
|
||||
-> Rule.ModuleRuleSchema { anything | withDependenciesVisitor : () } context
|
||||
-> Rule.ModuleRuleSchema { anything | withDependenciesVisitor : (), hasAtLeastOneVisitor : () } context
|
||||
-> Rule.ModuleRuleSchema { anything | withModuleDependenciesVisitor : () } context
|
||||
-> Rule.ModuleRuleSchema { anything | withModuleDependenciesVisitor : (), hasAtLeastOneVisitor : () } context
|
||||
addVisitors setterGetter schema =
|
||||
schema
|
||||
|> Rule.withDependenciesVisitor
|
||||
|> Rule.withModuleDependenciesVisitor
|
||||
(mapInnerContext setterGetter dependenciesVisitor)
|
||||
|> Rule.withImportVisitor
|
||||
(mapInnerContext setterGetter importVisitor |> pairWithNoErrors)
|
||||
|
@ -29,7 +29,7 @@ all =
|
||||
rule =
|
||||
Rule.newModuleRuleSchema "TestRule" "\n0 - withInitialContext"
|
||||
|> Rule.withModuleElmJsonVisitor (\_ context -> context ++ "\n1 - withModuleElmJsonVisitor")
|
||||
|> Rule.withDependenciesVisitor (\_ context -> context ++ "\n2 - withDependenciesVisitor")
|
||||
|> Rule.withModuleDependenciesVisitor (\_ context -> context ++ "\n2 - withModuleDependenciesVisitor")
|
||||
|> Rule.withModuleDefinitionVisitor (\_ context -> ( [], context ++ "\n3 - withModuleDefinitionVisitor" ))
|
||||
|> Rule.withImportVisitor (\_ context -> ( [], context ++ "\n4 - withImportVisitor" ))
|
||||
|> Rule.withDeclarationListVisitor (\_ context -> ( [], context ++ "\n5 - withDeclarationListVisitor" ))
|
||||
@ -71,7 +71,7 @@ a = 1
|
||||
{ message = """
|
||||
0 - withInitialContext
|
||||
1 - withModuleElmJsonVisitor
|
||||
2 - withDependenciesVisitor
|
||||
2 - withModuleDependenciesVisitor
|
||||
3 - withModuleDefinitionVisitor
|
||||
4 - withImportVisitor
|
||||
5 - withDeclarationListVisitor
|
||||
|
@ -33,7 +33,7 @@ testRule rule string =
|
||||
baseRule :
|
||||
Rule.ModuleRuleSchema
|
||||
{ hasAtLeastOneVisitor : ()
|
||||
, withDependenciesVisitor : ()
|
||||
, withModuleDependenciesVisitor : ()
|
||||
, withModuleElmJsonVisitor : ()
|
||||
}
|
||||
Context
|
||||
|
Loading…
Reference in New Issue
Block a user