Skip to content

Fix/axis types #121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Jun 18, 2025
Merged

Fix/axis types #121

merged 17 commits into from
Jun 18, 2025

Conversation

gka
Copy link
Contributor

@gka gka commented Jun 18, 2025

Copy link

netlify bot commented Jun 18, 2025

Deploy Preview for svelteplot ready!

Name Link
🔨 Latest commit 28e1e9a
🔍 Latest deploy log https://app.netlify.com/projects/svelteplot/deploys/6853402df14047000832e9ab
😎 Deploy Preview https://deploy-preview-121--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.

Copy link

📦 Preview package for this PR is published!

Version: 0.3.5-pr-121.0

Install it with:

npm install svelteplot@pr-121
# or install the specific version
npm install svelteplot@0.3.5-pr-121.0

Copy link

📦 Preview package for this PR is published!

Version: 0.3.5-pr-121.1

Install it with:

npm install svelteplot@pr-121
# or install the specific version
npm install svelteplot@0.3.5-pr-121.1

Copy link

📦 Preview package for this PR is published!

Version: 0.3.5-pr-121.2

Install it with:

npm install svelteplot@pr-121
# or install the specific version
npm install svelteplot@0.3.5-pr-121.2

Copy link

📦 Preview package for this PR is published!

Version: 0.3.5-pr-121.3

Install it with:

npm install svelteplot@pr-121
# or install the specific version
npm install svelteplot@0.3.5-pr-121.3

Copy link

📦 Preview package for this PR is published!

Version: 0.3.5-pr-121.4

Install it with:

npm install svelteplot@pr-121
# or install the specific version
npm install svelteplot@0.3.5-pr-121.4

Copy link

📦 Preview package for this PR is published!

Version: 0.3.5-pr-121.5

Install it with:

npm install svelteplot@pr-121
# or install the specific version
npm install svelteplot@0.3.5-pr-121.5

Copy link

📦 Preview package for this PR is published!

Version: 0.3.5-pr-121.6

Install it with:

npm install svelteplot@pr-121
# or install the specific version
npm install svelteplot@0.3.5-pr-121.6

Copy link

📦 Preview package for this PR is published!

Version: 0.3.5-pr-121.7

Install it with:

npm install svelteplot@pr-121
# or install the specific version
npm install svelteplot@0.3.5-pr-121.7

Copy link

📦 Preview package for this PR is published!

Version: 0.3.5-pr-121.8

Install it with:

npm install svelteplot@pr-121
# or install the specific version
npm install svelteplot@0.3.5-pr-121.8

Copy link

📦 Preview package for this PR is published!

Version: 0.3.5-pr-121.9

Install it with:

npm install svelteplot@pr-121
# or install the specific version
npm install svelteplot@0.3.5-pr-121.9

@gka gka requested a review from Copilot June 18, 2025 22:55
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR standardizes TypeScript import paths, adds a utility to enforce .js extensions, and refines axis-related typings and styling.

  • Updated all $lib/types.js imports to $lib/types/index.js and added missing .js extensions for relative imports
  • Adjusted autoTimeFormat to use the PlotScale type and added explicit date casts
  • Added tickFontSize props in FacetAxes.svelte and introduced a new check-js-extensions.js script with a package.json command

Reviewed Changes

Copilot reviewed 20 out of 234 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
various src/lib/helpers/*.ts Fixed import paths from types.js to types/index.js
various src/lib/helpers/*.test.ts Added .js to relative import statements
src/lib/helpers/autoTimeFormat.ts Changed parameter type to PlotScale and added date casts
src/lib/core/FacetAxes.svelte Introduced hardcoded tickFontSize={11} for both axes
scripts/check-js-extensions.js New script to detect missing .js extensions in imports
package.json Registered check-js-extensions in NPM scripts
Comments suppressed due to low confidence (1)

scripts/check-js-extensions.js:1

  • This new script currently has no test coverage; adding unit tests for its import-path matching logic would help catch edge cases and ensure consistent behavior in CI.
#!/usr/bin/env node

const daysPer100Px =
((toNumber(x.domain[1]) - toNumber(x.domain[0])) / plotWidth / 864e5) * 100;
((toNumber(x.domain[1] as Date) - toNumber(x.domain[0] as Date)) / plotWidth / 864e5) * 100;
Copy link
Preview

Copilot AI Jun 18, 2025

Choose a reason for hiding this comment

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

Instead of using inline as Date casts on x.domain, consider parameterizing PlotScale with a Date generic (e.g., PlotScale<Date>) to avoid type assertions and improve type safety.

Copilot uses AI. Check for mistakes.

@@ -36,6 +36,7 @@
scaleType="band"
ticks={fxValues}
tickFormat={(d) => d}
tickFontSize={11}
Copy link
Preview

Copilot AI Jun 18, 2025

Choose a reason for hiding this comment

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

[nitpick] The hardcoded font size (11) is a magic number; consider making this configurable via a prop or theme token to improve flexibility and maintainability.

Suggested change
tickFontSize={11}
tickFontSize={tickFontSize}

Copilot uses AI. Check for mistakes.

@gka gka merged commit 37962e8 into main Jun 18, 2025
8 checks passed
@gka gka deleted the fix/axis-types branch June 18, 2025 22:58
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.

[BUG] <XAxis title="" /> doesn’t always work
1 participant
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy