mirror of
https://github.com/jfmengels/elm-review.git
synced 2024-12-26 03:04:48 +03:00
Make fixes a Maybe, so that we can know whether fixes were provided
This commit is contained in:
parent
007472a29c
commit
f5b689b0ec
@ -166,9 +166,8 @@ ruleErrorToLintError source moduleName_ rule error =
|
||||
, details = Rule.errorDetails error
|
||||
, range = Rule.errorRange error
|
||||
, fixedSource =
|
||||
source
|
||||
|> Fix.fix (Rule.errorFixes error)
|
||||
|> Just
|
||||
Rule.errorFixes error
|
||||
|> Maybe.map (\fixes -> Fix.fix fixes source)
|
||||
}
|
||||
|
||||
|
||||
|
@ -1034,7 +1034,7 @@ type Error
|
||||
{ message : String
|
||||
, details : List String
|
||||
, range : Range
|
||||
, fixes : List Fix
|
||||
, fixes : Maybe (List Fix)
|
||||
}
|
||||
|
||||
|
||||
@ -1062,7 +1062,7 @@ error { message, details } range =
|
||||
{ message = message
|
||||
, details = details
|
||||
, range = range
|
||||
, fixes = []
|
||||
, fixes = Nothing
|
||||
}
|
||||
|
||||
|
||||
@ -1088,7 +1088,7 @@ not matter.
|
||||
-}
|
||||
withFixes : List Fix -> Error -> Error
|
||||
withFixes fixes (Error err) =
|
||||
Error { err | fixes = fixes }
|
||||
Error { err | fixes = Just fixes }
|
||||
|
||||
|
||||
{-| Get the error message of an [`Error`](#Error).
|
||||
@ -1116,7 +1116,7 @@ errorRange (Error err) =
|
||||
{-| Get the [`Range`](https://package.elm-lang.org/packages/stil4m/elm-syntax/7.1.0/Elm-Syntax-Range)
|
||||
of an [`Error`](#Error).
|
||||
-}
|
||||
errorFixes : Error -> List Fix
|
||||
errorFixes : Error -> Maybe (List Fix)
|
||||
errorFixes (Error err) =
|
||||
err.fixes
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user