Gathering detailed insights and metrics for eslint-plugin-unused-imports
Gathering detailed insights and metrics for eslint-plugin-unused-imports
Gathering detailed insights and metrics for eslint-plugin-unused-imports
Gathering detailed insights and metrics for eslint-plugin-unused-imports
Package to separate no-unused-vars and no-unused-imports for eslint as well as providing an autofixer for the latter.
npm install eslint-plugin-unused-imports
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
529 Stars
85 Commits
21 Forks
8 Watching
3 Branches
15 Contributors
Updated on 24 Nov 2024
Minified
Minified + Gzipped
TypeScript (97.31%)
JavaScript (2.69%)
Cumulative downloads
Total Downloads
Last day
1.1%
622,024
Compared to previous day
Last week
4.5%
3,222,471
Compared to previous week
Last month
17.3%
13,197,502
Compared to previous month
Last year
66.5%
121,165,533
Compared to previous year
2
16
Find and remove unused es6 module imports. It works by splitting up the no-unused-vars
rule depending on it being an import statement in the AST and providing an autofix rule to remove the nodes if they are imports. This plugin composes the rule no-unused-vars
of either the typescript or js plugin so be aware that the other plugins needs to be installed and reporting correctly for this to do so.
If running typescript with @typescript-eslint make sure to use both @typescript-eslint/eslint-plugin
and @typescript-eslint/parser
.
If writing react code you need to install eslint-plugin-react
and enable the two rules react/jsx-uses-react
and react/jsx-uses-vars
. Otherwise all imports for components will be reported unused.
You'll first need to install ESLint (and @typescript-eslint if using typescript):
1npm i eslint --save-dev
Next, install eslint-plugin-unused-imports
:
1npm 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.
Add unused-imports
to the plugins section of your eslint.config.js
configuration file.
1import unusedImports from "eslint-plugin-unused-imports"; 2 3export default [{ 4 plugins: { 5 "unused-imports": unusedImports, 6 }, 7 rules: { 8 "no-unused-vars": "off", // or "@typescript-eslint/no-unused-vars": "off", 9 "unused-imports/no-unused-imports": "error", 10 "unused-imports/no-unused-vars": [ 11 "warn", 12 { 13 "vars": "all", 14 "varsIgnorePattern": "^_", 15 "args": "after-used", 16 "argsIgnorePattern": "^_", 17 }, 18 ] 19 } 20}];
no-unused-imports
no-unused-vars
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
4 commit(s) and 2 issue activity found in the last 90 days -- score normalized to 5
Reason
6 existing vulnerabilities detected
Details
Reason
Found 6/29 approved changesets -- score normalized to 2
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More