webpro-nl / knip

✂️ Find unused files, dependencies and exports in your JavaScript and TypeScript projects. Knip it before you ship it!
https://knip.dev
ISC License
7.03k stars 174 forks source link

🐛 knip command hanging with an empty exported enum key #800

Closed ihatem closed 1 month ago

ihatem commented 1 month ago

Prerequisites

Reproduction url

https://codesandbox.io/p/sandbox/gracious-oskar-2kxcsc

Reproduction access

Description of the issue

I found a very weird bug where knip get stuck at Analyzing source files... when there's an exported enum with an empty key:

export enum TestEnum {
  "" = "test",
}

Note that you can reproduce this bug only when the enum is exported and the key is empty. If you remove the export or you replace the empty key by something else it will work.

webpro commented 1 month ago

Dang, this is a tough one. Thanks for the report! I'm on it.

webpro commented 1 month ago

Not tough at all, debugger was borked.

You can use the following or wait until released:

npm i -D https://pkg.pr.new/knip@d9ae5dc
webpro commented 1 month ago

:rocket: This issue has been resolved in v5.32.0. See Release 5.32.0 for release notes.

Using Knip in a commercial project? Please consider becoming a sponsor.