babel-plugin-danger-remove-unused-import

[![Build status](https://img.shields.io/travis/imcuttle/babel-plugin-danger-remove-unused-import/master.svg?style=flat-square)](https://travis-ci.org/imcuttle/babel-plugin-danger-remove-unused-import) [![Test coverage](https://img.shields.io/codecov/c/git

Usage no npm install needed!

<script type="module">
  import babelPluginDangerRemoveUnusedImport from 'https://cdn.skypack.dev/babel-plugin-danger-remove-unused-import';
</script>

README

babel-plugin-danger-remove-unused-import

Build status Test coverage NPM version NPM Downloads Prettier Conventional Commits

For shrinking the bundled javascript size :smile:

Note: remove unused import is dangerous
because the imported package may have some side effects!

Option

{
  ignore: ['react']
}

Input

import React from 'react'
import Button from 'button'
import _ from 'lodash'
import moment from 'moment'
import { data } from '../some-where'

// ...

const a = {}
a.moment = <Button x={data} />

Output

import React from 'react'
import Button from 'button'
- import _ from 'lodash'
- import moment from 'moment'
import {data} from '../some-where'

// ...

const a = {}
a.moment = <Button x={data} />

Todo

  • Supporting Scope