[import/no-unused-modules] Doesn't detect unused exports through an export all
#2 688 ouverte le 21 janv. 2023
Métriques du dépôt
- Stars
- (5 940 étoiles)
- Métriques de merge PR
- (Merge moyen 138j 22h) (3 PRs mergées en 30 j)
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?