sajad torkamani

Install plugin

Ensure ESLint is installed and configured first, and then run:

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

Add plugin to plugins section of your ESLint config file:

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

Merge the following rules with any existing rules:

{
	"rules": {
		"no-unused-vars": "off", // or "@typescript-eslint/no-unused-vars": "off",
		"unused-imports/no-unused-imports": "error",
		"unused-imports/no-unused-vars": [
			"warn",
			{ "vars": "all", "varsIgnorePattern": "^_", "args": "after-used", "argsIgnorePattern": "^_" }
		]
	}
}

Links

Docs