# Is there a way to determine unused imports in a module?

**URL:** <https://discourse.elm-lang.org/t/is-there-a-way-to-determine-unused-imports-in-a-module/3946>\
**Category:** Learn\
**Created:** [July 7, 2019, 8:34am UTC](https://discourse.elm-lang.org/t/is-there-a-way-to-determine-unused-imports-in-a-module/3946 "2019-07-07T08:34:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dwayne](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/dwayne/32/5478_2.png) [@dwayne](https://discourse.elm-lang.org/u/dwayne)\
**Post date:** [July 7, 2019, 8:34am UTC](https://discourse.elm-lang.org/t/is-there-a-way-to-determine-unused-imports-in-a-module/3946/1 "2019-07-07T08:34:17Z")

</div>

I know the Elm compiler does dead code elimination. But I still don’t like it when I’ve imported something and it isn’t being used.

```elm
import Html exposing (span)

```

Maybe I was using `span` but at some point I decided not to use it anymore. If I forget to remove the import I want Elm to tell me that I have an unused import (namely, `span`). Is there a way to make that happen?

---

<div class="post-metadata">

**Author:** ![opvasger](https://avatars.discourse-cdn.com/v4/letter/o/8e8cbc/32.png) [@opvasger](https://discourse.elm-lang.org/u/opvasger)\
**Post date:** [July 7, 2019, 8:53am UTC](https://discourse.elm-lang.org/t/is-there-a-way-to-determine-unused-imports-in-a-module/3946/2 "2019-07-07T08:53:52Z")

</div>

`elm-analyse` solves the problem quite well. It available as part of the `elmLS` extension for the vs-code editor ☀

---

<div class="post-metadata">

**Author:** ![ChrisWellsWood](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/chriswellswood/32/5293_2.png) [@ChrisWellsWood](https://discourse.elm-lang.org/u/ChrisWellsWood)\
**Post date:** [July 7, 2019, 8:56am UTC](https://discourse.elm-lang.org/t/is-there-a-way-to-determine-unused-imports-in-a-module/3946/3 "2019-07-07T08:56:02Z")

</div>

[`elm-analyse`](https://github.com/stil4m/elm-analyse) catches unused imports. It work really nicely with the [`elm-language-server`](https://github.com/elm-tooling/elm-language-server), which you can easily hook up to Vim, VSCode etc.

---

<div class="post-metadata">

**Author:** ![catz](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/catz/32/1007_2.png) [@catz](https://discourse.elm-lang.org/u/catz)\
**Post date:** [July 7, 2019, 10:47am UTC](https://discourse.elm-lang.org/t/is-there-a-way-to-determine-unused-imports-in-a-module/3946/4 "2019-07-07T10:47:51Z")

</div>

Intellij idea with elm plugin does it pretty well.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/elm_lang/original/1X/50a05e53677a2c3b47776d7abd0f113eb50193a1.png) [@system](https://discourse.elm-lang.org/u/system)\
**Post date:** [July 17, 2019, 10:48am UTC](https://discourse.elm-lang.org/t/is-there-a-way-to-determine-unused-imports-in-a-module/3946/5 "2019-07-17T10:48:00Z")

</div>

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
