docs: clarify valid types for axis tick prop#7191
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
WalkthroughAdded a JSDoc Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
omnidoc/generateApiDoc.ts (1)
99-106: Cover the new 6-variant cutoff with boundary tests.Line 100 changes a behavior boundary, but there’s no explicit spec for unions of exactly 5 and 6 variants. Please add boundary tests so this cutoff is locked and future refactors don’t silently revert it.
Proposed test additions
diff --git a/omnidoc/processType.spec.ts b/omnidoc/processType.spec.ts @@ describe('processType', () => { + it('should inline unions with 5 variants', () => { + const input = ['"a"', '"b"', '"c"', '"d"', '"e"']; + expect(processType(input, false)).toBe('"a" | "b" | "c" | "d" | "e"'); + }); + + it('should inline unions with 6 variants', () => { + const input = ['"a"', '"b"', '"c"', '"d"', '"e"', '"f"']; + expect(processType(input, false)).toBe('"a" | "b" | "c" | "d" | "e" | "f"'); + }); + + it('should collapse unions with 7 variants', () => { + const input = ['"a"', '"b"', '"c"', '"d"', '"e"', '"f"', '"g"']; + expect(processType(input, false)).toBe('(union of 7 variants)'); + }); + it('should handle simple unions', () => { expect(processType(['string', 'number'], false)).toBe('number | string'); });🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@omnidoc/generateApiDoc.ts` around lines 99 - 106, Add unit tests that assert the union-formatting behavior at the new 6-variant boundary: create tests that feed the logic (the code using isInline and uniqueParts in generateApiDoc.ts) with exactly 5 and exactly 6 distinct union variants and verify the output is the alphabetically sorted "A | B | C ..." string (i.e., joined with ' | '), and also include a test with 7 variants to assert the alternative path (not joined) still applies; locate the union formatting logic by the symbols isInline and uniqueParts in generateApiDoc.ts and add these cases to the existing test suite so the 5/6/7 variant behavior is locked.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@omnidoc/generateApiDoc.ts`:
- Around line 99-106: Add unit tests that assert the union-formatting behavior
at the new 6-variant boundary: create tests that feed the logic (the code using
isInline and uniqueParts in generateApiDoc.ts) with exactly 5 and exactly 6
distinct union variants and verify the output is the alphabetically sorted "A |
B | C ..." string (i.e., joined with ' | '), and also include a test with 7
variants to assert the alternative path (not joined) still applies; locate the
union formatting logic by the symbols isInline and uniqueParts in
generateApiDoc.ts and add these cases to the existing test suite so the 5/6/7
variant behavior is locked.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c35a39cc-f922-440d-8239-9e132f8dd68a
📒 Files selected for processing (1)
omnidoc/generateApiDoc.ts
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7191 +/- ##
=======================================
Coverage 89.06% 89.06%
=======================================
Files 539 539
Lines 41011 41011
Branches 5553 5553
=======================================
Hits 36527 36527
Misses 4476 4476
Partials 8 8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
PavelVanecek
left a comment
There was a problem hiding this comment.
You could also add @inline annotation on the type and that would expand it.
Bundle ReportChanges will increase total bundle size by 80 bytes (0.0%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: recharts/bundle-treeshaking-cartesianAssets Changed:
view changes for bundle: recharts/bundle-treeshaking-polarAssets Changed:
view changes for bundle: recharts/bundle-cjsAssets Changed:
view changes for bundle: recharts/bundle-es6Assets Changed:
|
Fixes recharts#2940 by adding the @inline JSDoc tag to TickProp. This ensures the omnidoc generator explicitly lists out the supported types (Function, ReactNode, etc.) for the tick prop instead of obscuring them behind a generic '(union of 5 variants)'.
72ed283 to
741893a
Compare
Fixes #2940 by increasing the threshold for rendering generic
(union of N variants)strings in the API doc generation plugin. This explicitly lists outtickandlabel's proper render types includingFunctionandReactElementinstead of(union of 5 variants).Summary by CodeRabbit