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

False positive on method that is used in base class of base class #414

Open
JoshuaKGoldberg opened this issue Dec 24, 2023 · 1 comment
Open
Labels
bug Something isn't working

Comments

@JoshuaKGoldberg
Copy link
Contributor

👋 Reporting JoshuaKGoldberg/ts-api-utils#343 over here. The relevant classes in https://github.com/JoshuaKGoldberg/ts-api-utils/blob/8c747294f24d0adca8817f4028832b855d907b5b/src/usage/scopes.ts are:

  1. abstract class AbstractScope implements Scope
  2. class NonRootScope extends AbstractScope
  3. class NamespaceScope extends NonRootScope

NamespaceScope defines a finish() method. That method is referenced in the AbstractScope class method end, in a this.namespaceScopes.forEach((value) => value.finish(cb));. Yet Knip is reporting it as unused:

$ pnpm lint:knip:production

> ts-api-utils@1.0.3 lint:knip:production /Users/josh/repos/ts-api-utils
> knip --config knip.production.jsonc --production

Analyzing workspace ....
The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting
Unused exported class members (1)
finish  NamespaceScope  src/usage/scopes.ts:358:2
 ELIFECYCLE  Command failed with exit code 1.
@webpro
Copy link
Owner

webpro commented Dec 27, 2023

Very odd. In --production mode vitest is not imported (no test files included), and that's somehow what makes the difference in behavior.

You can drop import "vitest" in src/index.ts and it won't report finish as unused anymore.

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

2 participants