Point unexposed error to more narrow exposing line.

This commit is contained in:
Dillon Kearns 2021-08-27 09:27:04 -07:00
parent 194470aaf4
commit 27c75fba9b
2 changed files with 16 additions and 13 deletions

View File

@ -8,7 +8,7 @@ module Pages.Review.NoContractViolations exposing (rule)
import Dict exposing (Dict)
import Elm.Syntax.Declaration as Declaration exposing (Declaration)
import Elm.Syntax.Exposing as Exposing
import Elm.Syntax.Exposing as Exposing exposing (Exposing)
import Elm.Syntax.Module as Module exposing (Module)
import Elm.Syntax.Node as Node exposing (Node)
import Elm.Syntax.TypeAnnotation as TypeAnnotation exposing (TypeAnnotation)
@ -107,7 +107,7 @@ But it is not exposing: """
++ (nonEmpty |> String.join ", ")
]
}
(Node.range node)
(Node.range (exposingListNode (Node.value node)))
]
, { moduleName = Node.value node |> Module.moduleName
, isPageModule = isPageModule
@ -122,16 +122,6 @@ But it is not exposing: """
)
exposedFunctionName : Node Exposing.TopLevelExpose -> Maybe String
exposedFunctionName value =
case Node.value value of
Exposing.FunctionExpose functionName ->
Just functionName
_ ->
Nothing
routeParamsMatchesNameOrError : Node a -> Node TypeAnnotation -> List String -> List (Error {})
routeParamsMatchesNameOrError typeAliasNode annotation moduleName =
case stringFields typeAliasNode annotation of
@ -391,3 +381,16 @@ getExposedName exposedValue =
Exposing.TypeExpose exposedType ->
Just exposedType.name
exposingListNode : Module -> Node Exposing
exposingListNode m =
case m of
Module.NormalModule x ->
x.exposingList
Module.PortModule x ->
x.exposingList
Module.EffectModule x ->
x.exposingList

View File

@ -28,7 +28,7 @@ a = 1
But it is not exposing: Model"""
]
, under = "module Page.Blog.Slug_ exposing (Data, Msg, page)"
, under = "exposing (Data, Msg, page)"
}
]
, test "reports RouteParams mismatch" <|