[import/no-unused-modules] Doesn't detect unused exports through an export all
#2,688 opened on Jan 21, 2023
Repository metrics
- Stars
- (5,940 stars)
- PR merge metrics
- (Avg merge 138d 22h) (3 merged PRs in 30d)
Description
I'd be happy to contribute the fix if wanted
I'd expect n.js to report it's export is unused, but it doesn't:
import { u1 } from './reexport'
//reexport.js`
export * from './n'
export * from './u'
// n.js
export const n1 = 'n
// u.js
export const u1 = 1
I've looked into trying to address this but it was more complicated than initially expected so i wanted to check in before diving down some road. All the approaches i've initially tried end up being limited by how exportList tracks ExportAllDeclarations, in that it only marks them as used if it was directly used by an importing module, but not if there is a re-export in between. AFAICT there wasn't an obvious place to extend to add this, but i assume somewhere in the importList/exportList creation?