mirror of
https://github.com/jfmengels/elm-review.git
synced 2024-09-11 16:16:09 +03:00
Move the file pattern to be the last argument of withExtraFiles visitors
This commit is contained in:
parent
a7f74497bf
commit
e3082e15ec
@ -1929,7 +1929,7 @@ and reports errors when the classes given as argument are unknown.
|
||||
rule : Rule
|
||||
rule =
|
||||
Rule.newProjectRuleSchema "NoUnknownCssClasses" initialProjectContext
|
||||
|> Rule.withExtraFilesProjectVisitor [ FilePattern.include "src/**/*.css" ] cssFilesVisitor
|
||||
|> Rule.withExtraFilesProjectVisitor cssFilesVisitor [ FilePattern.include "src/**/*.css" ]
|
||||
|> Rule.withModuleVisitor moduleVisitor
|
||||
|> Rule.withModuleContextUsingContextCreator
|
||||
{ fromProjectToModule = Rule.initContextCreator identity
|
||||
@ -2015,11 +2015,11 @@ and reports errors when the classes given as argument are unknown.
|
||||
|
||||
-}
|
||||
withExtraFilesProjectVisitor :
|
||||
List FilePattern
|
||||
-> (List { fileKey : ExtraFileKey, path : String, content : String } -> projectContext -> ( List (Error { useErrorForModule : () }), projectContext ))
|
||||
(List { fileKey : ExtraFileKey, path : String, content : String } -> projectContext -> ( List (Error { useErrorForModule : () }), projectContext ))
|
||||
-> List FilePattern
|
||||
-> ProjectRuleSchema schemaState projectContext moduleContext
|
||||
-> ProjectRuleSchema { schemaState | hasAtLeastOneVisitor : () } projectContext moduleContext
|
||||
withExtraFilesProjectVisitor filePatterns baseVisitor (ProjectRuleSchema schema) =
|
||||
withExtraFilesProjectVisitor baseVisitor filePatterns (ProjectRuleSchema schema) =
|
||||
case FilePattern.compact filePatterns of
|
||||
Ok filePatternSummary ->
|
||||
let
|
||||
@ -2569,11 +2569,11 @@ withElmJsonModuleVisitor visitor (ModuleRuleSchema schema) =
|
||||
{-| REPLACEME
|
||||
-}
|
||||
withExtraFilesModuleVisitor :
|
||||
List FilePattern
|
||||
-> (List { path : String, content : String } -> moduleContext -> moduleContext)
|
||||
(List { path : String, content : String } -> moduleContext -> moduleContext)
|
||||
-> List FilePattern
|
||||
-> ModuleRuleSchema { schemaState | canCollectProjectData : () } moduleContext
|
||||
-> ModuleRuleSchema { schemaState | canCollectProjectData : () } moduleContext
|
||||
withExtraFilesModuleVisitor filePatterns baseVisitor (ModuleRuleSchema schema) =
|
||||
withExtraFilesModuleVisitor baseVisitor filePatterns (ModuleRuleSchema schema) =
|
||||
case FilePattern.compact filePatterns of
|
||||
Ok filePatternSummary ->
|
||||
let
|
||||
|
@ -154,7 +154,7 @@ import Set exposing (Set)
|
||||
rule : Configuration -> Rule
|
||||
rule (Configuration configuration) =
|
||||
Rule.newProjectRuleSchema "Css.NoUnknownClasses" (initialProjectContext configuration.knownClasses)
|
||||
|> Rule.withExtraFilesProjectVisitor configuration.cssFiles cssFilesVisitor
|
||||
|> Rule.withExtraFilesProjectVisitor cssFilesVisitor configuration.cssFiles
|
||||
|> Rule.withModuleVisitor (moduleVisitor configuration.cssFunctions)
|
||||
|> Rule.withModuleContextUsingContextCreator
|
||||
{ fromProjectToModule = fromProjectToModule
|
||||
|
@ -56,7 +56,7 @@ rule : Configuration -> Rule
|
||||
rule (Configuration { changelogPath }) =
|
||||
Rule.newProjectRuleSchema "Docs.NoMissingChangelogEntry" initialProjectContext
|
||||
|> Rule.withElmJsonProjectVisitor elmJsonVisitor
|
||||
|> Rule.withExtraFilesProjectVisitor [ FilePattern.include (Maybe.withDefault defaultPath changelogPath) ] (extraFilesVisitor changelogPath)
|
||||
|> Rule.withExtraFilesProjectVisitor (extraFilesVisitor changelogPath) [ FilePattern.include (Maybe.withDefault defaultPath changelogPath) ]
|
||||
|> Rule.providesFixesForProjectRule
|
||||
|> Rule.fromProjectRuleSchema
|
||||
|
||||
|
@ -33,8 +33,8 @@ all =
|
||||
|> Rule.withElmJsonModuleVisitor (\_ context -> context ++ "\n1.2 - withElmJsonModuleVisitor")
|
||||
|> Rule.withReadmeModuleVisitor (\_ context -> context ++ "\n2.1 - withReadmeModuleVisitor")
|
||||
|> Rule.withReadmeModuleVisitor (\_ context -> context ++ "\n2.2 - withReadmeModuleVisitor")
|
||||
|> Rule.withExtraFilesModuleVisitor [ FilePattern.include "first.txt" ] (\files context -> context ++ "\n3.1 - withExtraFilesModuleVisitor " ++ (List.map .path files |> String.join ", "))
|
||||
|> Rule.withExtraFilesModuleVisitor [ FilePattern.include "last.txt" ] (\files context -> context ++ "\n3.2 - withExtraFilesModuleVisitor " ++ (List.map .path files |> String.join ", "))
|
||||
|> Rule.withExtraFilesModuleVisitor (\files context -> context ++ "\n3.1 - withExtraFilesModuleVisitor " ++ (List.map .path files |> String.join ", ")) [ FilePattern.include "first.txt" ]
|
||||
|> Rule.withExtraFilesModuleVisitor (\files context -> context ++ "\n3.2 - withExtraFilesModuleVisitor " ++ (List.map .path files |> String.join ", ")) [ FilePattern.include "last.txt" ]
|
||||
|> Rule.withDirectDependenciesModuleVisitor (\_ context -> context ++ "\n4.1 - withDirectDependenciesModuleVisitor")
|
||||
|> Rule.withDirectDependenciesModuleVisitor (\_ context -> context ++ "\n4.2 - withDirectDependenciesModuleVisitor")
|
||||
|> Rule.withDependenciesModuleVisitor (\_ context -> context ++ "\n4.3 - withDependenciesModuleVisitor")
|
||||
|
@ -21,7 +21,7 @@ all =
|
||||
|
||||
rule : Rule
|
||||
rule =
|
||||
createRule (Rule.withExtraFilesModuleVisitor [ FilePattern.include "foo/some-file.css" ] extraFilesModuleVisitor)
|
||||
createRule (Rule.withExtraFilesModuleVisitor extraFilesModuleVisitor [ FilePattern.include "foo/some-file.css" ])
|
||||
in
|
||||
"""module A exposing (a)
|
||||
a = 1
|
||||
@ -45,7 +45,7 @@ a = 1
|
||||
|
||||
rule : Rule
|
||||
rule =
|
||||
createRule (Rule.withExtraFilesModuleVisitor [ FilePattern.include "foo/some-file.css" ] extraFilesModuleVisitor)
|
||||
createRule (Rule.withExtraFilesModuleVisitor extraFilesModuleVisitor [ FilePattern.include "foo/some-file.css" ])
|
||||
in
|
||||
"""module A exposing (a)
|
||||
a = 1
|
||||
@ -70,8 +70,8 @@ a = 1
|
||||
rule : Rule
|
||||
rule =
|
||||
createRule
|
||||
(Rule.withExtraFilesModuleVisitor [ FilePattern.include "a.txt", FilePattern.include "c.txt" ] (reportsFileNames "A")
|
||||
>> Rule.withExtraFilesModuleVisitor [ FilePattern.include "b.txt" ] (reportsFileNames "B")
|
||||
(Rule.withExtraFilesModuleVisitor (reportsFileNames "A") [ FilePattern.include "a.txt", FilePattern.include "c.txt" ]
|
||||
>> Rule.withExtraFilesModuleVisitor (reportsFileNames "B") [ FilePattern.include "b.txt" ]
|
||||
)
|
||||
in
|
||||
"""module A exposing (a)
|
||||
@ -91,8 +91,8 @@ a = 1
|
||||
\() ->
|
||||
createRule
|
||||
(Rule.withExtraFilesModuleVisitor
|
||||
[ FilePattern.include "** " ]
|
||||
(reportsFileNames "A")
|
||||
[ FilePattern.include "** " ]
|
||||
)
|
||||
|> Review.Test.expectConfigurationError
|
||||
{ message = "Invalid globs provided when requesting extra files"
|
||||
|
Loading…
Reference in New Issue
Block a user