Duplicate export aliases
What a duplicate-export-alias finding of fallow dead-code means, why it matters and how to fix it.
What it reports
One module exports one binding under two or more names.
Dead code explains how fallow finds it.
Why it matters
One module exports the same binding under two or more names, for example export const layer = make(); export default layer; or export { a, a as b }. Consumers can import one value under several names, so the export surface is larger than it needs to be. Fallow groups the exports of a file by binding: a local binding name, or the source and imported name of a named re-export. Value and type-only exports are separate groups, and a plain specifier of a name that the file declares only as a type joins the type group. Two bindings with the same initializer are two bindings and are not reported. export *, files with CommonJS exports (export =, module.exports), component files and unreachable files are skipped. ignoreExports exempts a file with *, or a binding when one of its names is listed. Default warn. The rule differs from duplicate-export, which reports one export name in several files.
Example
src/worker.ts has export const handler = createHandler() and export default handler, so one binding has the names handler and default.
Fix
Keep one export name and update the importers of the other names. If the names are an intentional public API, add them to ignoreExports, or suppress the line with // fallow-ignore-next-line duplicate-export-alias.
Facts
| Fact | Value |
|---|---|
| Issue type | duplicate-export-alias |
| Rule id in SARIF output | fallow/duplicate-export-alias |
| Command | fallow dead-code |
| Default severity | warn |
Config key in rules | duplicate-export-aliases |
| Filter option | --duplicate-export-aliases |
| Suppression comment | // fallow-ignore-file duplicate-export-alias |
Fixable with fallow fix | No |
| Opt-in | No |