Skip to content

Package to seperate no-unused-vars and no-unused-imports for eslint as well as providing an autofixer for the latter.

Notifications You must be signed in to change notification settings

patrick-entinux/eslint-plugin-unused-imports

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eslint-plugin-unused-imports

Find and remove unused es6 modules

Typescript

If running typescript-eslint please use the -ts extension on your rules to make this also leverage type information (otherwise the autofixer will remove imports only used for type information).

Installation

You'll first need to install ESLint:

$ npm i eslint --save-dev

Next, install eslint-plugin-unused-imports:

$ npm install eslint-plugin-unused-imports --save-dev

Note: If you installed ESLint globally (using the -g flag) then you must also install eslint-plugin-unused-imports globally.

Usage

Add unused-imports to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
	"plugins": ["unused-imports"]
}

Then configure the rules you want to use under the rules section.

e.g.

{
	"rules": {
		"no-unused-vars": "off",
		"unused-imports/no-unused-imports": 2,
		"unused-imports/no-unused-vars": 1
	}
}

Supported Rules

  • no-unused-imports
  • no-unused-vars
  • no-unused-imports-ts
  • no-unused-vars-ts

About

Package to seperate no-unused-vars and no-unused-imports for eslint as well as providing an autofixer for the latter.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%