import-js/eslint-plugin-import
[import/no-unused-modules] Doesn't detect unused exports through an export all
開放
#2,688 建立於 2023年1月21日
bughelp wanted
倉庫指標
- 星標
- (5,940 顆星)
- PR 合併指標
- (PR 指標待抓取)
描述
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?