deslop/cross-file-duplicate-export
Flag the same export name emitted from multiple files that share a common importer (ambiguous public name).
- Category: Architecture
- Severity: warn
- Source:
deslop-js - Framework: global
- Enabled when: react-doctor deadCode analysis enabled (default true); whole-project scan only — skipped in --diff/--staged modes
- Documentation: https://github.com/millionco/deslop-js
Validation prompt
Use this to decide whether a fired diagnostic is real or a false positive.
Fires from deslop's detectCrossFileDuplicateExports when one non-default, non-re-exported value/type name is exported from 2+ reachable source files that share a common importer, with reason "<name>" is exported from N files that share a common importer — consumers may import the wrong one (confidence medium); deslop already prunes default exports, re-export/barrel chains, and the TS value-vs-type namespace split, so a confirmed finding is two genuinely independent declarations of the same public symbol. False positive: an intentional per-feature convention where each module deliberately exports a uniformly-named symbol (e.g. every feature folder exporting routes, schema, or Provider) that consumers reach via distinct module paths and never confuse — suppress when the duplication is a documented naming pattern, not an accidental name collision a consumer could import from the wrong file.
Fix prompt
Use this once validation confirms the diagnostic is real.
Disambiguate or consolidate: if the two declarations are truly the same thing, keep one canonical definition and have the other file re-export it (export { thing } from "./canonical") or delete the dead copy; if they are different concepts, rename one to reflect its module (export const userSchema / export const orderSchema instead of two schema) so a common importer can't grab the wrong symbol. If it is a deliberate same-name-per-module convention, route consumers through namespaced imports (import * as user from "./user") rather than flat named imports. See https://github.com/millionco/deslop-js