You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, after seeing that #697 was closed, I updated knip in the repro for that issue (here) to verify.
The behavior on v5.23.0 was that a, b, c, and d were reported as unused while the other two exports that used multiline exports were not reported (even though they were also unused). The new behavior on v5.23.1 is that none of the exports are reported as unused.
The text was updated successfully, but these errors were encountered:
neelmraman
changed the title
Exports previously reported as unused are no longer reported
Exports previously legitimately reported as unused are no longer reported
Jun 27, 2024
There's a few things to this one. We're only talking about the combination of:
ignoreExportsUsedInFile: true
The export { id } notation
Unfortunately, internally when using the TypeScript AST nodes there's a big difference between these notations:
exportconstid=1;
constid=1;export{id};
With the latter syntax, I couldn't find a reliable way to detect whether id was used more often or not within the same module. That's why I've opted for the stability of assuming export { id } is referenced (which technically could be argued it is, but it could be only the declaration, not other usage).
So this is the situation now, until we've found a reliable way to do it better.
Additional notes:
Usually ignoreExportsUsedInFile is used only for types, since values don't need to be exported. E.g. "ignoreExportsUsedInFile": { "interface": true, "type": true }
The former syntax doesn't have this issue, so purely from a Knip perspective that would be recommended.
Hi, after seeing that #697 was closed, I updated knip in the repro for that issue (here) to verify.
The behavior on v5.23.0 was that a, b, c, and d were reported as unused while the other two exports that used multiline exports were not reported (even though they were also unused). The new behavior on v5.23.1 is that none of the exports are reported as unused.
The text was updated successfully, but these errors were encountered: