Skip to content
Fallow home
All docs pages

Docs home

Unprovided injects

What an unprovided-inject finding of fallow dead-code means, why it matters and how to fix it.

What it reports

inject() / getContext() reads a key that no provide() / setContext() supplies.

Dead code explains how fallow finds it.

Why it matters

A Vue inject(KEY) or Svelte getContext(KEY) reads a dependency-injection key (an imported or module-local symbol) that no matching provide(KEY) / setContext(KEY) supplies anywhere in the project. The read resolves to undefined at runtime, surfaced only at render. To fix: add a matching provider for the key, or remove the dead inject. Defaults to warn, not error: a provider may live outside the analyzed graph (an app-level provide registered elsewhere, a plugin, a host application). String-literal keys and keys imported from a package are abstained.

Example

A component calls inject(ThemeKey) (Vue) or getContext(ThemeKey) (Svelte) with an imported symbol key, but no provide(ThemeKey) / setContext(ThemeKey) exists anywhere in the project.

Fix

Add a matching provide() / setContext() for the key, or remove the dead inject() / getContext(). If a provider lives outside the analyzed graph (an app-level provide registered elsewhere, a plugin, a host app), suppress the line with // fallow-ignore-next-line unprovided-inject.

Facts

FactValue
Issue typeunprovided-inject
Rule id in SARIF outputfallow/unprovided-inject
Commandfallow dead-code
Default severitywarn
Config key in rulesunprovided-injects
Filter option--unprovided-injects
Suppression comment// fallow-ignore-next-line unprovided-inject
Fixable with fallow fixNo
Opt-inNo