mirror of
https://github.com/jfmengels/elm-review.git
synced 2024-09-11 16:16:09 +03:00
Extract ClassFunction
This commit is contained in:
parent
4ced30b8a8
commit
8d0255af87
28
tests/Css/ClassFunction.elm
Normal file
28
tests/Css/ClassFunction.elm
Normal file
@ -0,0 +1,28 @@
|
||||
module Css.ClassFunction exposing (CssArgument(..), fromLiteral)
|
||||
|
||||
import Dict exposing (Dict)
|
||||
import Elm.Syntax.Expression as Expression exposing (Expression)
|
||||
import Elm.Syntax.ModuleName exposing (ModuleName)
|
||||
import Elm.Syntax.Node as Node exposing (Node)
|
||||
import Elm.Syntax.Range exposing (Range)
|
||||
|
||||
|
||||
type CssArgument
|
||||
= Literal String
|
||||
| Variable Range
|
||||
|
||||
|
||||
type alias CssFunctions =
|
||||
Dict
|
||||
( ModuleName, String )
|
||||
({ firstArgument : Node Expression, restOfArguments : List (Node Expression) } -> List CssArgument)
|
||||
|
||||
|
||||
fromLiteral : Node Expression -> CssArgument
|
||||
fromLiteral node =
|
||||
case Node.value node of
|
||||
Expression.Literal str ->
|
||||
Literal str
|
||||
|
||||
_ ->
|
||||
Variable (Node.range node)
|
@ -1,6 +1,6 @@
|
||||
module Css.NoUnknownClasses exposing
|
||||
( rule
|
||||
, CssArgument(..), addKnownClasses, cssFiles, fromLiteral, withCssUsingFunctions
|
||||
, addKnownClasses, cssFiles, withCssUsingFunctions
|
||||
)
|
||||
|
||||
{-|
|
||||
@ -9,6 +9,7 @@ module Css.NoUnknownClasses exposing
|
||||
|
||||
-}
|
||||
|
||||
import Css.ClassFunction exposing (CssArgument(..), fromLiteral)
|
||||
import Dict exposing (Dict)
|
||||
import Elm.Syntax.Expression as Expression exposing (Expression)
|
||||
import Elm.Syntax.ModuleName exposing (ModuleName)
|
||||
@ -19,7 +20,6 @@ import Parser exposing ((|.), (|=), Parser)
|
||||
import Review.ModuleNameLookupTable as ModuleNameLookupTable exposing (ModuleNameLookupTable)
|
||||
import Review.Rule as Rule exposing (Rule)
|
||||
import Set exposing (Set)
|
||||
import String
|
||||
|
||||
|
||||
{-| Reports... REPLACEME
|
||||
@ -181,11 +181,6 @@ expressionVisitor cssFunctions node context =
|
||||
( [], context )
|
||||
|
||||
|
||||
type CssArgument
|
||||
= Literal String
|
||||
| Variable Range
|
||||
|
||||
|
||||
type alias CssFunctions =
|
||||
Dict
|
||||
( ModuleName, String )
|
||||
|
@ -1,6 +1,7 @@
|
||||
module Css.NoUnknownClassesTest exposing (all)
|
||||
|
||||
import Css.NoUnknownClasses exposing (CssArgument, addKnownClasses, cssFiles, fromLiteral, rule, withCssUsingFunctions)
|
||||
import Css.ClassFunction exposing (CssArgument(..), fromLiteral)
|
||||
import Css.NoUnknownClasses exposing (addKnownClasses, cssFiles, rule, withCssUsingFunctions)
|
||||
import Dict
|
||||
import Elm.Syntax.Expression exposing (Expression)
|
||||
import Elm.Syntax.Node exposing (Node)
|
||||
|
Loading…
Reference in New Issue
Block a user