Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Unused dependency when name matches node built-in #807

Open
6 tasks done
sparten11740 opened this issue Oct 9, 2024 · 0 comments
Open
6 tasks done

🐛 Unused dependency when name matches node built-in #807

sparten11740 opened this issue Oct 9, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@sparten11740
Copy link

Prerequisites

Reproduction url

https://codesandbox.io/p/devbox/2kk4rm?migrateFrom=fq39nt

Reproduction access

  • I've made sure the reproduction is publicly accessible

Description of the issue

In packages that are meant to run in a non-node context (such as RN or the browser), it is common to depend on packages such as assert. The DependencyDuty (love the name btw) exits early when hitting a node built-in and doesn't consider it referenced. This results in false positives for unused dependencies being reported for packages that match node built-in module names.

if (isBuiltin(packageName)) return true;

Our current workaround is to ignore those dependencies, but it might be more ideal to have a way to let knip know that node built-ins are not available.

@sparten11740 sparten11740 added the bug Something isn't working label Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant