hyperdx/knip.json
Brandon Pereira b642ce43d3
feat: Add Knip for unused code analysis with CI reporting (#1954)
## Summary

Adds [Knip](https://knip.dev) to the monorepo to detect unused files, dependencies, and exports. The goal is to reduce dead code over time and prevent new unused code from accumulating.

**What's included:**
- Root-level `knip.json` configured for all three workspaces (`packages/app`, `packages/api`, `packages/common-utils`)
- `yarn knip` and `yarn knip:ci` scripts for local and CI usage
- GitHub Action (`.github/workflows/knip.yml`) that runs on every PR to `main`, compares results against the base branch, and posts a summary comment showing any increase or decrease in unused code
- Removed the previous app-only `packages/app/knip.json` in favor of the monorepo-wide config

**How the CI workflow works:**
1. Runs Knip on the PR branch
2. Checks out `main` and runs Knip there
3. Compares issue counts per category and posts/updates a PR comment with a diff table

This is additive — Knip runs as an informational check and does not block PRs.
2026-03-23 14:41:44 +00:00

30 lines
911 B
JSON

{
"$schema": "https://unpkg.com/knip@6/schema.json",
"workspaces": {
"packages/app": {
"entry": ["pages/**/*.{ts,tsx}", "scripts/*.js", "tests/e2e/**/*.ts"],
"project": ["src/**/*.{ts,tsx}", "pages/**/*.{ts,tsx}"],
"ignore": [".storybook/public/**"],
"ignoreDependencies": [
"eslint-config-next",
"@chromatic-com/storybook",
"@storybook/addon-themes"
]
},
"packages/api": {
"entry": ["src/index.ts", "src/tasks/index.ts", "scripts/*.ts"],
"project": ["src/**/*.ts"],
"ignoreDependencies": ["pino-pretty", "aws4"]
},
"packages/common-utils": {
"entry": ["src/**/*.ts", "!src/__tests__/**", "!src/**/*.test.*"],
"project": ["src/**/*.ts"]
}
},
"ignoreBinaries": ["make", "migrate", "playwright"],
"ignoreDependencies": [
"concurrently",
"dotenv",
"babel-plugin-react-compiler"
]
}