chore: delete the code nothing reaches, and narrow the exports nothing imports - #506
Merged
Conversation
…g imports Four functions in MarkdownViewer.svelte have no caller. Three of them are stale copies of render steps that moved elsewhere and kept evolving there: processTaskItems and processBlockIds moved into markdown.ts in 09fa88f, and the ==highlight== rewrite moved into the Rust renderer, where it later grew code-span protection (#228, #371). Each migration re-pointed the call site and left the old body behind, so the copies have been sitting there since b46a283 looking like reusable helpers. getSplitTransition is plain dead. Also removed: 24 exports nothing outside their own file imports, the escapeHtmlText alias that only forwards to escapeHtml, an addFrontMatterList- Item wrapper with no production caller, the toPlainRecord guard that isFrontMatterMapping already makes unreachable, and FrontMatterField's editableValue, which computes the same string as displayValue in every branch with nothing to keep the two from drifting apart. No behaviour change. The front matter tag test now calls the plural helper. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Same sweep as the previous commit, finished in scripts/. Twenty-two names in keymapHarness.ts, renderProtocolDom.ts, renderProtocolFixtures.ts, windowTagEditor.ts and scrollSyncBlockMapping.test.ts are only used inside their own file, so the export widened the contract for nothing. RenderFixtureName had no use anywhere, including its own file, and is gone. tsconfig.json puts scripts/ inside `npm run check`, so a name another file still imports would fail the type check rather than pass silently. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this is
Deletions only, no behaviour change: four functions in
MarkdownViewer.sveltethat nothing calls, 24 exports nothing outside their own file imports, one alias that only forwards, one wrapper with no production caller, and oneFrontMatterFieldproperty that is a duplicate of the property beside it. Net -162 lines, no dependency change.Three of the four dead functions are what makes this worth a PR rather than a tidy-up — they are stale copies of render steps that still run somewhere else:
MarkdownViewer.svelteprocessTaskItemssrc/lib/utils/markdown.ts:368data-task-checkboxguard, paragraph re-parenting, whitespace-node handling, theinputIdx === -1guardprocessBlockIdssrc/lib/utils/markdown.ts:252processHighlightssrc-tauri/src/lib.rs:967text.replace(/==([^=\n]+)==/g, …)getSplitTransitionis simply unreachable.Mechanism
b46a283(2026-03-20) added the threeprocess*steps toMarkdownViewer.svelte.09fa88f(2026-03-27) moved the two DOM ones intomarkdown.ts, and the==highlight==rewrite moved into the Rust renderer. Each migration re-pointed the call site and left the old function body in place.Nothing was ever going to complain. A module-level function in a
.svelte<script>that nobody calls is legal TypeScript;svelte-checkreports it as neither error nor warning, andcargo'sdead_codelint doesn't reach across the language boundary. So the copies have sat there since March looking like helpers.That is also the gap in
scripts/singleImplementationConvention.test.ts: its rules ask whether a marker appears in more than one allowed file, which an unreachable second copy passes. The bug class that suite describes — "it looks like a reusable shared helper, so the next person to reuse or sync it silently reverts a merged fix" — is live here. ReusingprocessTaskItemsfromMarkdownViewer.sveltewould reintroduce the pre-data-task-checkboxbehaviour.The rest is smaller.
editableValueis worth one line: it computes the identical string asdisplayValuein every branch (the array branch is the same expression spelled twice), and nothing type-checks that they stay equal, so it is a copy waiting to drift. The one consumer now readsdisplayValue.Scope
Found and deliberately left alone:
processTaskItemsandprocessBlockIdsare private inmarkdown.ts, and that suite states a marker "must never be a private identifier". The one that could be pinned by defect shape is the highlight rewrite —marker: /replace\([^)]*<mark>/gwithallowed: [], matching the three existing empty-allowedrules. Say the word and I'll add it here so cleanup and gate land together.$staterecords inMarkdownViewer.svelte(x = { ...x, [k]: v }, and copy-then-delete). Svelte 5's$stateproxy already makes plain mutation reactive, so these are Svelte-4-era habit, but no test covers that component's front-matter tag editor and neithersvelte-checknor the suite verifies reactivity. Not a change to make blind.Settings.svelteand thetoggleX()methods behind them. The methods are not boilerplate: most have 2–3 call sites and several map a boolean onto'on'/'off'or run real logic (toggleZenModeis 29 lines). Deleting them would copy that logic outward, not remove it.eni18n keys with no static reference. The native macOS menu is built in Rust andtitlebarToolbar.tsresolves keys indirectly throughlabelKey, so a static scan can't separate genuinely dead keys from indirectly referenced ones. Acting on it would be a ~2400-line diff across 26 locales on a guess; it needs runtime evidence first.Tests
None added, and the honest reason is that no test applies. Every deletion here is either unreachable code or a name nothing imports, so there is no behaviour to pin — a test written for any of it would pass identically with and without the change. The falsification check the template asks for degenerates for the same reason: putting the four functions back leaves the suite green, which is exactly the claim.
scripts/frontMatter.test.tschanged for a different reason:addFrontMatterListItemhad no production caller, only that test, so the three assertions now calladdFrontMatterListItemswith a one-element array. Same inputs, same expectations.What actually verifies this change is the reachability evidence, not a test: every deleted symbol has zero references across
src/andscripts/(the four functions have exactly one occurrence each — their own definition), checked over.ts,.svelteand the Svelte markup, andsvelte-checkcompiles the tree afterwards.Verification
Not verified: I did not run this on Windows or Linux, and I did not launch the app. The deletions contain no platform branch (
#[cfg],osType, or otherwise) and no deleted symbol has a caller, so there is no runtime path left to exercise — but that reasoning is what I'm offering, not an observation.