mirror of
https://github.com/jfmengels/elm-review.git
synced 2024-12-27 19:56:10 +03:00
elm-format
This commit is contained in:
parent
e2161f8388
commit
a16c660048
@ -1,5 +1,7 @@
|
|||||||
module Main exposing (main)
|
module Main exposing (main)
|
||||||
|
|
||||||
|
-- Rules
|
||||||
|
|
||||||
import Ast
|
import Ast
|
||||||
import Ast.Expression exposing (..)
|
import Ast.Expression exposing (..)
|
||||||
import Ast.Statement exposing (..)
|
import Ast.Statement exposing (..)
|
||||||
@ -9,14 +11,8 @@ import Html.Attributes exposing (class, id)
|
|||||||
import Html.Events exposing (on, targetValue)
|
import Html.Events exposing (on, targetValue)
|
||||||
import Json.Decode as JD
|
import Json.Decode as JD
|
||||||
import Lint exposing (lintSource)
|
import Lint exposing (lintSource)
|
||||||
import Lint.Types exposing (LintRule, Severity(..))
|
|
||||||
import Regex exposing (escape, regex)
|
|
||||||
import Result
|
|
||||||
|
|
||||||
|
|
||||||
-- Rules
|
|
||||||
|
|
||||||
import Lint.Rules.DefaultPatternPosition
|
import Lint.Rules.DefaultPatternPosition
|
||||||
|
import Lint.Rules.ElmTest.NoDuplicateTestBodies
|
||||||
import Lint.Rules.NoConstantCondition
|
import Lint.Rules.NoConstantCondition
|
||||||
import Lint.Rules.NoDebug
|
import Lint.Rules.NoDebug
|
||||||
import Lint.Rules.NoDuplicateImports
|
import Lint.Rules.NoDuplicateImports
|
||||||
@ -30,7 +26,9 @@ import Lint.Rules.NoUselessPatternMatching
|
|||||||
import Lint.Rules.NoWarningComments
|
import Lint.Rules.NoWarningComments
|
||||||
import Lint.Rules.SimplifyPiping
|
import Lint.Rules.SimplifyPiping
|
||||||
import Lint.Rules.SimplifyPropertyAccess
|
import Lint.Rules.SimplifyPropertyAccess
|
||||||
import Lint.Rules.ElmTest.NoDuplicateTestBodies
|
import Lint.Types exposing (LintRule, Severity(..))
|
||||||
|
import Regex exposing (escape, regex)
|
||||||
|
import Result
|
||||||
|
|
||||||
|
|
||||||
type Msg
|
type Msg
|
||||||
@ -151,24 +149,24 @@ statement s =
|
|||||||
defaultDisplay =
|
defaultDisplay =
|
||||||
li [] [ pre [] [ text <| toString s ] ]
|
li [] [ pre [] [ text <| toString s ] ]
|
||||||
in
|
in
|
||||||
case s of
|
case s of
|
||||||
FunctionDeclaration _ _ body ->
|
FunctionDeclaration _ _ body ->
|
||||||
displayElementAndExpressions s [ body ]
|
displayElementAndExpressions s [ body ]
|
||||||
|
|
||||||
FunctionTypeDeclaration _ body ->
|
FunctionTypeDeclaration _ body ->
|
||||||
displayElementAndAnyChild s [ body ]
|
displayElementAndAnyChild s [ body ]
|
||||||
|
|
||||||
ModuleDeclaration _ exportSet ->
|
ModuleDeclaration _ exportSet ->
|
||||||
displayElementAndAnyChild s [ exportSet ]
|
displayElementAndAnyChild s [ exportSet ]
|
||||||
|
|
||||||
PortModuleDeclaration _ exportSet ->
|
PortModuleDeclaration _ exportSet ->
|
||||||
displayElementAndAnyChild s [ exportSet ]
|
displayElementAndAnyChild s [ exportSet ]
|
||||||
|
|
||||||
ImportStatement _ _ exportSet ->
|
ImportStatement _ _ exportSet ->
|
||||||
displayElementAndAnyChild s [ exportSet ]
|
displayElementAndAnyChild s [ exportSet ]
|
||||||
|
|
||||||
s ->
|
s ->
|
||||||
defaultDisplay
|
defaultDisplay
|
||||||
|
|
||||||
|
|
||||||
tree : Result (Combine.ParseErr ()) ( b, c, List Statement ) -> Html Msg
|
tree : Result (Combine.ParseErr ()) ( b, c, List Statement ) -> Html Msg
|
||||||
@ -195,14 +193,15 @@ lint source =
|
|||||||
Ok errors ->
|
Ok errors ->
|
||||||
if List.isEmpty errors then
|
if List.isEmpty errors then
|
||||||
[ "No errors." ]
|
[ "No errors." ]
|
||||||
|
|
||||||
else
|
else
|
||||||
List.map (Tuple.second >> .message) errors
|
List.map (Tuple.second >> .message) errors
|
||||||
in
|
in
|
||||||
div []
|
div []
|
||||||
(List.map
|
(List.map
|
||||||
(\message -> p [] [ text message ])
|
(\message -> p [] [ text message ])
|
||||||
messages
|
messages
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
view : String -> Html Msg
|
view : String -> Html Msg
|
||||||
|
Loading…
Reference in New Issue
Block a user