Repository navigation
ref: Remove unused exports - #3579
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Looks good to me. I checked every one of the 21 deleted exports and found no callers anywhere in the repo or in other getsentry repos. The recordAuthenticationLinked fold writes the same event and the same idempotency key as before. The check runs in about 7s without pnpm build. It fails on a new unused export and when an entry is fixed but still in the baseline. It ignores probes I added to every package exports file. pnpm lint and pnpm typecheck pass on top of current main.
Two small things:
- Clash with #3569. No git conflict, but #3569 deletes 14 exports from
packages/junior/tests/fixtures/slack/factories/events.tsthat this baseline lists. With both merged,unused-code:checkfails with 14 "no longer unused" errors. Whichever PR lands second needs a rebase that drops those entries fromscripts/unused-code-baseline.json. scripts/check-unused-code.mjs:8and:99sayknip.json, but the file isknip.jsonc. The error message sends people to a file that doesn't exist.
For a follow-up: knip treats a module as fully used when a test does await import("@/chat/x") and keeps the whole namespace. An unused export I added to chat/sentry-links.ts wasn't reported. About 67 test imports work like this. Also, the 16 entries for the re-export block in packages/junior/src/reporting.ts look like an easy group to remove.
773bfed to
06e093a
Compare
|
12 screenshot changes — 12 changed · 0 added · 0 removed Review screenshots in Frameshift |
Delete exports that nothing uses, and drop `export` from helpers that only their own file uses. Add `pnpm unused-code:check`, which runs knip and fails on an unused file or export that scripts/unused-code-baseline.json does not list. The baseline holds the existing findings and can only shrink. Co-Authored-By: Aditya Mathur <[email protected]>
Co-Authored-By: Aditya Mathur <[email protected]>
Delete core's db/schema/vector.ts (#3586 moved its column types to the plugin API) and the unused MemoryEmbeddingDimensions type, unexport MAX_SEARCHED_EVENT_CHARS, add the vitest preload hook as a knip entry, and drop isBriefsEnabled from the baseline now that main uses it. Co-Authored-By: Aditya Mathur <[email protected]>
06e093a to
b83d944
Compare
Co-Authored-By: Aditya Mathur <[email protected]>
This deletes code that nothing uses and makes helpers private when only their own file uses them.
Before: 34 exports that nothing outside their file used were still exported or kept around, for example
parseActor,buildSentryTraceUrl,recordAuthenticationUnlinkedandgetProductionConversationStore.After: 21 of them are deleted, along with the unused
db/schema/vector.ts, and the other 13 are private to their file.The reader for old
authentication_unlinkedevents stays.Possible follow-up, left out because third-party plugins use them:
isPrivateSourceandexperimental_contextin@sentry/junior-plugin-api, and the./testingsubpath exports of@sentry/junior-sentryand@sentry/junior-vercel.via @MathurAditya724.
--
View Session [Sentry]