Improve types - #98
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
📝 WalkthroughWalkthroughTypes now require line metadata (LineWithMetadata). Composables, stores, utils, RidgelinePlot.vue, and tests are updated to use the new type and to index metadata directly (removing optional chaining and non-null assertions). ChangesStricter Line Metadata Typing
Estimated code review effort 🎯 3 (Moderate) | ⏱️ ~20 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #98 +/- ##
==========================================
- Coverage 98.43% 98.32% -0.11%
==========================================
Files 38 39 +1
Lines 896 897 +1
Branches 256 256
==========================================
Hits 882 882
- Misses 9 10 +1
Partials 5 5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
51c59c5 to
f683e81
Compare
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/components/RidgelinePlot.vue`:
- Around line 117-123: The mean calculation in getMeanOfMeansForPlotRow
currently uses a non-null assertion on dataStore.getSummaryDataRow which can be
undefined; update getMeanOfMeansForPlotRow to call
dataStore.getSummaryDataRow(metadata) defensively: map each relevantRidgeLines
entry to its summary row, filter out undefined results, and then compute the
mean from the remaining SummaryTableColumn.MEAN values; if all lookups are
undefined, return a safe sentinel (e.g. NaN) or throw/log a clear warning about
the inconsistency so sorting callers know the row had no matching summary data.
Ensure you reference getMeanOfMeansForPlotRow, relevantRidgeLines,
dataStore.getSummaryDataRow, and SummaryTableColumn.MEAN when locating and
changing the logic.
In `@src/stores/colorStore.ts`:
- Around line 86-90: setColors currently types its parameter as
LineWithMetadata[] but only reads the metadata property; change the signature to
accept the minimal shape (either Array<Pick<LineWithMetadata, "metadata">> or
LineMetadata[]) so callers that pass { metadata } wrappers (as in tests) match
the API. Update the setColors function signature and any related usage/type
imports (referencing setColors, LineWithMetadata, and LineMetadata) to use the
narrower type, and run/adjust affected tests to ensure typing and behavior
remain correct.
In `@tests/unit/composables/usePlotTooltips.spec.ts`:
- Around line 10-11: Change the runtime import of PointWithMetadata to a
type-only import so it doesn't emit a module import at runtime: replace the
current import of PointWithMetadata from "types" with an `import type {
PointWithMetadata } from "types";` (matching other `import type` usage and
avoiding issues with verbatimModuleSyntax: true) and ensure only type
annotations reference PointWithMetadata (no runtime usage).
🪄 Autofix (Beta)
✅ Autofix completed
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: c5fae0f1-cd92-499b-a6ee-8b2ea916a910
📒 Files selected for processing (8)
src/components/RidgelinePlot.vuesrc/composables/useHistogramLines.tssrc/composables/usePlotTooltips.tssrc/stores/colorStore.tssrc/stores/dataStore.tssrc/types.tssrc/utils/plotConfiguration.tstests/unit/composables/usePlotTooltips.spec.ts
|
Note Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it. Fixes Applied SuccessfullyFixed 2 file(s) based on 1 unresolved review comment. Files modified:
Commit: The changes have been pushed to the Time taken: |
Fixed 2 file(s) based on 1 unresolved review comment. Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
This avoids the need for lots of
line.metadata?.[Axis.ROW], which can now beline.metadata[Axis.ROWRemoved type PointWithMetadata as it was only used in a single place