chore(types): resolve all svelte-check errors and enforce svelte-check in CI#1243
Conversation
…k in CI
Makes `bunx svelte-check` clean (was 40 errors across 17 files) with type-only,
behavior-preserving changes, then adds it as a CI gate.
- dnd drag handles: retype `startDrag` from the wrong `(e: CustomEvent<DndEvent>)`
to `(e: MouseEvent | TouchEvent)` (it is bound to on:mousedown/on:touchstart) in
the 7 command components + CommandList; drop the now-unused DndEvent imports.
- Command subclasses: add `declare` to inherited name/id/type fields (TS2612;
emission-free under the ES2020 target, and prevents field-clobbering if the
target is ever raised).
- CommandList: narrow ICommand -> specific command types via <script> cast helpers
passed one-way (`command={asWait(command)}`); children report edits via
on:updateCommand events, so this is behavior-preserving. Use ConstructorParameters
for the UserScriptSettingsModal settings arg.
- choiceList: break the ChoiceList <-> MultiChoiceListItem recursive type cycle
with `as any` cross-imports; import ChoiceType from its canonical source; add a
typed reorder handler; drop the dead `type="main"` prop.
- choiceSuggester: initialize choiceExecutor in the constructor body (after super)
instead of as a field initializer, so `plugin` is defined (TS2729).
- GlobalVariables: drop a dead `id` field never present on the GV type.
- Add a `check` script (svelte-check) and run it in the CI Build + Lint job.
No Svelte version or bundling change. Verified: svelte-check 0/0, build-with-lint
clean, 1126 tests pass, plus a dev-vault smoke test (plugin reload, choice
suggester, settings render) with no runtime errors.
Closes #1241
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThis PR introduces Svelte type-checking and refactors command/choice component architecture. It adds ChangesType-checking and component refactoring for Svelte
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Resolves the 40 svelte-check errors (17 files) and wires svelte-check into CI. Every fix is type-only / behavior-preserving — no Svelte version or bundling change (we share the Obsidian runtime with other plugins).
Fixes by category
startDragwas mis-typed(e: CustomEvent<DndEvent>)but is bound toon:mousedown/on:touchstart; retyped to(e: MouseEvent | TouchEvent)in the 7 command components +CommandList(kept the parent'sDndEventimport — still used by consider/finalize; dropped the unused child imports).declareon inheritedname/id/type(TS2612; emission-free under ES2020, and prevents field-clobbering if the target is ever raised).ICommand→ specific types via<script>cast helpers passed one-way (command={asWait(command)}); children report edits viaon:updateCommandevents (verified none reassigncommand), so behavior is unchanged.ConstructorParameters<...>for the settings-modal arg.ChoiceList ↔ MultiChoiceListItemrecursive type cycle withas anycross-imports; importedChoiceTypefrom its canonical source; typed reorder handler; removed the deadtype="main"prop.choiceExecutorin the constructor body (aftersuper()) sopluginis defined (TS2729).idfield never present onGV(confirmed unused;{#each}is index-based).CI
Adds a
checkscript (svelte-check --threshold error) and runs it in the Build + Lint job, so Svelte component type regressions are caught going forward.Verification
build-with-lintclean; 1126 tests pass.choiceSuggesterinit reorder) opens with no errors; settings render with no errors.Summary by CodeRabbit
New Features
checkscript.Bug Fixes
Refactor