Skip to content
Fallow home
All docs pages

Docs home

Absent optional component props

What an absent-component-prop finding of fallow dead-code means, why it matters and how to fix it.

What it reports

Known reachable callers do not supply this used optional input; review defaults and API intent manually.

Dead code explains how fallow finds it.

Why it matters

No caller passes the prop, so the code that reads it always runs with the default value. The other branch has no caller to test it, and the component looks more configurable than it is.

Example

Card declares highlight?: boolean with a false default, reads highlight in its render body, and every inspected reachable caller renders <Card /> without highlight.

Fix

Review inspected callers, defaults and API intent. Keep intentional stable props, update the component manually, or add a declaration-line fallow-ignore-next-line absent-component-prop comment. This candidate has no automatic fix.

Facts

FactValue
Issue typeabsent-component-prop
Rule id in SARIF outputfallow/absent-component-prop
Commandfallow dead-code
Default severityoff
Config key in rulesabsent-component-props
Filter option--absent-component-props
Suppression comment// fallow-ignore-next-line absent-component-prop
Fixable with fallow fixNo
Opt-inYes

Note. Opt-in manual review candidate; defaults to off. Inspect caller evidence and defaults before changing the component. No automatic fix.

When to keep the code

  • The default value can be intentional. Keep a stable prop when you expect callers to pass it later.

Notes

A caller that passes compact={false} or compact={undefined} supplies the prop. Fallow skips the component when a spread, a dynamic component or a wrapper hides which props a caller passes.