fix: add explicit string coercions for template expressions#505
Merged
Conversation
- Cast union types to string in switch/template expressions to satisfy no-base-to-string and restrict-template-expressions oxlint rules - Cast d3-path Path context for explicit .toString() calls in trail.ts - Wrap unknown types with String() in scripts Fixes all 16 no-base-to-string and restrict-template-expressions warnings. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
✅ Deploy Preview for svelteplot ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gka
approved these changes
Mar 2, 2026
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.
Summary
no-base-to-stringand 8restrict-template-expressionsoxlint warnings (16 total)as string) orString()wrapping to template literal expressions where the type includes non-stringifiable members (e.g.MapIndexObject)contexttoPathin trail.ts for explicit.toString()callsFiles changed
src/lib/transforms/normalize.ts— castbasistostringin switch/error (4 warnings)src/lib/transforms/map.ts— castmaptostringin switch/error (4 warnings)src/lib/transforms/stack.ts— narrowresolveChannel()return forString()(1 warning)src/lib/helpers/autoScales.ts— narrow domain value forString()(1 warning)src/lib/marks/helpers/trail.ts— castcontexttoPathfor.toString()(2 warnings)src/lib/marks/helpers/waffle.ts— wraproundwithString()(1 warning)scripts/generate-api.js— wrap unknowns withString()(2 warnings)scripts/visual-regression.js— wrap unknown withString()(1 warning)Test plan
pnpm exec oxlint --type-aware— 0no-base-to-string/restrict-template-expressionswarningspnpm test— all tests passpnpm check— 0 svelte-check errors🤖 Generated with Claude Code