Unused exports
What an unused-export finding of fallow dead-code means, why it matters and how to fix it.
What it reports
Export is never imported.
Dead code explains how fallow finds it.
Why it matters
An export that nothing imports looks like an API that other code depends on, so nobody dares to change or remove it. Code that only this export uses stays in the project with it.
Example
export const formatPrice = ... exists in src/money.ts, but no module imports formatPrice.
Fix
Remove the export or make it file-local. If it is public API, import it from an entry point or add an intentional suppression with context. To treat exported Effect schemas as type contracts, set effect.schemaExportsAsTypes: fallow then reports them as unused types.
Facts
| Fact | Value |
|---|---|
| Issue type | unused-export |
| Rule id in SARIF output | fallow/unused-export |
| Command | fallow dead-code |
| Default severity | error |
Config key in rules | unused-exports |
| Filter option | --unused-exports |
| Suppression comment | // fallow-ignore-next-line unused-export |
Fixable with fallow fix | Yes |
| Opt-in | No |
When to keep the code
- Public API of a library: code outside the project imports the export. Put a
/** @public */JSDoc tag on the export (@internal,@alphaand@betawork too). Fallow does not report the exports of an entry file unlessincludeEntryExportsis on (a framework file that a plugin knows, such as a Next.js page, is the exception: fallow checks its other exports always), so you can also add the entry file of the package toentry. For a library workspace in a monorepo, add its name topublicPackages. - A name that a framework reads by convention, such as
getStaticPropsof Next.js: the plugin of the framework marks it as used. When no plugin covers it, add a rule toignoreExports. - Dead code that you keep on purpose: mark it with
/** @expected-unused */. Fallow then reports a stale suppression when code starts to use it.