Skip to content

chore: fix mark property types + linting issues #63

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 42 commits into from
May 26, 2025
Merged

Conversation

gka
Copy link
Contributor

@gka gka commented May 25, 2025

This pull request introduces several updates across the codebase, including dependency upgrades, improved linting workflows, bug fixes, and enhancements to chart components. Below is a categorized summary of the most important changes:

Dependency Upgrades

  • Updated multiple dependencies in package.json, including @sveltejs/kit (to ^2.21.1), eslint (to ^9.27.0), eslint-plugin-svelte (to 3.9.0), vitest (to ^3.1.4), and svelte (to 5.33.2) for compatibility and performance improvements. [1] [2] [3] [4]

Workflow Enhancements

  • Added a new GitHub Actions workflow (.github/workflows/lint.yml) to automate lint checks on push and pull_request events targeting the main branch. This ensures code quality is maintained consistently.

Bug Fixes and Code Improvements

  • Added keyed #each blocks in multiple Svelte components (Mark.svelte, Plot.svelte, FacetGrid.svelte, and Area.svelte) to optimize rendering and avoid potential issues with dynamic lists. [1] [2] [3] [4]
  • Fixed minor syntax issues and improved code readability in helper functions, such as resolveProp, resolve, and resolveStyles, by restructuring conditional logic and adding null-safe operations. [1] [2] [3] [4]

Chart Component Enhancements

  • Refactored Area.svelte to enhance its API by consolidating properties into AreaMarkProps and adding support for titles within <path> elements. This improves the usability and accessibility of area charts. [1] [2] [3] [4] [5]
  • Introduced documentation comments for AreaX.svelte and AreaY.svelte components to provide better clarity on their purposes and usage. These components create horizontal and vertical area charts, respectively. [1] [2]

Miscellaneous Improvements

  • Consolidated type imports in helper files (index.ts, reduce.ts) to improve code organization and maintainability. [1] [2]
  • Added missing semicolons and removed redundant blank lines in helper files for consistency and adherence to coding standards. [1] [2]

These changes collectively improve the functionality, maintainability, and performance of the codebase while ensuring adherence to modern development practices.

Copy link

netlify bot commented May 25, 2025

Deploy Preview for svelteplot ready!

Name Link
🔨 Latest commit a545e47
🔍 Latest deploy log https://app.netlify.com/projects/svelteplot/deploys/6834971e4081750008012b68
😎 Deploy Preview https://deploy-preview-63--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.

@gka gka marked this pull request as draft May 25, 2025 22:32
@gka gka self-assigned this May 25, 2025
@gka gka requested a review from Copilot May 25, 2025 22:38
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 fixes mark property type definitions and addresses various linting issues across the codebase.

  • Updated mark type definitions and refactored variable declarations in several Svelte components.
  • Added keyed each loops and improved import consistency for linting and performance.
  • Updated dependency versions and added a new linting workflow.

Reviewed Changes

Copilot reviewed 93 out of 93 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/lib/marks/AxisX.svelte Refactored mark property types and variable declarations using const and type casts.
src/lib/marks/Arrow.svelte Reorganized scripts, updated type annotations, and added keyed each loops.
src/lib/marks/AreaY.svelte Simplified type definitions using Omit for clarity.
src/lib/marks/AreaX.svelte Adjusted type usage by omitting unused properties.
src/lib/marks/Area.svelte Updated type annotations and added keyed each loops in templating.
src/lib/helpers/typeChecks.ts Applied minor formatting improvements.
src/lib/helpers/scales.ts Reformatted conditional logic for clarity.
src/lib/helpers/resolve.ts Improved optional chaining and introduced a debug logging block.
src/lib/helpers/reduce.ts Optimized and consolidated import statements.
src/lib/helpers/index.ts Optimized import statements for consistency.
src/lib/helpers/autoScales.ts Fixed missing semicolon for better style conformity.
src/lib/core/Plot.svelte, FacetGrid.svelte, Mark.svelte Added keyed each loops to improve list rendering stability.
package.json Updated dependency versions and scripts.
.github/workflows/lint.yml Added a new linting workflow to support CI.
.github/ISSUE_TEMPLATE/feature_request.md Made minimal formatting adjustments.

@gka gka force-pushed the chore/ts-markprops branch from 6868805 to 10f1877 Compare May 26, 2025 16:09
@gka gka marked this pull request as ready for review May 26, 2025 16:27
@gka gka requested a review from Copilot May 26, 2025 16:28
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 chore updates mark property typings, resolves lint errors, and bumps various dependencies.

  • Refactored Svelte mark components to use module scripts for type exports and cleaned up props.
  • Added key directives to all {#each} loops and applied optional chaining/null-safety fixes in helpers.
  • Updated imports to single-line style, bumped dependencies, and introduced a GitHub Actions lint workflow.

Reviewed Changes

Copilot reviewed 100 out of 100 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/lib/marks/Arrow.svelte Split module vs. instance scripts and updated ArrowMarkProps definition.
src/lib/marks/Area.svelte Consolidated AreaMarkProps, added title rendering, removed unused facet logic.
src/lib/helpers/resolve.ts Added optional chaining and expanded conditional formatting.
config/sidebar.ts Reordered sidebar entries for "Vector".
.github/workflows/lint.yml Added a linting workflow on push and PRs.
Comments suppressed due to low confidence (4)

src/lib/marks/Arrow.svelte:36

  • The ArrowMarkProps type no longer includes a children?: Snippet field, but the component still references children. Consider adding children?: Snippet back to the type to keep the API consistent.
};

src/lib/marks/Area.svelte:117

  • You’ve introduced conditional rendering of <title> based on options.title, but there’s no test covering this behavior. Consider adding a unit test to verify the <title> appears when title is provided.
{@const title = resolveProp(options.title, datum.datum, '')}

src/lib/marks/Arrow.svelte:84

  • [nitpick] Using the array index as the Svelte key can cause rendering issues when items are reordered. If possible, use a stable identifier from each data item instead of i.
{#each scaledData as d, i (i)}

config/sidebar.ts:74

  • [nitpick] The sidebar order now places 'Vector' after 'Tick', breaking the previous ordering. Consider reordering entries alphabetically or grouping consistently to keep the navigation predictable.
{ title: 'Vector', to: '/marks/vector' }

@gka gka merged commit 5ebbd68 into main May 26, 2025
6 checks passed
@gka gka deleted the chore/ts-markprops branch May 26, 2025 16:31
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.

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