Skip to content
Fallow home
All docs pages

Docs home

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

FactValue
Issue typeunused-optional-dependency
Rule id in SARIF outputfallow/unused-optional-dependency
Commandfallow dead-code
Default severitywarn
Config key in rulesunused-optional-dependencies
Filter option--unused-deps
Fixable with fallow fixYes
Opt-inNo

Note. --unused-deps controls unused-dependency, unused-dev-dependency, unused-optional-dependency, type-only-dependency, test-only-dependency, and dev-dependency-in-production.