Skip to content

Improve Knip configuration for monorepo setup #3884

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

Open
KJ7LNW opened this issue May 23, 2025 · 1 comment
Open

Improve Knip configuration for monorepo setup #3884

KJ7LNW opened this issue May 23, 2025 · 1 comment
Labels
Issue - Unassigned / Actionable Clear and approved. Available for contributors to pick up.

Comments

@KJ7LNW
Copy link
Collaborator

KJ7LNW commented May 23, 2025

This issue references the discussion in PR #3810 about improving our Knip configuration for the monorepo setup.

@webpro (who is the primary Knip developer) suggested the following configuration which would be more effective for our monorepo structure:

{
"$schema": "https://unpkg.com/knip@latest/schema.json",
"workspaces": {
".": {
"entry": ["src/extension.ts", "src/workers/countTokens.ts", "src/**/__tests__/**/*{b,B}enchmark.ts"],
"project": ["src/**/*.ts"]
},
"webview-ui": {
"entry": ["src/index.tsx"],
"project": ["src/**/*.{ts,tsx}"]
}
},
"ignore": ["**/__mocks__/**"]
}

Key points from @webpro:

  1. In a monorepo, the top-level entry and project options are not effective and should be in the root workspace config at workspaces["."]
  2. Using --debug can help see the "Included workspace configs" that Knip uses
  3. The ignore option in the config can be removed entirely after installing [email protected] or later

This configuration would help resolve issues like the one encountered with src/utils/storageUtils.ts being flagged incorrectly.

cc: @webpro @cte

@KJ7LNW
Copy link
Collaborator Author

KJ7LNW commented May 27, 2025

blocks #3810

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue - Unassigned / Actionable Clear and approved. Available for contributors to pick up.
Projects
Status: Issue [Unassigned]
Development

No branches or pull requests

2 participants