Skip to content

refactor: reject unused TypeScript code - #26

Closed
mikeascendx wants to merge 1 commit into
lauurnce:mainfrom
mikeascendx:refactor/enforce-unused-checks
Closed

mikeascendx wants to merge 1 commit into
lauurnce:mainfrom
mikeascendx:refactor/enforce-unused-checks

Conversation

@mikeascendx

Copy link
Copy Markdown
Contributor

Summary

  • enable TypeScript checks for unused locals and parameters
  • remove dead test scaffolding surfaced by the stricter check
  • mark framework-required route parameters as intentionally unused

Checks

  • npm run typecheck -- --incremental false
  • npm run lint
  • npx vitest run app/api/admin/feedback/route.test.ts app/api/subscribe/route.test.ts lib/deleteAccount.test.ts app/api/class/[code]/rep/route.test.ts app/api/class/[code]/request/status/route.test.ts --reporter=dot (61 tests)
  • git diff --check

Coordination

app/api/subscribe/route.test.ts is also present in open PRs #14 and #22. This PR changes only unused mock parameters near the Supabase test double; their patches touch separate hunks.

@vercel

vercel Bot commented Aug 23, 2026

Copy link
Copy Markdown

@lauurnce is attempting to deploy a commit to the lauurnce's projects Team on Vercel.

A member of the Team first needs to authorize it.

@lauurnce

Copy link
Copy Markdown
Owner

Rebased onto main (92d6249, parent 3b833f9) and re-validated under Next 16.3.2 / eslint-config-next@16 flat config. Verdict: READY — the new toolchain does NOT already enforce this, so the PR is not redundant.

Toolchain-overlap analysis (empirical, scratch-probe tested):

  • Flat config next/typescript only emits a warning for @typescript-eslint/no-unused-vars (exit 0 — does not fail npm run lint), and with the default args: after-used it misses leading unused params entirely: a route-handler-style GET(req, { params }) probe was not flagged at all. The PR's _request renames are enforced by nothing on main today.
  • Test files are globally ignored by lint (**/*.test.ts(x) in eslint.config.mjs), so the PR's test-file cleanups and any future dead code in tests are only catchable via the added noUnusedLocals/noUnusedParameters.
  • tsconfig normalization (jsx: react-jsx) landed independently; no functional overlap with this PR.

Rebase conflicts:

  • tsconfig.json: content conflict vs the jsx normalization — resolved keeping both intents.
  • Semantic (git auto-merged silently): main's new coupon release-path mock in app/api/subscribe/route.test.ts captures value inside the update-.eq() closure, which this PR had stripped as unused. Auto-merge produced TS2552: Cannot find name 'value'. Resolved by restoring (column: string, value: string) on that one signature — the param is used again post-rebase, so removing it would contradict the PR's own intent. All other removals verified still-unused.

Gates (exact):

  • npx tsc --noEmit → exit 0, zero violations with both new flags active repo-wide
  • npx vitest run → 116 files, 1462/1462 passed (7.91s)
  • npm run lint (eslint app components lib) → exit 0, 0 warnings/errors
  • npm run build (Next 16.3.2 Turbopack) → compiled successfully, 37 static pages

Note: build initially failed in this worktree because Turbopack rejects a symlinked node_modules ("points out of the filesystem root"); replaced with a real install (no lockfile changes). Not pushed, not merged — branch pr-26-rebased locally.

@lauurnce

Copy link
Copy Markdown
Owner

Landed in main via 80639b6 — rebased onto current main and re-validated under Next 16.3.2 as part of today's merge queue (full gates green: tsc / vitest / lint / build). Thanks @mikeascendx for the contribution — authorship preserved in the rebased commit.

@lauurnce lauurnce closed this Aug 25, 2026
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.

2 participants