mirror of
https://github.com/jfmengels/elm-review.git
synced 2024-09-11 08:05:46 +03:00
Use new module rules in tests
This commit is contained in:
parent
fdd67292be
commit
dc131e8265
@ -5,13 +5,14 @@ import Elm.Syntax.Node as Node exposing (Node)
|
||||
import Elm.Syntax.Pattern as Pattern
|
||||
import Elm.Syntax.Range exposing (Range)
|
||||
import Review.Rule as Rule exposing (Error, Rule)
|
||||
import Review.Rule3 as Rule3
|
||||
|
||||
|
||||
rule : Rule
|
||||
rule =
|
||||
Rule.newModuleRuleSchema "NoBooleanCase" ()
|
||||
|> Rule.withSimpleExpressionVisitor expressionVisitor
|
||||
|> Rule.fromModuleRuleSchema
|
||||
Rule3.newModuleRuleSchema_New "NoBooleanCase" ()
|
||||
|> Rule3.withSimpleExpressionVisitor_New expressionVisitor
|
||||
|> Rule3.fromModuleRuleSchema_New
|
||||
|
||||
|
||||
expressionVisitor : Node Expression -> List (Error {})
|
||||
|
@ -16,6 +16,7 @@ import Elm.Syntax.Expression exposing (Expression(..))
|
||||
import Elm.Syntax.Module as Module exposing (Module(..))
|
||||
import Elm.Syntax.Node as Node exposing (Node)
|
||||
import Review.Rule as Rule exposing (Error, Rule)
|
||||
import Review.Rule3 as Rule3
|
||||
import Set exposing (Set)
|
||||
|
||||
|
||||
@ -71,12 +72,12 @@ in your editor, rather than when running your tests or [elm-xref](https://github
|
||||
-}
|
||||
rule : Rule
|
||||
rule =
|
||||
Rule.newModuleRuleSchema "NoUnusedTypeConstructors" initialContext
|
||||
|> Rule.withModuleDefinitionVisitor moduleDefinitionVisitor
|
||||
|> Rule.withDeclarationEnterVisitor declarationVisitor
|
||||
|> Rule.withExpressionEnterVisitor expressionVisitor
|
||||
|> Rule.withFinalModuleEvaluation finalEvaluation
|
||||
|> Rule.fromModuleRuleSchema
|
||||
Rule3.newModuleRuleSchema_New "NoUnusedTypeConstructors" initialContext
|
||||
|> Rule3.withModuleDefinitionVisitor_New moduleDefinitionVisitor
|
||||
|> Rule3.withDeclarationEnterVisitor_New declarationVisitor
|
||||
|> Rule3.withExpressionEnterVisitor_New expressionVisitor
|
||||
|> Rule3.withFinalModuleEvaluation_New finalEvaluation
|
||||
|> Rule3.fromModuleRuleSchema_New
|
||||
|
||||
|
||||
type alias Context =
|
||||
|
@ -10,6 +10,7 @@ import Elm.Syntax.Expression as Expression exposing (Expression)
|
||||
import Elm.Syntax.Node as Node exposing (Node)
|
||||
import Elm.Syntax.Pattern as Pattern exposing (Pattern)
|
||||
import Review.Rule as Rule exposing (Error, Rule)
|
||||
import Review.Rule3 as Rule3
|
||||
|
||||
|
||||
{-| Reports when pattern matching is used for a boolean value.
|
||||
@ -61,9 +62,9 @@ evaluated.
|
||||
-}
|
||||
rule : Rule
|
||||
rule =
|
||||
Rule.newModuleRuleSchema "NoBooleanCaseOf" ()
|
||||
|> Rule.withSimpleExpressionVisitor expressionVisitor
|
||||
|> Rule.fromModuleRuleSchema
|
||||
Rule3.newModuleRuleSchema_New "NoBooleanCaseOf" ()
|
||||
|> Rule3.withSimpleExpressionVisitor_New expressionVisitor
|
||||
|> Rule3.fromModuleRuleSchema_New
|
||||
|
||||
|
||||
expressionVisitor : Node Expression -> List (Error {})
|
||||
|
@ -11,6 +11,7 @@ import Elm.Syntax.Expression as Expression exposing (Expression)
|
||||
import Elm.Syntax.Import exposing (Import)
|
||||
import Elm.Syntax.Node as Node exposing (Node)
|
||||
import Review.Rule as Rule exposing (Error, Rule)
|
||||
import Review.Rule3 as Rule3
|
||||
|
||||
|
||||
{-| Forbid the use of [`Debug.log`](https://package.elm-lang.org/packages/elm/core/latest/Debug) before it goes into production or fails in the CI.
|
||||
@ -54,10 +55,10 @@ do not ship to production.
|
||||
-}
|
||||
rule : Rule
|
||||
rule =
|
||||
Rule.newModuleRuleSchema "NoDebugLog" { hasLogBeenImported = False }
|
||||
|> Rule.withImportVisitor importVisitor
|
||||
|> Rule.withExpressionVisitor expressionVisitor
|
||||
|> Rule.fromModuleRuleSchema
|
||||
Rule3.newModuleRuleSchema_New "NoDebugLog" { hasLogBeenImported = False }
|
||||
|> Rule3.withImportVisitor_New importVisitor
|
||||
|> Rule3.withExpressionVisitor_New expressionVisitor
|
||||
|> Rule3.fromModuleRuleSchema_New
|
||||
|
||||
|
||||
type alias Context =
|
||||
|
@ -11,6 +11,7 @@ import Elm.Syntax.Expression as Expression exposing (Expression)
|
||||
import Elm.Syntax.Import exposing (Import)
|
||||
import Elm.Syntax.Node as Node exposing (Node)
|
||||
import Review.Rule as Rule exposing (Error, Rule)
|
||||
import Review.Rule3 as Rule3
|
||||
|
||||
|
||||
{-| Forbid the use of [`Debug.todo`] and [`Debug.toString`].
|
||||
@ -75,10 +76,10 @@ can configure the rule like this.
|
||||
-}
|
||||
rule : Rule
|
||||
rule =
|
||||
Rule.newModuleRuleSchema "NoDebug.TodoOrToString" init
|
||||
|> Rule.withImportVisitor importVisitor
|
||||
|> Rule.withExpressionVisitor expressionVisitor
|
||||
|> Rule.fromModuleRuleSchema
|
||||
Rule3.newModuleRuleSchema_New "NoDebug.TodoOrToString" init
|
||||
|> Rule3.withImportVisitor_New importVisitor
|
||||
|> Rule3.withExpressionVisitor_New expressionVisitor
|
||||
|> Rule3.fromModuleRuleSchema_New
|
||||
|
||||
|
||||
type alias Context =
|
||||
|
@ -10,6 +10,7 @@ import Elm.Syntax.Exposing as Exposing
|
||||
import Elm.Syntax.Module as Module exposing (Module)
|
||||
import Elm.Syntax.Node as Node exposing (Node)
|
||||
import Review.Rule as Rule exposing (Error, Rule)
|
||||
import Review.Rule3 as Rule3
|
||||
|
||||
|
||||
{-| Forbids exporting everything from a module.
|
||||
@ -43,9 +44,9 @@ in the following manner:
|
||||
-}
|
||||
rule : Rule
|
||||
rule =
|
||||
Rule.newModuleRuleSchema "NoExposingEverything" ()
|
||||
|> Rule.withSimpleModuleDefinitionVisitor moduleDefinitionVisitor
|
||||
|> Rule.fromModuleRuleSchema
|
||||
Rule3.newModuleRuleSchema_New "NoExposingEverything" ()
|
||||
|> Rule3.withSimpleModuleDefinitionVisitor_New moduleDefinitionVisitor
|
||||
|> Rule3.fromModuleRuleSchema_New
|
||||
|
||||
|
||||
moduleDefinitionVisitor : Node Module -> List (Error {})
|
||||
|
@ -12,6 +12,7 @@ module NoExtraBooleanComparison exposing (rule)
|
||||
import Elm.Syntax.Expression as Expression exposing (Expression(..))
|
||||
import Elm.Syntax.Node as Node exposing (Node)
|
||||
import Review.Rule as Rule exposing (Error, Rule)
|
||||
import Review.Rule3 as Rule3
|
||||
|
||||
|
||||
{-| Forbid the use of boolean comparisons that can be simplified.
|
||||
@ -62,9 +63,9 @@ You should not use this rule if you
|
||||
-}
|
||||
rule : Rule
|
||||
rule =
|
||||
Rule.newModuleRuleSchema "NoExtraBooleanComparison" ()
|
||||
|> Rule.withSimpleExpressionVisitor expressionVisitor
|
||||
|> Rule.fromModuleRuleSchema
|
||||
Rule3.newModuleRuleSchema_New "NoExtraBooleanComparison" ()
|
||||
|> Rule3.withSimpleExpressionVisitor_New expressionVisitor
|
||||
|> Rule3.fromModuleRuleSchema_New
|
||||
|
||||
|
||||
error : Node a -> String -> String -> Error {}
|
||||
|
@ -10,6 +10,7 @@ import Elm.Syntax.Expression as Expression exposing (Expression)
|
||||
import Elm.Syntax.Node as Node exposing (Node)
|
||||
import Elm.Syntax.Range exposing (Range)
|
||||
import Review.Rule as Rule exposing (Error, Rule)
|
||||
import Review.Rule3 as Rule3
|
||||
|
||||
|
||||
{-| Reports when an operator is used as a prefix operator and all the operands are already given.
|
||||
@ -39,9 +40,9 @@ import Review.Rule as Rule exposing (Error, Rule)
|
||||
-}
|
||||
rule : Rule
|
||||
rule =
|
||||
Rule.newModuleRuleSchema "NoFullyAppliedPrefixOperator" ()
|
||||
|> Rule.withSimpleExpressionVisitor expressionVisitor
|
||||
|> Rule.fromModuleRuleSchema
|
||||
Rule3.newModuleRuleSchema_New "NoFullyAppliedPrefixOperator" ()
|
||||
|> Rule3.withSimpleExpressionVisitor_New expressionVisitor
|
||||
|> Rule3.fromModuleRuleSchema_New
|
||||
|
||||
|
||||
error : Range -> Error {}
|
||||
|
@ -10,6 +10,7 @@ import Elm.Syntax.Exposing as Exposing
|
||||
import Elm.Syntax.Import exposing (Import)
|
||||
import Elm.Syntax.Node as Node exposing (Node)
|
||||
import Review.Rule as Rule exposing (Error, Rule)
|
||||
import Review.Rule3 as Rule3
|
||||
import Set exposing (Set)
|
||||
|
||||
|
||||
@ -47,9 +48,9 @@ you can configure a list of exceptions.
|
||||
-}
|
||||
rule : List String -> Rule
|
||||
rule exceptions =
|
||||
Rule.newModuleRuleSchema "NoImportingEverything" ()
|
||||
|> Rule.withSimpleImportVisitor (importVisitor <| exceptionsToSet exceptions)
|
||||
|> Rule.fromModuleRuleSchema
|
||||
Rule3.newModuleRuleSchema_New "NoImportingEverything" ()
|
||||
|> Rule3.withSimpleImportVisitor_New (importVisitor <| exceptionsToSet exceptions)
|
||||
|> Rule3.fromModuleRuleSchema_New
|
||||
|
||||
|
||||
exceptionsToSet : List String -> Set (List String)
|
||||
|
@ -11,6 +11,7 @@ import Elm.Syntax.Node as Node exposing (Node)
|
||||
import NoLeftPizzaUtil
|
||||
import Review.Fix as Fix
|
||||
import Review.Rule as Rule exposing (Error, Rule)
|
||||
import Review.Rule3 as Rule3
|
||||
|
||||
|
||||
{-| Specify how strict the rule should be.
|
||||
@ -74,9 +75,9 @@ Or pass `NoLeftPizza.Redundant` which will only apply to redundant usage:
|
||||
-}
|
||||
rule : Strictness -> Rule
|
||||
rule strictness =
|
||||
Rule.newModuleRuleSchema "NoLeftPizza" strictness
|
||||
|> Rule.withSimpleExpressionVisitor (expressionVisitor strictness)
|
||||
|> Rule.fromModuleRuleSchema
|
||||
Rule3.newModuleRuleSchema_New "NoLeftPizza" strictness
|
||||
|> Rule3.withSimpleExpressionVisitor_New (expressionVisitor strictness)
|
||||
|> Rule3.fromModuleRuleSchema_New
|
||||
|
||||
|
||||
expressionVisitor : Strictness -> Node Expression -> List (Error {})
|
||||
|
@ -10,6 +10,7 @@ import Elm.Syntax.Expression as Expression exposing (Expression)
|
||||
import Elm.Syntax.Node as Node exposing (Node)
|
||||
import Elm.Syntax.Range exposing (Range)
|
||||
import Review.Rule as Rule exposing (Error, Rule)
|
||||
import Review.Rule3 as Rule3
|
||||
|
||||
|
||||
{-| Reports when an operation on lists could be simplified to a single literal list.
|
||||
@ -63,9 +64,9 @@ import Review.Rule as Rule exposing (Error, Rule)
|
||||
-}
|
||||
rule : Rule
|
||||
rule =
|
||||
Rule.newModuleRuleSchema "NoListLiteralsConcat" ()
|
||||
|> Rule.withSimpleExpressionVisitor expressionVisitor
|
||||
|> Rule.fromModuleRuleSchema
|
||||
Rule3.newModuleRuleSchema_New "NoListLiteralsConcat" ()
|
||||
|> Rule3.withSimpleExpressionVisitor_New expressionVisitor
|
||||
|> Rule3.fromModuleRuleSchema_New
|
||||
|
||||
|
||||
error : Range -> Error {}
|
||||
|
@ -9,6 +9,7 @@ module NoMissingTypeAnnotation exposing (rule)
|
||||
import Elm.Syntax.Declaration as Declaration exposing (Declaration)
|
||||
import Elm.Syntax.Node as Node exposing (Node)
|
||||
import Review.Rule as Rule exposing (Error, Rule)
|
||||
import Review.Rule3 as Rule3
|
||||
|
||||
|
||||
{-| Reports top-level declarations that do not have a type annotation.
|
||||
@ -46,9 +47,9 @@ For that, enable [`NoMissingTypeAnnotationInLetIn`](./NoMissingTypeAnnotationInL
|
||||
-}
|
||||
rule : Rule
|
||||
rule =
|
||||
Rule.newModuleRuleSchema "NoMissingTypeAnnotation" ()
|
||||
|> Rule.withSimpleDeclarationVisitor declarationVisitor
|
||||
|> Rule.fromModuleRuleSchema
|
||||
Rule3.newModuleRuleSchema_New "NoMissingTypeAnnotation" ()
|
||||
|> Rule3.withSimpleDeclarationVisitor_New declarationVisitor
|
||||
|> Rule3.fromModuleRuleSchema_New
|
||||
|
||||
|
||||
declarationVisitor : Node Declaration -> List (Error {})
|
||||
|
@ -9,6 +9,7 @@ module NoMissingTypeAnnotationInLetIn exposing (rule)
|
||||
import Elm.Syntax.Expression as Expression exposing (Expression)
|
||||
import Elm.Syntax.Node as Node exposing (Node)
|
||||
import Review.Rule as Rule exposing (Error, Rule)
|
||||
import Review.Rule3 as Rule3
|
||||
|
||||
|
||||
{-| Reports `let in` declarations that do not have a type annotation.
|
||||
@ -50,9 +51,9 @@ For that, enable [`NoMissingTypeAnnotation`](./NoMissingTypeAnnotation).
|
||||
-}
|
||||
rule : Rule
|
||||
rule =
|
||||
Rule.newModuleRuleSchema "NoMissingTypeAnnotationInLetIn" ()
|
||||
|> Rule.withSimpleExpressionVisitor expressionVisitor
|
||||
|> Rule.fromModuleRuleSchema
|
||||
Rule3.newModuleRuleSchema_New "NoMissingTypeAnnotationInLetIn" ()
|
||||
|> Rule3.withSimpleExpressionVisitor_New expressionVisitor
|
||||
|> Rule3.fromModuleRuleSchema_New
|
||||
|
||||
|
||||
expressionVisitor : Node Expression -> List (Error {})
|
||||
|
@ -10,6 +10,7 @@ import Elm.Syntax.Declaration as Declaration exposing (Declaration)
|
||||
import Elm.Syntax.Expression as Expression exposing (Expression)
|
||||
import Elm.Syntax.Node as Node exposing (Node)
|
||||
import Review.Rule as Rule exposing (Error, Rule)
|
||||
import Review.Rule3 as Rule3
|
||||
|
||||
|
||||
{-| Reports when the `update` function calls itself.
|
||||
@ -54,10 +55,10 @@ To add the rule to your configuration:
|
||||
-}
|
||||
rule : Rule
|
||||
rule =
|
||||
Rule.newModuleRuleSchema "NoRecursiveUpdate" { isInUpdateFunction = False }
|
||||
|> Rule.withDeclarationEnterVisitor declarationVisitor
|
||||
|> Rule.withExpressionEnterVisitor expressionVisitor
|
||||
|> Rule.fromModuleRuleSchema
|
||||
Rule3.newModuleRuleSchema_New "NoRecursiveUpdate" { isInUpdateFunction = False }
|
||||
|> Rule3.withDeclarationEnterVisitor_New declarationVisitor
|
||||
|> Rule3.withExpressionEnterVisitor_New expressionVisitor
|
||||
|> Rule3.fromModuleRuleSchema_New
|
||||
|
||||
|
||||
type alias Context =
|
||||
|
@ -3,13 +3,14 @@ module NoTodoComment exposing (rule)
|
||||
import Elm.Syntax.Node as Node exposing (Node)
|
||||
import Elm.Syntax.Range exposing (Range)
|
||||
import Review.Rule as Rule exposing (Error, Rule)
|
||||
import Review.Rule3 as Rule3
|
||||
|
||||
|
||||
rule : Rule
|
||||
rule =
|
||||
Rule.newModuleRuleSchema "NoTodoComment" ()
|
||||
|> Rule.withSimpleCommentsVisitor commentsVisitor
|
||||
|> Rule.fromModuleRuleSchema
|
||||
Rule3.newModuleRuleSchema_New "NoTodoComment" ()
|
||||
|> Rule3.withSimpleCommentsVisitor_New commentsVisitor
|
||||
|> Rule3.fromModuleRuleSchema_New
|
||||
|
||||
|
||||
commentsVisitor : List (Node String) -> List (Error {})
|
||||
|
@ -19,6 +19,7 @@ import Elm.Writer as Writer
|
||||
import NoUnused.Patterns.NameVisitor as NameVisitor
|
||||
import Review.Fix as Fix
|
||||
import Review.Rule as Rule exposing (Rule)
|
||||
import Review.Rule3 as Rule3
|
||||
import Set exposing (Set)
|
||||
|
||||
|
||||
@ -52,13 +53,13 @@ Value `something` is not used:
|
||||
-}
|
||||
rule : Rule
|
||||
rule =
|
||||
Rule.newModuleRuleSchema "NoUnused.Parameters" initialContext
|
||||
|> Rule.withDeclarationEnterVisitor declarationEnterVisitor
|
||||
|> Rule.withDeclarationExitVisitor declarationExitVisitor
|
||||
|> Rule.withExpressionEnterVisitor expressionEnterVisitor
|
||||
|> Rule.withExpressionExitVisitor expressionExitVisitor
|
||||
|> NameVisitor.withValueVisitor valueVisitor
|
||||
|> Rule.fromModuleRuleSchema
|
||||
Rule3.newModuleRuleSchema_New "NoUnused.Parameters" initialContext
|
||||
|> Rule3.withDeclarationEnterVisitor_New declarationEnterVisitor
|
||||
|> Rule3.withDeclarationExitVisitor_New declarationExitVisitor
|
||||
|> Rule3.withExpressionEnterVisitor_New expressionEnterVisitor
|
||||
|> Rule3.withExpressionExitVisitor_New expressionExitVisitor
|
||||
|> NameVisitor.withValueVisitor_New valueVisitor
|
||||
|> Rule3.fromModuleRuleSchema_New
|
||||
|
||||
|
||||
declarationEnterVisitor : Node Declaration -> Context -> ( List (Rule.Error {}), Context )
|
||||
|
@ -18,6 +18,7 @@ import Elm.Writer as Writer
|
||||
import NoUnused.Patterns.NameVisitor as NameVisitor
|
||||
import Review.Fix as Fix
|
||||
import Review.Rule as Rule exposing (Rule)
|
||||
import Review.Rule3 as Rule3
|
||||
import Set exposing (Set)
|
||||
|
||||
|
||||
@ -54,11 +55,11 @@ Value `something` is not used:
|
||||
-}
|
||||
rule : Rule
|
||||
rule =
|
||||
Rule.newModuleRuleSchema "NoUnused.Patterns" initialContext
|
||||
|> Rule.withExpressionEnterVisitor expressionEnterVisitor
|
||||
|> Rule.withExpressionExitVisitor expressionExitVisitor
|
||||
|> NameVisitor.withValueVisitor valueVisitor
|
||||
|> Rule.fromModuleRuleSchema
|
||||
Rule3.newModuleRuleSchema_New "NoUnused.Patterns" initialContext
|
||||
|> Rule3.withExpressionEnterVisitor_New expressionEnterVisitor
|
||||
|> Rule3.withExpressionExitVisitor_New expressionExitVisitor
|
||||
|> NameVisitor.withValueVisitor_New valueVisitor
|
||||
|> Rule3.fromModuleRuleSchema_New
|
||||
|
||||
|
||||
expressionEnterVisitor : Node Expression -> Context -> ( List (Rule.Error {}), Context )
|
||||
|
@ -1,4 +1,7 @@
|
||||
module NoUnused.Patterns.NameVisitor exposing (withValueVisitor)
|
||||
module NoUnused.Patterns.NameVisitor exposing
|
||||
( withValueVisitor
|
||||
, withValueVisitor_New
|
||||
)
|
||||
|
||||
{-| Visit each name in the module.
|
||||
|
||||
@ -36,6 +39,7 @@ import Elm.Syntax.Signature exposing (Signature)
|
||||
import Elm.Syntax.Type as Type
|
||||
import Elm.Syntax.TypeAnnotation as TypeAnnotation exposing (TypeAnnotation)
|
||||
import Review.Rule as Rule exposing (Error)
|
||||
import Review.Rule3 as Rule3
|
||||
|
||||
|
||||
type Visitor context
|
||||
@ -176,6 +180,20 @@ withValueAndTypeVisitors { valueVisitor, typeVisitor } rule =
|
||||
|> Rule.withExpressionEnterVisitor (expressionVisitor visitor)
|
||||
|
||||
|
||||
withValueVisitor_New :
|
||||
(Node ( ModuleName, String ) -> context -> ( List (Error {}), context ))
|
||||
-> Rule3.ModuleVisitor state projectContext context
|
||||
-> Rule3.ModuleVisitor { state | hasAtLeastOneVisitor : () } projectContext context
|
||||
withValueVisitor_New valueVisitor rule =
|
||||
let
|
||||
visitor =
|
||||
ValueVisitor valueVisitor
|
||||
in
|
||||
rule
|
||||
|> Rule3.withDeclarationListVisitor_New (declarationListVisitor visitor)
|
||||
|> Rule3.withExpressionEnterVisitor_New (expressionVisitor visitor)
|
||||
|
||||
|
||||
|
||||
--- VISITORS
|
||||
|
||||
|
@ -22,6 +22,7 @@ import Elm.Syntax.TypeAnnotation as TypeAnnotation exposing (TypeAnnotation)
|
||||
import NoUnused.NonemptyList as NonemptyList exposing (Nonempty)
|
||||
import Review.Fix as Fix exposing (Fix)
|
||||
import Review.Rule as Rule exposing (Error, Rule)
|
||||
import Review.Rule3 as Rule3
|
||||
import Set exposing (Set)
|
||||
|
||||
|
||||
@ -53,14 +54,14 @@ import Set exposing (Set)
|
||||
-}
|
||||
rule : Rule
|
||||
rule =
|
||||
Rule.newModuleRuleSchema "NoUnused.Variables" initialContext
|
||||
|> Rule.withModuleDefinitionVisitor moduleDefinitionVisitor
|
||||
|> Rule.withImportVisitor importVisitor
|
||||
|> Rule.withDeclarationEnterVisitor declarationVisitor
|
||||
|> Rule.withExpressionEnterVisitor expressionEnterVisitor
|
||||
|> Rule.withExpressionExitVisitor expressionExitVisitor
|
||||
|> Rule.withFinalModuleEvaluation finalEvaluation
|
||||
|> Rule.fromModuleRuleSchema
|
||||
Rule3.newModuleRuleSchema_New "NoUnused.Variables" initialContext
|
||||
|> Rule3.withModuleDefinitionVisitor_New moduleDefinitionVisitor
|
||||
|> Rule3.withImportVisitor_New importVisitor
|
||||
|> Rule3.withDeclarationEnterVisitor_New declarationVisitor
|
||||
|> Rule3.withExpressionEnterVisitor_New expressionEnterVisitor
|
||||
|> Rule3.withExpressionExitVisitor_New expressionExitVisitor
|
||||
|> Rule3.withFinalModuleEvaluation_New finalEvaluation
|
||||
|> Rule3.fromModuleRuleSchema_New
|
||||
|
||||
|
||||
type alias Context =
|
||||
|
@ -10,6 +10,7 @@ import Elm.Syntax.Declaration as Declaration exposing (Declaration)
|
||||
import Elm.Syntax.Expression as Expression
|
||||
import Elm.Syntax.Node as Node exposing (Node(..))
|
||||
import Review.Rule as Rule exposing (Error, Rule)
|
||||
import Review.Rule3 as Rule3
|
||||
|
||||
|
||||
{-| Reports `subscriptions` functions that never return a subscription.
|
||||
@ -44,9 +45,9 @@ that turn out to be unnecessary later.
|
||||
-}
|
||||
rule : Rule
|
||||
rule =
|
||||
Rule.newModuleRuleSchema "NoUselessSubscriptions" ()
|
||||
|> Rule.withSimpleDeclarationVisitor declarationVisitor
|
||||
|> Rule.fromModuleRuleSchema
|
||||
Rule3.newModuleRuleSchema_New "NoUselessSubscriptions" ()
|
||||
|> Rule3.withSimpleDeclarationVisitor_New declarationVisitor
|
||||
|> Rule3.fromModuleRuleSchema_New
|
||||
|
||||
|
||||
declarationVisitor : Node Declaration -> List (Error {})
|
||||
|
Loading…
Reference in New Issue
Block a user