Skip to content
Fallow home
All docs pages

Docs home

Duplicate prop shapes

What a duplicate-prop-shape finding of fallow dead-code means, why it matters and how to fix it.

What it reports

Three or more React/Preact components across two or more files declare an identical prop-name set (a missing shared Props type).

Dead code explains how fallow finds it.

Why it matters

Three or more distinct React/Preact components, living in two or more files, whose statically-harvested prop name set is byte-for-byte identical after (a) excluding a fixed denylist of ubiquitous DOM / render-passthrough prop names (className, style, id, children, key, ref, the common event handlers, plus data-* / aria-* by prefix) and (b) requiring the remaining significant set to have four or more members. Identity is over names only, never types (fallow does not resolve types). This is a structural-refactor health signal: the recurring shape is a missing shared abstraction, so extract one shared Props type (or a base component) that every member reuses. It is never a correctness error and never an auto-fix. fallow emits one located record per participating component, each naming the shared shape, the group_size, and the other members in sharing_components. The rule defaults to off (opt-in), like thin-wrapper and the security rules: enable it with duplicate-prop-shape: "warn" in rules. Anti-noise gates (defended as rule-of-three plus a denylist-survivor floor, not tuned magic): the four-significant-prop floor turns {label, onClick} buttons into non-findings; the three-component floor is the rule-of-three abstraction trigger; the two-file floor keeps a local same-shaped variant pair (a render-prop pair, a Foo/FooImpl split) unflagged. A component whose props are not fully harvestable (a rest/spread signature, a forwardRef/memo over an imported interface) abstains, because a partial prop set can never be proven identical. Exact full-set identity only: a superset / subset relationship does not group, so a four-prop group and a five-prop superset form two findings (the price of zero invalid groups: the finding always fits one extracted shared type). The check runs only when the project declares react / react-dom / next / preact.

Example

FieldText, FieldNumber, and FieldSelect (across three files) each declare exactly { name, label, value, onChange, error }. The five significant prop names are identical, so they form one duplicate-prop-shape group.

Fix

Extract one shared Props type (e.g. type FieldProps = { name; label; value; onChange; error }) that every member reuses, or a base component the variants compose. Keep them separate only if a per-variant prop divergence is planned. Enable the rule with rules.duplicate-prop-shape = "warn" (it defaults to off). To accept one member, suppress it with // fallow-ignore-next-line duplicate-prop-shape above the component definition; the suppressed member still appears in its siblings' sharing_components because the group is real regardless of suppression.

Facts

FactValue
Issue typeduplicate-prop-shape
Rule id in SARIF outputfallow/duplicate-prop-shape
Commandfallow dead-code
Default severityoff
Config key in rulesduplicate-prop-shape
Suppression comment// fallow-ignore-next-line duplicate-prop-shape
Fixable with fallow fixNo
Opt-inYes

Note. Opt-in: set rules.duplicate-prop-shape to warn or error to enable. Defaults to off.