{ "$schema": "https://unpkg.com/knip@6/schema.json", "ignoreExportsUsedInFile": { "interface": true, "type": true, }, "workspaces": { ".": { "project": ["*.{ts,mts,mjs}"], "ignoreDependencies": [ // Knip does not parse scripts in actions/github-script "dotenv", // keeping it a dev dependency speeds up 'npx only-allow pnpm' in package.json's preinstall script "only-allow", // Pins @babel/core 7 so Stryker's @babel/core 8 does not win the Sanity CLI's @rolldown/plugin-babel peer "@babel/core", ], "ignoreBinaries": [ // No root packages provide these binaries "npm-check-updates", "sanity-test", "sanity-tsdoc", // Knip doesn't understand `cd perf/studio && pnpm preview` "preview", // `pnpm dist-tag` invocations in tag-latest.yml / tag-stable.yml "dist-tag", // `pnpm deprecate` / `pnpm undeprecate` invocations in deprecate-version.yml "deprecate", "undeprecate", // Installed system-wide via brew/uv/pipx, not npm "zizmor", ], }, // e2e is scanned so its heavy use of `@playwright/test` (catalog) is seen as // used. The playwright plugin is disabled because the config reads required // SANITY_E2E_* env vars at load time. Treat every file as an entry so the // workspace's pre-existing unused files/exports (out of scope for this work) // aren't reported, while dependency usage still is. "e2e": { "entry": ["**/*.{ts,tsx}"], "project": ["**/*.{ts,tsx}"], "playwright": false, "ignoreDependencies": [ // CLI for local uploads (`pnpm --filter e2e exec chromatic --playwright`, see // .agents/skills/sanity-visual-regression/REFERENCE.md); CI uploads through // chromaui/action, which bundles its own copy. Neither use is traceable by knip. "chromatic", ], }, // Studios that set `reactCompiler` in sanity.cli.ts need oxc-transform-react // in their dependencies: `sanity dev` / `sanity build` resolve the plugin by // name at runtime, which knip can't trace. Every such studio below carries its // own `ignoreDependencies: ["oxc-transform-react"]` for that reason. "dev/auth-test-studio": { "ignoreDependencies": ["oxc-transform-react"], }, "dev/design-studio": { "ignoreDependencies": ["oxc-transform-react"], }, // Same situation as the e2e workspace: the playwright plugin is disabled because // playwright.config.ts throws on missing SANITY_E2E_* env vars at load time (when CI // is set). Treat every file as an entry so dependency usage is still traced. "dev/e2e-embedded-studio-vite": { "entry": ["**/*.{ts,tsx}"], "project": ["**/*.{ts,tsx}"], "playwright": false, }, // Several of the dev/perf app workspaces below carry pre-existing unused files/exports // (example and debug code, out of scope for dependency checking). Those workspaces, // like the e2e workspace, treat every file as an entry so the full `pnpm knip` run // doesn't report them, while dependency usage is still traced. "dev/media-library-aspects-studio": { "entry": ["**/*.{ts,tsx}"], "project": ["**/*.{ts,tsx}"], }, "dev/page-building-studio": { "ignoreDependencies": ["oxc-transform-react"], }, "dev/radar": { "entry": ["**/*.{ts,tsx}"], "project": ["**/*.{ts,tsx}"], "ignoreDependencies": ["oxc-transform-react"], }, "dev/sdk-app": { // Knip's sanity plugin doesn't know about `app.entry` in sanity.cli.ts "entry": ["src/App.tsx"], }, "dev/starter-studio": { "ignoreDependencies": ["oxc-transform-react"], }, "dev/storybook": { "ignoreDependencies": [ // Referenced as a string in `resolve.dedupe` in .storybook/main.ts, which knip // can't trace "sanity", ], }, "dev/studio-e2e-testing": { "entry": ["**/*.{ts,tsx}"], "project": ["**/*.{ts,tsx}"], "ignoreDependencies": ["oxc-transform-react"], }, "dev/test-create-integration-studio": { "entry": ["**/*.{ts,tsx}"], "project": ["**/*.{ts,tsx}"], }, "dev/test-studio": { // Also covers migrations/**, which `sanity migration run` loads without imports "entry": ["**/*.{js,ts,tsx}"], "project": ["**/*.{js,ts,tsx}"], "ignoreDependencies": ["oxc-transform-react"], }, "perf/bench": { "entry": ["**/*.{ts,tsx}"], "project": ["**/*.{ts,tsx}"], }, "perf/studio": { "ignoreDependencies": ["oxc-transform-react"], }, "perf/tests": { "entry": ["**/*.{ts,tsx}"], "project": ["**/*.{ts,tsx}"], "ignoreBinaries": [ // Knip doesn't understand `cd perf/studio && ... pnpm dev` in the studio:dev script "dev", ], }, "packages/sanity": { "entry": ["src/_exports/*.ts", "bin/sanity", "mock-browser-env-stub-loader.mjs"], "project": [ "src/**/*.{ts,tsx}", "!src/**/__test{,s}__", // These files might actually be safe to delete? ], "ignoreIssues": { // The deprecated unstable_useValuePreview is an intentional compatibility alias. "src/core/preview/useValuePreview.ts": ["duplicates"], }, "ignoreBinaries": ["tzutil"], "ignoreDependencies": [ // CLI for local uploads (`pnpm --filter sanity exec chromatic --vitest`, see // .agents/skills/sanity-visual-regression/REFERENCE.md); CI uploads through // chromaui/action, which bundles its own copy. Neither use is traceable by knip. "chromatic", // Optional peer of @sanity/tsdown-config that its `panda` option (tsdown.config.ts) // loads with a dynamic import inside node_modules, which knip can't trace "@sanity/pandacss-tsdown-plugin", ], }, "packages/@repo/debug-proxy": { "project": ["src/**/*.ts"], "ignoreBinaries": ["mkcert"], }, "packages/@sanity/schema": { "entry": [ "src/_exports/*.ts", // Knip can't trace `import * as types from './types'` in Schema.ts "src/legacy/types/index.ts", ], "project": ["src/**/*.ts"], }, "packages/@sanity/mutator": { "project": ["src/**/*.ts"], }, "packages/@sanity/types": { "project": ["src/**/*.ts"], }, "packages/@sanity/diff": { "project": ["src/**/*.ts"], }, "packages/@sanity/vision": { "project": ["src/**/*.{ts,tsx}"], }, "packages/@sanity/util": { "entry": ["src/_exports/*.ts"], "project": ["src/**/*.ts"], }, "packages/groq": { "project": ["*.js", "*.cjs"], }, "packages/@repo/bundle-manager": { "project": ["src/**/*.ts"], }, "packages/@repo/ailf": { "entry": [".ailf/ailf.config.ts", ".ailf/tasks/*.reference.ts"], "project": [".ailf/**/*.ts"], "ignoreFiles": [".ailf/tasks/*.task.ts"], }, "packages/@repo/release-notes": { "project": ["src/**/*.ts"], }, "packages/@repo/stable-suggestion": { "entry": ["bin/*.ts"], "project": ["src/**/*.ts", "bin/*.ts"], }, "packages/@repo/test-exports": { // Plain `node --test` suite; the test files are the entry points "entry": ["test/**/*.{mjs,cjs}"], "ignoreDependencies": [ // The suite enumerates its own package.json `dependencies` at runtime and // dynamically imports every export of each (test/exports.cjs), so everything // listed there is used by definition — knip can't trace the dynamic requires "@sanity/*", "groq", ], }, "packages/@repo/utils": { "project": ["src/**/*.ts"], }, "examples/studios/movies-studio": { "ignoreFiles": ["resolveProductionUrl.ts"], }, "engine-confidence": { "entry": ["scripts/*.ts", "stryker/*.{mjs,mts,ts}"], "project": ["**/*.{ts,mts,mjs}"], }, "packages/@repo/oxlint-plugin-i18n": { // test/fixtures holds locale resource files the rule tests read from disk, not imports "project": ["src/**/*.mjs", "test/*.mjs"], }, "scripts": { "entry": [ // Seems genuinely unused, but important? "updateLicenses.ts", // Hard to find "listPublishedPackages.ts", "symlinkDependencies.ts", ], }, }, }