Skip to content
Fallow home
All docs pages

Docs home

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

FactValue
Issue typeunused-export
Rule id in SARIF outputfallow/unused-export
Commandfallow dead-code
Default severityerror
Config key in rulesunused-exports
Filter option--unused-exports
Suppression comment// fallow-ignore-next-line unused-export
Fixable with fallow fixYes
Opt-inNo

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, @alpha and @beta work too). Fallow does not report the exports of an entry file unless includeEntryExports is 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 to entry. For a library workspace in a monorepo, add its name to publicPackages.
  • A name that a framework reads by convention, such as getStaticProps of Next.js: the plugin of the framework marks it as used. When no plugin covers it, add a rule to ignoreExports.
  • Dead code that you keep on purpose: mark it with /** @expected-unused */. Fallow then reports a stale suppression when code starts to use it.