[import/no-unused-modules] Doesn't detect unused exports through an export all
#2688 aperta il 21 gen 2023
Metriche repository
- Star
- (5940 stelle)
- Metriche merge PR
- (Merge medio 138g 22h) (3 PR mergiate in 30 g)
Descrizione
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?