-
Notifications
You must be signed in to change notification settings - Fork 148
Open
Description
elm-format 0.8.8
Description:
A file containing multiple imports with different import alias, such as import Json.Encode and import Json.Encode as Encode will mistakenly have import Json.Encode being removed, but forgot to update the usages in code
Here's a minimal code:
Sample.elm
module Sample exposing (..)
import Json.Encode
import Json.Encode as Encode
import Browser exposing (sandbox)
import Html exposing (Html)
view : () -> Html.Html msg
view model =
let
_ = Json.Encode.object [ ("key", Json.Encode.string "value") ]
in
Html.div [] [ Html.text "Hello, Elm!" ]
main : Program () () ()
main =
sandbox
{ init = ()
, update = \_ model -> model
, view = view
}
npx elm-format .\src\Sample.elm
Output
module Sample exposing (..)
import Browser exposing (sandbox)
import Html exposing (Html)
import Json.Encode as Encode
view : () -> Html.Html msg
view model =
let
_ =
Json.Encode.object [ ( "key", Json.Encode.string "value" ) ]
in
Html.div [] [ Html.text "Hello, Elm!" ]
main : Program () () ()
main =
sandbox
{ init = ()
, update = \_ model -> model
, view = view
}
The output now contains error, as it only keeps import Json.Encode as Encode but keep using Json.Encode in the code
I expect the code to convert those instances to Encode.object instead of Json.Encode.object
Metadata
Metadata
Assignees
Labels
No labels