Skip to content
Removes unused imports from Elm code
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
command line tool (npm package)
parser
elm-package.json
readme.md

readme.md

Elm imports cleanup tool

Removes unused imports from Elm code. You must pass in the source code as text or install the command line tool from npm (see below).

import Impfix exposing (impfix)

sampleModule = 
	"""
module MyApp exposing (..)

import Html
import Json.Encode as Enc
import List exposing (any, concat, filter, map)
import MyModule exposing (..)

myFunc xs =
	map Enc.int <| map f xs

	"""

impfix sampleModule [] ==
	"""
module MyApp exposing (..)

import Json.Encode as Enc
import List exposing (map)
import MyModule exposing (..)
	"""

sampleImport = 
	"""
module MyImport exposing (..)

f x = x + 1

g x = x - 1 
	"""

impfix sampleModule [sampleImport] == 
	"""
module MyApp exposing (..)

import Json.Encode as Enc
import List exposing (map)
import MyModule exposing (f)
	"""

Command line tool

Install the npm package:

npm install -g elm-impfix

Then:

$ elm-impfix MyModule.elm

Try it in the browser

Copy/paste your code into the live version.

You can’t perform that action at this time.