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 files server.js #893

Open
6 tasks done
thoughtsunificator opened this issue Dec 26, 2024 · 3 comments
Open
6 tasks done

🐛 Unused files server.js #893

thoughtsunificator opened this issue Dec 26, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@thoughtsunificator
Copy link

thoughtsunificator commented Dec 26, 2024

Prerequisites

Reproduction url

See description

Reproduction access

  • I've made sure the reproduction is publicly accessible

Description of the issue

.
├── package.json
├── package-lock.json
└── server.js

Foo

package.json

{
  "name": "foo",
  "version": "1.0.0",
  "main": "index.js",
  "type": "module",
  "scripts": {
    "test": "knip"
  },
  "dependencies": {
    "knip": "5.41.1"
  }
}

[user@pc foo]$ npm test

> [email protected] test
> knip

Unused files (1)
server.js

@thoughtsunificator thoughtsunificator added the bug Something isn't working label Dec 26, 2024
@thoughtsunificator
Copy link
Author

thoughtsunificator commented Dec 26, 2024

See https://docs.npmjs.com/cli/v10/configuring-npm/package-json#default-values

I'm guessing there's the same issue with index.js, although I have not tested (yet)

@webpro
Copy link
Collaborator

webpro commented Jan 4, 2025

Interesting. But this is a default only to npm? Not sure how widely recognized this is.

You can add entry: ["server.js"] to your Knip config.

The default entry file patterns are here: https://knip.dev/explanations/entry-files#default-entry-file-patterns - so index.js is picked up automatically.

@thoughtsunificator
Copy link
Author

I'd say pretty much any package manager that interfaces with package.json such as yarn, pnpm etc..

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