Refactor: Move LintResult to Lint.Error

This commit is contained in:
Jeroen Engels 2019-06-23 17:56:32 +02:00
parent dcbf7d23a8
commit 76f63ff1f6
8 changed files with 16 additions and 22 deletions

View File

@ -1,5 +1,5 @@
module Lint.Error exposing
( Error
( Error, LintResult
, create
, message, range
)
@ -13,7 +13,7 @@ module Lint.Error exposing
# Definition
@docs Error
@docs Error, LintResult
# CONSTRUCTOR
@ -41,6 +41,12 @@ type Error
}
{-| Shortcut to the result of a lint rule
-}
type alias LintResult =
Result (List String) (List Error)
-- CONSTRUCTOR

View File

@ -4,7 +4,7 @@ module Lint.Rule exposing
, withModuleDefinitionVisitor, withImportVisitor, withExpressionVisitor, withDeclarationVisitor, withFinalEvaluation
, withSimpleModuleDefinitionVisitor, withSimpleImportVisitor, withSimpleExpressionVisitor, withSimpleDeclarationVisitor
, evaluateDeclaration, evaluateExpression, evaluateImport, evaluateModuleDefinition, finalEvaluation, initialContext
, Visitor, LintResult
, Visitor
)
{-| This module contains functions that are used for writing rules.
@ -29,7 +29,7 @@ module Lint.Rule exposing
# Internal types
@docs Visitor, LintResult
@docs Visitor
-}
@ -206,12 +206,6 @@ finalEvaluation (Implementation impl) =
impl.finalEvaluationFn
{-| Shortcut to the result of a lint rule
-}
type alias LintResult =
Result (List String) (List Error)
{-| Shorthand for a function that takes a rule's implementation, a context and returns ( List Lint.Error.Error, context ).
A Visitor represents a node and calls the appropriate function for the given node type.
-}

View File

@ -2,8 +2,7 @@ module DefaultPatternPositionTest exposing (all)
import Elm.Syntax.Range exposing (Location, Range)
import Lint exposing (Rule)
import Lint.Error as Error exposing (Error)
import Lint.Rule exposing (LintResult)
import Lint.Error as Error exposing (Error, LintResult)
import Lint.Rule.DefaultPatternPosition exposing (Configuration, PatternPosition(..), rule)
import Test exposing (Test, describe, test)
import TestUtil

View File

@ -2,8 +2,7 @@ module NoDebugTest exposing (all)
import Elm.Syntax.Range exposing (Location, Range)
import Lint exposing (Rule)
import Lint.Error as Error exposing (Error)
import Lint.Rule exposing (LintResult)
import Lint.Error as Error exposing (Error, LintResult)
import Lint.Rule.NoDebug exposing (rule)
import Test exposing (Test, describe, test)
import TestUtil

View File

@ -2,8 +2,7 @@ module NoExtraBooleanComparisonTest exposing (all)
import Elm.Syntax.Range exposing (Location, Range)
import Lint exposing (Rule)
import Lint.Error as Error exposing (Error)
import Lint.Rule exposing (LintResult)
import Lint.Error as Error exposing (Error, LintResult)
import Lint.Rule.NoExtraBooleanComparison exposing (rule)
import Test exposing (Test, describe, test)
import TestUtil

View File

@ -2,8 +2,7 @@ module NoImportingEverythingTest exposing (all)
import Elm.Syntax.Range exposing (Location, Range)
import Lint exposing (Rule)
import Lint.Error as Error exposing (Error)
import Lint.Rule exposing (LintResult)
import Lint.Error as Error exposing (Error, LintResult)
import Lint.Rule.NoImportingEverything exposing (Configuration, rule)
import Test exposing (Test, describe, test)
import TestUtil

View File

@ -2,8 +2,7 @@ module NoUnusedVariablesTest exposing (all)
import Elm.Syntax.Range exposing (Location, Range)
import Lint exposing (Rule)
import Lint.Error as Error exposing (Error)
import Lint.Rule exposing (LintResult)
import Lint.Error as Error exposing (Error, LintResult)
import Lint.Rule.NoUnusedVariables exposing (rule)
import Test exposing (Test, describe, test)
import TestUtil

View File

@ -3,8 +3,7 @@ module TestUtil exposing (errorWithoutRange, expectErrors, expectErrorsWithoutRa
import Elm.Syntax.Range exposing (Range)
import Expect
import Lint exposing (Rule, Severity(..), lintSource)
import Lint.Error as Error exposing (Error)
import Lint.Rule exposing (LintResult)
import Lint.Error as Error exposing (Error, LintResult)
ruleTester : Rule -> String -> Result (List String) (List Error)