mirror of
https://github.com/jfmengels/elm-review.git
synced 2024-12-24 18:23:09 +03:00
Add withModuleVisitors function
This commit is contained in:
parent
8b1050b2f8
commit
4b0a56dd21
@ -5,7 +5,7 @@ module Review.Rule exposing
|
||||
, withSimpleModuleDefinitionVisitor, withSimpleCommentsVisitor, withSimpleImportVisitor, withSimpleDeclarationVisitor, withSimpleExpressionVisitor
|
||||
, withModuleDefinitionVisitor, withCommentsVisitor, withImportVisitor, Direction(..), withDeclarationVisitor, withDeclarationListVisitor, withExpressionVisitor, withFinalModuleEvaluation
|
||||
, withElmJsonModuleVisitor, withReadmeModuleVisitor, withDependenciesModuleVisitor
|
||||
, ProjectRuleSchema, newProjectRuleSchema, fromProjectRuleSchema, withElmJsonProjectVisitor, withReadmeProjectVisitor, withDependenciesProjectVisitor, withFinalProjectEvaluation, withContextFromImportedModules
|
||||
, ProjectRuleSchema, newProjectRuleSchema, fromProjectRuleSchema, withModuleVisitors, withElmJsonProjectVisitor, withReadmeProjectVisitor, withDependenciesProjectVisitor, withFinalProjectEvaluation, withContextFromImportedModules
|
||||
, Error, error, errorRuleName, errorMessage, errorDetails, errorRange, errorFixes, errorFilePath, ModuleKey, errorForModule, ElmJsonKey, errorForElmJson, ReadmeKey, errorForReadme
|
||||
, withFixes
|
||||
, ignoreErrorsForDirectories, ignoreErrorsForFiles
|
||||
@ -190,7 +190,7 @@ Evaluating/visiting a node means two things:
|
||||
|
||||
## Creating a project rule
|
||||
|
||||
@docs ProjectRuleSchema, newProjectRuleSchema, fromProjectRuleSchema, withElmJsonProjectVisitor, withReadmeProjectVisitor, withDependenciesProjectVisitor, withFinalProjectEvaluation, withContextFromImportedModules
|
||||
@docs ProjectRuleSchema, newProjectRuleSchema, fromProjectRuleSchema, withModuleVisitors, withElmJsonProjectVisitor, withReadmeProjectVisitor, withDependenciesProjectVisitor, withFinalProjectEvaluation, withContextFromImportedModules
|
||||
|
||||
|
||||
## Errors
|
||||
@ -952,7 +952,8 @@ fromProjectRuleSchema (ProjectRuleSchema schema) =
|
||||
(runProjectRule
|
||||
(ProjectRuleSchema
|
||||
{ schema
|
||||
| elmJsonVisitors = List.reverse schema.elmJsonVisitors
|
||||
| moduleVisitorCreators = List.reverse schema.moduleVisitorCreators
|
||||
, elmJsonVisitors = List.reverse schema.elmJsonVisitors
|
||||
, readmeVisitors = List.reverse schema.readmeVisitors
|
||||
, dependenciesVisitors = List.reverse schema.dependenciesVisitors
|
||||
, finalEvaluationFns = List.reverse schema.finalEvaluationFns
|
||||
@ -962,6 +963,16 @@ fromProjectRuleSchema (ProjectRuleSchema schema) =
|
||||
)
|
||||
|
||||
|
||||
{-| TODO Documentation
|
||||
-}
|
||||
withModuleVisitors :
|
||||
(ModuleRuleSchema {} moduleContext -> ModuleRuleSchema { hasAtLeastOneVisitor : () } moduleContext)
|
||||
-> ProjectRuleSchema projectContext moduleContext
|
||||
-> ProjectRuleSchema projectContext moduleContext
|
||||
withModuleVisitors visitor (ProjectRuleSchema schema) =
|
||||
ProjectRuleSchema { schema | moduleVisitorCreators = visitor :: schema.moduleVisitorCreators }
|
||||
|
||||
|
||||
{-| Add a visitor to the [`ProjectRuleSchema`](#ProjectRuleSchema) which will visit the project's
|
||||
[`elm.json`](https://package.elm-lang.org/packages/elm/project-metadata-utils/latest/Elm-Project) file.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user