Unused optionalDependencies
What an unused-optional-dependency finding of fallow dead-code means, why it matters and how to fix it.
What it reports
Optional dependency listed but never imported.
Dependencies explains how fallow finds it.
Why it matters
The package manager still tries to install the package on each install. Its advisories and version updates still need a review, and readers assume that some platform needs it.
Example
package.json lists left-pad, but no source, script, config, or plugin-recognized file imports it.
Fix
Remove the dependency after checking runtime/plugin usage. If another workspace uses it, move the dependency to that workspace.
Facts
| Fact | Value |
|---|---|
| Issue type | unused-optional-dependency |
| Rule id in SARIF output | fallow/unused-optional-dependency |
| Command | fallow dead-code |
| Default severity | warn |
Config key in rules | unused-optional-dependencies |
| Filter option | --unused-deps |
Fixable with fallow fix | Yes |
| Opt-in | No |
Note. --unused-deps controls unused-dependency, unused-dev-dependency, unused-optional-dependency, type-only-dependency, test-only-dependency, and dev-dependency-in-production.