Repository navigation
Apply the fix flags in the quick fix that removes exports - #2427
Conversation
commit: |
webpro
left a comment
There was a problem hiding this comment.
Thanks! Sharing the core remover with the quick fix is the right direction: export lists and enum members no longer come out malformed, such as the leading comma left in a multi-line re-export.
One follow-up, here or in a separate PR: when the removed export was the file's last import or export, the CLI --fix leaves export {} so the file stays a module, and the quick fix does not. That gap already exists on main for export const, and this adds the list form. Moving that check next to removeExport and calling it from the code action would cover both.
|
🚀 This pull request is included in v6.47.0. See Release 6.47.0 for release notes. Using Knip in a commercial project? Please consider becoming a sponsor. |
The quick fix that removes an unused export or enum member deletes only the range of each fix. In zotero-mcp, Knip reports
EmbeddingServiceand other names this barrel re-exports as unused, and removingEmbeddingServiceleaves a line with just,in the list, a syntax error. That happens to 20 quick fixes in the file, and to 15 of the 48 on thefixandfix-membersfixtures that--fixis tested against, such as removingFourthfromexport { Four as Fourth, Five as Fifth }orNorthfrom its enum. None do with this change.createRemoveExportEditignored the flags that come with each fix. It now applies them with the sameremoveExportas--fix, exported fromknip/session, and returns one edit for the changed range. Same kind of fix as #2033 for dependencies.