Thin wrappers
What a thin-wrapper finding of fallow dead-code means, why it matters and how to fix it.
What it reports
A React/Preact component whose whole body is a single spread-forwarded child render (a candidate for inlining).
Dead code explains how fallow finds it.
Why it matters
A React/Preact component whose entire body is structural indirection: it returns exactly one capitalized component element that forwards the component's own props via a bare spread (return <Child {...props}/>), with no host-element wrapper, no extra children, no named attributes alongside the spread, no hooks, no branching, and no other statements. Such a component adds nothing of its own: it is a candidate for inlining at its call sites or deleting, not a correctness error. fallow emits a located per-wrapper record (file + line + the wrapper and child component names) so CI and an agent can act. The rule defaults to off (opt-in), like prop-drilling and the security rules: enable it with thin-wrapper: "warn" in rules. Zero false positives by construction: a forwardRef / memo wrapper (the sanctioned way to make a child ref-able or set a perf boundary), an exported component (a public-API re-brand / encapsulation), a context *.Provider wrapper, a cloneElement / render-prop forward, a wrapper that passes any named attribute alongside the spread (a fixed configuration), a self-render, or an unresolvable / member-expression child all abstain. A TypeScript-only type-narrowing wrapper (const StrictButton = (p: StrictProps) => <Button {...p}/>) is a known limitation, because fallow reads syntax and does not resolve types; suppress it with the inline comment. The check runs only when the project declares react / react-dom / next / preact.
Example
const ButtonWrapper = (props) => <Button {...props}/>; the wrapper has no own markup, hooks, or logic, so it only re-points at Button.
Fix
Inline the wrapper at its call sites (use <Button .../> directly) or delete it. Keep it only if it is a deliberate seam (a planned divergence point, a public-API re-brand): an exported wrapper already abstains. Enable the rule with rules.thin-wrapper = "warn" (it defaults to off). To accept one wrapper, suppress it with // fallow-ignore-next-line thin-wrapper above the component definition.
Facts
| Fact | Value |
|---|---|
| Issue type | thin-wrapper |
| Rule id in SARIF output | fallow/thin-wrapper |
| Command | fallow dead-code |
| Default severity | off |
Config key in rules | thin-wrapper |
| Suppression comment | // fallow-ignore-next-line thin-wrapper |
Fixable with fallow fix | No |
| Opt-in | Yes |
Note. Opt-in: set rules.thin-wrapper to warn or error to enable. Defaults to off.