Skip to content

fix: resolve remaining oxlint warnings#506

Merged
gka merged 3 commits into
mainfrom
fix/oxlint-remaining
Mar 4, 2026
Merged

fix: resolve remaining oxlint warnings#506
gka merged 3 commits into
mainfrom
fix/oxlint-remaining

Conversation

@ljodea

@ljodea ljodea commented Feb 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes the final 11 oxlint warnings across 6 rules:

  • unbound-method (3): Keep Intl.DateTimeFormat instance instead of detaching .format method
  • require-array-sort-compare (2): Add explicit comparators to .toSorted() / .sort()
  • no-unsafe-optional-chaining (2): Add ?? [] fallback before spreading optional chain results
  • no-useless-fallback-in-spread (2): Add oxlint-disable comments where TypeScript requires ?? {} for Map.get()
  • no-unused-vars (1): Prefix unused formatIntervals with _
  • no-self-assign (1): Use spread assignment instead of push() + self-assign for Svelte reactivity

Files changed

  • src/lib/helpers/autoTimeFormat.ts
  • src/lib/helpers/scales.ts
  • src/lib/helpers/time.ts
  • src/lib/core/Plot.svelte
  • src/theme/components/TabPanel.svelte
  • src/routes/examples/vector/shift-map.svelte
  • src/routes/examples/vector/spike-map.svelte
  • scripts/visual-regression.js

Test plan

  • pnpm exec oxlint --type-aware — 0 warnings for these 6 rules
  • pnpm test — all tests pass
  • pnpm check — 0 svelte-check errors

🤖 Generated with Claude Code

- unbound-method: keep Intl.DateTimeFormat instance instead of detaching
  .format method (autoTimeFormat.ts)
- require-array-sort-compare: add explicit comparators (scales.ts,
  visual-regression.js)
- no-unused-vars: prefix unused formatIntervals with _ (time.ts)
- no-unsafe-optional-chaining: add nullish fallbacks for spread (Plot.svelte)
- no-useless-fallback-in-spread: add oxlint-disable comments where TS
  requires ?? {} for Map.get() (shift-map.svelte, spike-map.svelte)
- no-self-assign: use spread assignment instead of push + self-assign
  for Svelte reactivity (TabPanel.svelte)

Fixes the final 11 oxlint warnings.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@netlify

netlify Bot commented Feb 27, 2026

Copy link
Copy Markdown

Deploy Preview for svelteplot ready!

Name Link
🔨 Latest commit cb46866
🔍 Latest deploy log https://app.netlify.com/projects/svelteplot/deploys/69a698d29378fc00080e4f61
😎 Deploy Preview https://deploy-preview-506--svelteplot.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

...feat,
properties: {
...feat.properties,
// oxlint-disable-next-line unicorn/no-useless-fallback-in-spread -- TS requires ?? {} for Map.get()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are a bit unfortunate as they complicate the examples code which is meant to help new users understand how SveltePlot works.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to add a poor-mans TS removal step for the same reason, perhaps we can extend it to remove these linter comments?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Will add this!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is where it would fit, for instance

// remove data type imports for now
.filter((line) => !line.trim().startsWith('import type'))
// remove props since we're importing data
.filter((line) => !line.trim().includes('$props'))
// replace shared/ui imports
.map((line) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add the filter in a subsequent PR

@gka gka merged commit 109b098 into main Mar 4, 2026
9 checks passed
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