Skip to content

chore: introduce knip dead-code detection - #242

Merged
iamfj merged 1 commit into
nextfrom
introduce-knip-dead-code
Jul 2, 2026
Merged

chore: introduce knip dead-code detection#242
iamfj merged 1 commit into
nextfrom
introduce-knip-dead-code

Conversation

@iamfj

@iamfj iamfj commented Jul 2, 2026

Copy link
Copy Markdown
Member

What does this PR do?

Introduces knip to detect unused files, exports, types, and dependencies, wires it in as a required PR check, and removes the dead code it surfaced. It adds knip.json plus knip/knip:ci scripts, a "Detect Dead Code" CI job that posts a self-updating sticky comment and fails on findings, removes dead code (extractEmbeds/EmbedInfo/stripCodeContexts and now-internal extractDocumentIdFromUrl/PageInfo/declaredVariableNames), drops the unused @graphql-codegen/introspection and @graphql-codegen/schema-ast dev deps, and documents the workflow (fixing a stale dependency table in docs/build-system.md).

Type of change

  • Bug fix
  • New feature
  • Refactor (no behavior change)
  • Documentation
  • Tests
  • Build / CI

Checklist

  • npm run check:ci passes (lint + format)
  • npx tsc --noEmit passes (type check)
  • npm test passes (unit tests)
  • New code has tests (happy path + primary error case)
  • Commit messages follow Conventional Commits

Testing

Ran npm run check:ci, npx tsc --noEmit, npm test (762 tests pass), npm run knip (exit 0, clean), and npm run generate (exit 0, no drift in src/gql/) to confirm the removed codegen plugins are genuinely unused across the build/codegen lifecycle.

Notes for reviewers

The knip job runs on PRs only (needs a PR to comment on); the other checks run on every push and PR. No new runtime code was added, so no new tests were needed. No linked issue.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

✅ knip — no dead code

No unused files, exports, types, or dependencies detected.

@iamfj
iamfj marked this pull request as ready for review July 2, 2026 11:36
Add knip to detect unused files, exports, types, and dependencies, and
remove the dead code it surfaced.

- Add knip.json (ignore generated src/gql, semantic-release plugins used
  only in .releaserc.cjs) plus knip/knip:ci npm scripts.
- Add a required "Detect Dead Code" PR job that posts a self-updating
  sticky comment and fails on findings.
- Remove dead code: extractEmbeds/EmbedInfo/stripCodeContexts from
  embed-parser, and un-export extractDocumentIdFromUrl, PageInfo, and
  declaredVariableNames (used only within their own files).
- Drop unused @graphql-codegen/introspection and schema-ast dev deps.
- Document the workflow in AGENTS.md and docs, and fix the stale
  dependency table in docs/build-system.md.
@iamfj
iamfj force-pushed the introduce-knip-dead-code branch from fdf9a0b to 43a9e1b Compare July 2, 2026 11:39
@iamfj
iamfj merged commit f617a20 into next Jul 2, 2026
10 checks passed
@iamfj
iamfj deleted the introduce-knip-dead-code branch July 2, 2026 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant