Conversation
WalkthroughAdds context-aware API doc generation by building a context map from JSDoc Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25–35 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ 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.
Actionable comments posted: 2
🧹 Nitpick comments (3)
www/src/docs/api/index.ts (1)
53-53: Consider removing the file extension from the import.The
.tsxextension is explicitly included in this import, while all other imports in this file omit extensions. This inconsistency could be intentional based on module resolution requirements, but if not, consider removing it for consistency.-import { LabelAPI } from './LabelAPI.tsx'; +import { LabelAPI } from './LabelAPI';omnidoc/readProject.ts (2)
42-53: Consider extracting the shared filtering logic.This filter-and-trim pattern is repeated in
getExamplesOf(lines 614-617, 626-629). Could extract to a helper, but not blocking.-export function getAllTagTexts(jsDoc: JSDocMeta | undefined, tagName: string): ReadonlyArray<string> { - if (jsDoc == null) { - return []; - } - const results: string[] = []; - for (const [name, text] of jsDoc.tags) { - if (name === tagName && text !== undefined && text.trim() !== '') { - results.push(text.trim()); - } - } - return results; -} +function getTagsFromMeta( + tags: ReadonlyArray<[string, string | undefined]>, + tagName: string, +): ReadonlyArray<string> { + return tags + .filter(([name, text]) => name === tagName && text !== undefined && text.trim() !== '') + .map(([, text]) => (text as string).trim()); +} + +export function getAllTagTexts(jsDoc: JSDocMeta | undefined, tagName: string): ReadonlyArray<string> { + if (jsDoc == null) { + return []; + } + return getTagsFromMeta(jsDoc.tags, tagName); +}
601-639: No deduplication of examples.If the same
@exampletext appears in multiple declarations, it will be returned multiple times. If duplicates are expected to be rare, this is fine; otherwise, consider deduplicating before returning.- return examples; + return [...new Set(examples)];
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (26)
omnidoc/generateApiDoc.ts(7 hunks)omnidoc/readProject.spec.ts(7 hunks)omnidoc/readProject.ts(4 hunks)src/cartesian/Bar.tsx(1 hunks)src/cartesian/BarStack.tsx(1 hunks)src/cartesian/ReferenceArea.tsx(1 hunks)src/cartesian/ReferenceDot.tsx(1 hunks)src/cartesian/ReferenceLine.tsx(1 hunks)src/cartesian/XAxis.tsx(1 hunks)src/cartesian/YAxis.tsx(1 hunks)src/chart/AreaChart.tsx(1 hunks)src/chart/BarChart.tsx(1 hunks)src/chart/ComposedChart.tsx(1 hunks)src/chart/FunnelChart.tsx(1 hunks)src/chart/LineChart.tsx(1 hunks)src/chart/PieChart.tsx(1 hunks)src/chart/RadarChart.tsx(1 hunks)src/chart/RadialBarChart.tsx(1 hunks)src/chart/ScatterChart.tsx(1 hunks)src/component/Label.tsx(3 hunks)src/polar/PolarRadiusAxis.tsx(1 hunks)www/src/docs/api/BarStackAPI.tsx(1 hunks)www/src/docs/api/Label.ts(0 hunks)www/src/docs/api/LabelAPI.tsx(1 hunks)www/src/docs/api/index.ts(2 hunks)www/src/views/APIViewNew.tsx(3 hunks)
💤 Files with no reviewable changes (1)
- www/src/docs/api/Label.ts
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
**/*.{ts,tsx}: Never useanytype (implicit or explicit) in TypeScript code
Preferunknownoveranyand refine the type in TypeScript
Type function parameters and return values explicitly in TypeScript, do not rely on implicit any or inference; exceptions are React components and trivial functions
Do not useastype assertions in TypeScript; the only exception isas const
Files:
src/chart/AreaChart.tsxsrc/chart/LineChart.tsxsrc/cartesian/ReferenceArea.tsxsrc/cartesian/Bar.tsxsrc/chart/BarChart.tsxsrc/cartesian/BarStack.tsxsrc/chart/ScatterChart.tsxwww/src/views/APIViewNew.tsxomnidoc/readProject.spec.tssrc/cartesian/ReferenceLine.tsxwww/src/docs/api/index.tssrc/component/Label.tsxwww/src/docs/api/LabelAPI.tsxsrc/cartesian/XAxis.tsxomnidoc/readProject.tssrc/chart/FunnelChart.tsxsrc/cartesian/YAxis.tsxsrc/cartesian/ReferenceDot.tsxsrc/chart/RadarChart.tsxsrc/chart/PieChart.tsxsrc/chart/RadialBarChart.tsxomnidoc/generateApiDoc.tssrc/polar/PolarRadiusAxis.tsxsrc/chart/ComposedChart.tsxwww/src/docs/api/BarStackAPI.tsx
**/*.{js,ts,tsx}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Ensure code lints by running
npm run lintand follows Airbnb's Style Guide
Files:
src/chart/AreaChart.tsxsrc/chart/LineChart.tsxsrc/cartesian/ReferenceArea.tsxsrc/cartesian/Bar.tsxsrc/chart/BarChart.tsxsrc/cartesian/BarStack.tsxsrc/chart/ScatterChart.tsxwww/src/views/APIViewNew.tsxomnidoc/readProject.spec.tssrc/cartesian/ReferenceLine.tsxwww/src/docs/api/index.tssrc/component/Label.tsxwww/src/docs/api/LabelAPI.tsxsrc/cartesian/XAxis.tsxomnidoc/readProject.tssrc/chart/FunnelChart.tsxsrc/cartesian/YAxis.tsxsrc/cartesian/ReferenceDot.tsxsrc/chart/RadarChart.tsxsrc/chart/PieChart.tsxsrc/chart/RadialBarChart.tsxomnidoc/generateApiDoc.tssrc/polar/PolarRadiusAxis.tsxsrc/chart/ComposedChart.tsxwww/src/docs/api/BarStackAPI.tsx
src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Do not hardcode any strings or formatting choices in library code; users should provide localized strings as desired
Files:
src/chart/AreaChart.tsxsrc/chart/LineChart.tsxsrc/cartesian/ReferenceArea.tsxsrc/cartesian/Bar.tsxsrc/chart/BarChart.tsxsrc/cartesian/BarStack.tsxsrc/chart/ScatterChart.tsxsrc/cartesian/ReferenceLine.tsxsrc/component/Label.tsxsrc/cartesian/XAxis.tsxsrc/chart/FunnelChart.tsxsrc/cartesian/YAxis.tsxsrc/cartesian/ReferenceDot.tsxsrc/chart/RadarChart.tsxsrc/chart/PieChart.tsxsrc/chart/RadialBarChart.tsxsrc/polar/PolarRadiusAxis.tsxsrc/chart/ComposedChart.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (DEVELOPING.md)
All imports from
rechartsmust use the public API entry point; imports from internal paths likerecharts/types/*orrecharts/src/*are not allowed
Files:
src/chart/AreaChart.tsxsrc/chart/LineChart.tsxsrc/cartesian/ReferenceArea.tsxsrc/cartesian/Bar.tsxsrc/chart/BarChart.tsxsrc/cartesian/BarStack.tsxsrc/chart/ScatterChart.tsxwww/src/views/APIViewNew.tsxomnidoc/readProject.spec.tssrc/cartesian/ReferenceLine.tsxwww/src/docs/api/index.tssrc/component/Label.tsxwww/src/docs/api/LabelAPI.tsxsrc/cartesian/XAxis.tsxomnidoc/readProject.tssrc/chart/FunnelChart.tsxsrc/cartesian/YAxis.tsxsrc/cartesian/ReferenceDot.tsxsrc/chart/RadarChart.tsxsrc/chart/PieChart.tsxsrc/chart/RadialBarChart.tsxomnidoc/generateApiDoc.tssrc/polar/PolarRadiusAxis.tsxsrc/chart/ComposedChart.tsxwww/src/docs/api/BarStackAPI.tsx
**/*.spec.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
When running unit tests, prefer to run a single test file using
npm run test -- path/to/TestFile.spec.tsxrather than running all tests withnpm test
Files:
omnidoc/readProject.spec.ts
🧠 Learnings (9)
📚 Learning: 2025-11-23T13:30:10.395Z
Learnt from: PavelVanecek
Repo: recharts/recharts PR: 6669
File: www/src/docs/exampleComponents/ScatterChart/ScatterChartWithLabels.tsx:2-2
Timestamp: 2025-11-23T13:30:10.395Z
Learning: The `TooltipIndex` type from recharts is defined in `src/state/tooltipSlice.ts` but is not currently exported from the public API entry points. It should not be imported from `recharts/types/state/tooltipSlice` as this is an internal implementation path. An ESLint rule is needed to prevent regressions.
Applied to files:
src/chart/LineChart.tsxsrc/chart/BarChart.tsxsrc/chart/ScatterChart.tsxwww/src/docs/api/index.ts
📚 Learning: 2025-11-25T01:22:59.729Z
Learnt from: CR
Repo: recharts/recharts PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-25T01:22:59.729Z
Learning: Applies to storybook/stories/**/*.stories.tsx : Update Storybook stories when APIs have been changed to ensure they work as expected
Applied to files:
omnidoc/readProject.spec.ts
📚 Learning: 2025-11-25T01:23:08.250Z
Learnt from: CR
Repo: recharts/recharts PR: 0
File: test/README.md:0-0
Timestamp: 2025-11-25T01:23:08.250Z
Learning: Applies to test/**/*.{test,spec}.{ts,tsx} : Verify the number of selector calls using the spy object from `createSelectorTestCase` to spot unnecessary re-renders and improve performance
Applied to files:
omnidoc/readProject.spec.ts
📚 Learning: 2025-11-25T01:22:59.729Z
Learnt from: CR
Repo: recharts/recharts PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-25T01:22:59.729Z
Learning: Applies to test/component/**/*.spec.tsx : Use React Testing Library for testing component interactions and behavior upon rendering
Applied to files:
omnidoc/readProject.spec.ts
📚 Learning: 2025-11-25T01:22:59.729Z
Learnt from: CR
Repo: recharts/recharts PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-25T01:22:59.729Z
Learning: Applies to storybook/stories/**/*.stories.tsx : Use Storybook for smoke tests and add play functions with assertions for actual tests
Applied to files:
omnidoc/readProject.spec.ts
📚 Learning: 2025-11-25T01:23:08.250Z
Learnt from: CR
Repo: recharts/recharts PR: 0
File: test/README.md:0-0
Timestamp: 2025-11-25T01:23:08.250Z
Learning: Applies to test/**/*.{test,spec}.{ts,tsx} : Use the `expectLastCalledWith` helper function instead of `expect(spy).toHaveBeenLastCalledWith(...)` for better typing and autocompletion
Applied to files:
omnidoc/readProject.spec.ts
📚 Learning: 2025-11-25T01:22:59.729Z
Learnt from: CR
Repo: recharts/recharts PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-25T01:22:59.729Z
Learning: Provide a reduced test case and live examples (e.g., via CodeSandbox) when reporting bugs
Applied to files:
omnidoc/readProject.spec.ts
📚 Learning: 2025-11-25T01:23:08.250Z
Learnt from: CR
Repo: recharts/recharts PR: 0
File: test/README.md:0-0
Timestamp: 2025-11-25T01:23:08.250Z
Learning: Applies to test/**/*.{test,spec}.{ts,tsx} : Prefer to use the `createSelectorTestCase` helper function when writing or modifying tests
Applied to files:
omnidoc/readProject.spec.ts
📚 Learning: 2025-12-06T03:36:59.377Z
Learnt from: CR
Repo: recharts/recharts PR: 0
File: DEVELOPING.md:0-0
Timestamp: 2025-12-06T03:36:59.377Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : All imports from `recharts` must use the public API entry point; imports from internal paths like `recharts/types/*` or `recharts/src/*` are not allowed
Applied to files:
www/src/docs/api/index.tssrc/chart/RadialBarChart.tsxsrc/chart/ComposedChart.tsx
🧬 Code graph analysis (4)
www/src/docs/api/index.ts (1)
www/src/docs/api/LabelAPI.tsx (1)
LabelAPI(3-163)
src/component/Label.tsx (2)
src/component/Text.tsx (1)
RenderableText(66-66)src/index.ts (1)
RenderableText(25-25)
www/src/docs/api/LabelAPI.tsx (1)
www/src/docs/api/types.ts (1)
ApiDoc(21-27)
omnidoc/generateApiDoc.ts (2)
omnidoc/readProject.ts (2)
getAllTagTexts(42-53)getTagText(27-37)www/src/docs/api/types.ts (1)
ApiDoc(21-27)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Build, Test, Pack
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (32)
src/polar/PolarRadiusAxis.tsx (1)
238-240: JSDoc annotation accurately reflects component context provision.The
@provides PolarLabelContextannotation correctly documents that this component provides the PolarLabelContext to its children, which aligns with the implementation at line 229 (<PolarLabelContextProvider>). This change supports the PR's goal of enriching the documentation generator with parent-child relationships.src/cartesian/Bar.tsx (1)
1075-1078: LGTM!The
@consumes BarStackContextannotation accurately documents thatBarconsumes theBarStackContextvia theuseStackIdhook (line 1032). This supports the API documentation generator's context-aware relationship mapping.src/component/Label.tsx (2)
81-82: LGTM!The
@exampleannotations provide clear, concise usage examples for thevalue,children, andcontentprops. These will be picked up by the documentation generator to surface usage patterns in the API docs.Also applies to: 99-100, 107-111
600-606: LGTM!The
@consumesannotations accurately document all four contexts that theLabelcomponent consumes:
CartesianViewBoxContextviauseViewBox(line 183)PolarViewBoxContextviaselectPolarViewBox(line 218)CartesianLabelContextviauseCartesianLabelContext(line 619)PolarLabelContextviausePolarLabelContext(line 618)src/cartesian/ReferenceArea.tsx (1)
176-179: LGTM!The
@provides CartesianLabelContextannotation accurately documents thatReferenceAreaprovides this context viaCartesianLabelContextProvider(lines 152-156).src/cartesian/BarStack.tsx (1)
147-151: LGTM!The
@provides BarStackContextannotation accurately documents thatBarStackprovides this context viaBarStackContext.Provider(line 140). The existing@since 3.6tag is preserved correctly.src/chart/ComposedChart.tsx (1)
9-12: LGTM!The
@provides CartesianViewBoxContextannotation correctly documents thatComposedChart(viaCartesianChart) provides this context to its children, enabling the API docs to show parent-child relationships.src/chart/ScatterChart.tsx (1)
9-12: LGTM!The
@provides CartesianViewBoxContextannotation is consistent with the pattern used in other chart components likeComposedChart.src/cartesian/ReferenceDot.tsx (1)
176-179: LGTM!The
@provides CartesianLabelContextannotation accurately documents thatReferenceDotprovides this context viaCartesianLabelContextProvider(lines 146-156).src/cartesian/XAxis.tsx (1)
213-216: The@provides CartesianLabelContextannotation is accurate.CartesianAxis (which XAxis delegates to) does provide CartesianLabelContext by wrapping its content with CartesianLabelContextProvider (src/cartesian/CartesianAxis.tsx:526-536). The annotation correctly documents the context provided to consumers of XAxis.
src/chart/BarChart.tsx (1)
9-11: LGTM! Context provider annotation added.The JSDoc annotation correctly documents that BarChart provides CartesianViewBoxContext, consistent with other Cartesian chart components in this PR.
src/chart/LineChart.tsx (1)
9-11: LGTM! Context provider annotation added.The JSDoc annotation correctly documents that LineChart provides CartesianViewBoxContext, consistent with other Cartesian chart components in this PR.
src/chart/AreaChart.tsx (1)
9-11: LGTM! Context provider annotation added.The JSDoc annotation correctly documents that AreaChart provides CartesianViewBoxContext, consistent with other Cartesian chart components in this PR.
src/chart/FunnelChart.tsx (1)
9-11: LGTM! Context provider annotation added.The JSDoc annotation correctly documents that FunnelChart provides CartesianViewBoxContext, consistent with other Cartesian chart components in this PR.
www/src/docs/api/BarStackAPI.tsx (1)
60-60: LGTM! Child component relationship documented.The
childrenComponents: ['Bar']field correctly documents thatBaris a valid child component ofBarStack, aligning with the PR's goal of documenting component relationships.omnidoc/readProject.spec.ts (2)
834-834: LGTM! Test expectations updated for array-based tag storage.The test expectations correctly reflect the migration from Map-based to array-based JSDoc tag storage, aligning with the broader PR changes to the documentation generation system.
Also applies to: 846-846, 865-865, 883-883, 895-895, 918-918
974-983: LGTM! New test validates example reading capability.The new test correctly validates the
getExamplesOffunctionality for reading@exampletags from component props, expanding test coverage for the enhanced documentation generation features.src/chart/RadarChart.tsx (1)
17-19: LGTM! Context provider annotation added.The JSDoc annotation correctly documents that RadarChart provides PolarViewBoxContext, consistent with other polar chart components in this PR.
src/chart/RadialBarChart.tsx (1)
17-19: LGTM! Context provider annotation added.The JSDoc annotation correctly documents that RadialBarChart provides PolarViewBoxContext, consistent with other polar chart components in this PR.
src/cartesian/ReferenceLine.tsx (1)
310-312: LGTM!The JSDoc
@provides CartesianLabelContextannotation correctly documents that this component provides theCartesianLabelContextviaCartesianLabelContextProvider(line 287). This aligns with the broader context-aware API documentation approach in this PR.src/chart/PieChart.tsx (1)
17-19: LGTM!The
@provides PolarViewBoxContextannotation correctly documents the context this chart component provides, consistent with similar annotations added to other chart components in this PR.src/cartesian/YAxis.tsx (1)
256-258: LGTM!The
@provides CartesianLabelContextannotation correctly documents thatYAxisprovides label context, consistent with similar annotations onXAxisand other cartesian components.www/src/views/APIViewNew.tsx (1)
92-96: LGTM!The addition of
componentNameprop to bothParentComponentsandChildrenComponentsimproves the contextual documentation by clearly indicating which component consumes or provides context. The prop typing and usage are correct.Also applies to: 98-98, 120-124, 126-126, 208-208, 211-211
www/src/docs/api/index.ts (1)
86-86: LGTM!The
Labelentry now correctly referencesLabelAPIfrom the new dedicated file, aligning with the PR's goal of migrating Label's API documentation to the automated generation system.omnidoc/readProject.ts (2)
18-25: Well-documented type change for multi-tag support.The switch from
Mapto array of tuples with clear documentation explaining the rationale is a good design choice for supporting multiple tags with the same name.
27-37: LGTM on the helper design.The return type
{ text: string | undefined } | undefinedcorrectly distinguishes between "tag not found" (undefined) and "tag found but has no text" ({ text: undefined }).www/src/docs/api/LabelAPI.tsx (2)
3-163: Comprehensive Label API documentation.The props are well-documented with types, optional flags, default values, and usage examples. The
parentComponentslist covers charts, axes, and reference components appropriately.
1-1: The JSX transform configuration is correct. Thewww/tsconfig.jsonalready specifies"jsx": "react-jsx", which is the modern JSX transform that does not require a React import. SinceLabelAPI.tsxis located in thewwwdirectory, it uses this configuration and works as intended.omnidoc/generateApiDoc.ts (4)
95-128: Context map builder looks correct.The logic for building provider/consumer relationships from
@provides/@consumestags is sound. The non-null assertions on lines 114 and 123 are safe because the map entry is guaranteed to exist after thesetcall.
177-181: LGTM on examples handling.Correctly retrieves examples and only adds
formatwhen examples exist.
200-228: Context-aware parent/children resolution looks good.The logic correctly aggregates all consumers of provided contexts as children, and all providers of consumed contexts as parents.
308-311: Good design: build context map once from all public components.Building the context map from all public components (not just those being generated) ensures complete provider/consumer relationships are captured.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6751 +/- ##
==========================================
+ Coverage 93.89% 93.91% +0.01%
==========================================
Files 512 514 +2
Lines 42715 42833 +118
Branches 4990 4991 +1
==========================================
+ Hits 40109 40227 +118
+ Misses 2601 2600 -1
- Partials 5 6 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
|
Staging Deployment Details
These deployments will remain available for 30 days. To update snapshots: Comment |
Bundle ReportChanges will increase total bundle size by 1.78kB (0.07%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: recharts/bundle-cjsAssets Changed:
view changes for bundle: recharts/bundle-es6Assets Changed:
|
|
Staging Deployment Details
These deployments will remain available for 30 days. To update snapshots: Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (3)
www/src/docs/api/ZIndexLayerAPI.tsx (1)
21-39: Consider aligning thezIndexprop type with the actual component signature.The actual
ZIndexLayerPropsinsrc/zIndex/ZIndexLayer.tsxdefineszIndex: number | undefined, but here the type is documented as just'number'. While the description mentions theundefinedcase (Line 34), thetypefield could be more precise.Also, with
isOptional: false(Line 24), this suggestszIndexis required, yet the component acceptsundefined. Consider whether this should beisOptional: truewith type'number | undefined'for consistency.omnidoc/generateApiDoc.ts (2)
187-196: Theastype assertion could be avoided.Per coding guidelines,
astype assertions should be avoided. The assertion here is used to narrow the type for JSON serialization. Consider defining thedefaultValtype more precisely in theApiPropstype definition, or use a type guard function to validate the value.- if (defaultValue.type === 'known') { - prop.defaultVal = defaultValue.value as - | string - | number - | boolean - | Array<unknown> - | Record<string, unknown> - | null; - } + if (defaultValue.type === 'known' && defaultValue.value !== undefined) { + // defaultVal accepts primitive types and serializable objects + prop.defaultVal = defaultValue.value; + }Note: This may require updating the
ApiPropstype to properly typedefaultValto match whatgetDefaultValueOfreturns. Based on coding guidelines, prefer refining types over using assertions.
99-129: Consider simplifying the Map access pattern.The
has()check followed byget()!is safe but verbose. You could use a helper or inline the pattern to reduce repetition.function buildContextMap( componentNames: ReadonlyArray<string>, projectReader: ProjectDocReader, ): Map<string, { providers: string[]; consumers: string[] }> { const contextMap = new Map<string, { providers: string[]; consumers: string[] }>(); + + const getOrCreateContext = (contextName: string) => { + let ctx = contextMap.get(contextName); + if (!ctx) { + ctx = { providers: [], consumers: [] }; + contextMap.set(contextName, ctx); + } + return ctx; + }; for (const componentName of componentNames) { const jsDoc = projectReader.getComponentJsDocMeta(componentName); if (!jsDoc) continue; const providesTags = getAllTagTexts(jsDoc, 'provides'); for (const contextName of providesTags) { - if (!contextMap.has(contextName)) { - contextMap.set(contextName, { providers: [], consumers: [] }); - } - contextMap.get(contextName)!.providers.push(componentName); + getOrCreateContext(contextName).providers.push(componentName); } const consumesTags = getAllTagTexts(jsDoc, 'consumes'); for (const contextName of consumesTags) { - if (!contextMap.has(contextName)) { - contextMap.set(contextName, { providers: [], consumers: [] }); - } - contextMap.get(contextName)!.consumers.push(componentName); + getOrCreateContext(contextName).consumers.push(componentName); } } return contextMap; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
www/test/__snapshots__/navigation.spec.ts.snapis excluded by!**/*.snap
📒 Files selected for processing (9)
omnidoc/generateApiDoc.ts(7 hunks)omnidoc/readApiDoc.spec.ts(1 hunks)src/zIndex/ZIndexLayer.tsx(2 hunks)www/src/docs/api/BarStackAPI.tsx(1 hunks)www/src/docs/api/ZIndexLayerAPI.tsx(1 hunks)www/src/docs/api/index.ts(3 hunks)www/src/docs/apiCates.ts(1 hunks)www/src/docs/apiExamples/ZIndexLayer/index.tsx(1 hunks)www/src/docs/apiExamples/index.tsx(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- www/src/docs/api/index.ts
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
**/*.{ts,tsx}: Never useanytype (implicit or explicit) in TypeScript code
Preferunknownoveranyand refine the type in TypeScript
Type function parameters and return values explicitly in TypeScript, do not rely on implicit any or inference; exceptions are React components and trivial functions
Do not useastype assertions in TypeScript; the only exception isas const
Files:
src/zIndex/ZIndexLayer.tsxwww/src/docs/api/ZIndexLayerAPI.tsxwww/src/docs/api/BarStackAPI.tsxwww/src/docs/apiCates.tswww/src/docs/apiExamples/index.tsxwww/src/docs/apiExamples/ZIndexLayer/index.tsxomnidoc/readApiDoc.spec.tsomnidoc/generateApiDoc.ts
**/*.{js,ts,tsx}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Ensure code lints by running
npm run lintand follows Airbnb's Style Guide
Files:
src/zIndex/ZIndexLayer.tsxwww/src/docs/api/ZIndexLayerAPI.tsxwww/src/docs/api/BarStackAPI.tsxwww/src/docs/apiCates.tswww/src/docs/apiExamples/index.tsxwww/src/docs/apiExamples/ZIndexLayer/index.tsxomnidoc/readApiDoc.spec.tsomnidoc/generateApiDoc.ts
src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Do not hardcode any strings or formatting choices in library code; users should provide localized strings as desired
Files:
src/zIndex/ZIndexLayer.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (DEVELOPING.md)
All imports from
rechartsmust use the public API entry point; imports from internal paths likerecharts/types/*orrecharts/src/*are not allowed
Files:
src/zIndex/ZIndexLayer.tsxwww/src/docs/api/ZIndexLayerAPI.tsxwww/src/docs/api/BarStackAPI.tsxwww/src/docs/apiCates.tswww/src/docs/apiExamples/index.tsxwww/src/docs/apiExamples/ZIndexLayer/index.tsxomnidoc/readApiDoc.spec.tsomnidoc/generateApiDoc.ts
**/*.spec.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
When running unit tests, prefer to run a single test file using
npm run test -- path/to/TestFile.spec.tsxrather than running all tests withnpm test
Files:
omnidoc/readApiDoc.spec.ts
🧠 Learnings (2)
📚 Learning: 2025-11-23T13:30:10.395Z
Learnt from: PavelVanecek
Repo: recharts/recharts PR: 6669
File: www/src/docs/exampleComponents/ScatterChart/ScatterChartWithLabels.tsx:2-2
Timestamp: 2025-11-23T13:30:10.395Z
Learning: The `TooltipIndex` type from recharts is defined in `src/state/tooltipSlice.ts` but is not currently exported from the public API entry points. It should not be imported from `recharts/types/state/tooltipSlice` as this is an internal implementation path. An ESLint rule is needed to prevent regressions.
Applied to files:
www/src/docs/api/ZIndexLayerAPI.tsx
📚 Learning: 2025-12-06T03:36:59.377Z
Learnt from: CR
Repo: recharts/recharts PR: 0
File: DEVELOPING.md:0-0
Timestamp: 2025-12-06T03:36:59.377Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : All imports from `recharts` must use the public API entry point; imports from internal paths like `recharts/types/*` or `recharts/src/*` are not allowed
Applied to files:
www/src/docs/apiExamples/index.tsx
🧬 Code graph analysis (3)
www/src/docs/api/ZIndexLayerAPI.tsx (1)
www/src/docs/api/types.ts (1)
ApiDoc(21-27)
www/src/docs/apiExamples/index.tsx (1)
www/src/docs/apiExamples/ZIndexLayer/index.tsx (1)
zIndexLayerApiExamples(5-11)
www/src/docs/apiExamples/ZIndexLayer/index.tsx (2)
www/src/docs/exampleComponents/types.ts (1)
ChartExample(3-23)www/src/components/GuideView/ZIndex/PrahaMetro.tsx (1)
PrahaMetro(227-343)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Build, Test, Pack
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (9)
www/src/docs/api/ZIndexLayerAPI.tsx (1)
1-54: LGTM overall!The API documentation structure is well-organized and provides clear descriptions for the
ZIndexLayercomponent. The JSX-based descriptions explain the portal mechanism and usage context effectively.www/src/docs/apiExamples/index.tsx (1)
24-24: LGTM!The import and export follow the established pattern for registering API examples. The
ZIndexLayerentry is properly integrated into theallApiExamplesregistry.Also applies to: 49-49
www/src/docs/apiCates.ts (1)
20-30: LGTM!The
ZIndexLayercomponent is appropriately categorized undergeneral-components, and the multi-line formatting improves readability.omnidoc/readApiDoc.spec.ts (1)
57-57: LGTM!The inline snapshot correctly reflects the addition of
ZIndexLayerto the public API surface.www/src/docs/apiExamples/ZIndexLayer/index.tsx (1)
1-11: LGTM!The new examples file follows the established pattern. The
PrahaMetrocomponent is a good choice for demonstratingZIndexLayerfunctionality, as it showcases layering elements with different z-index values.src/zIndex/ZIndexLayer.tsx (1)
27-56: LGTM!The JSDoc improvements enhance documentation clarity. The
@since 3.4tag properly documents the version availability, and the formatting with backticks aroundz-indeximproves readability.omnidoc/generateApiDoc.ts (3)
131-149: LGTM!The
generateComponentDescriptionfunction properly handles the@sincetag with thesinceTag?.textguard, addressing the previous review concern about potential "undefined" text in descriptions.
24-30: LGTM!The addition of
LabelandZIndexLayertoOMNIDOC_AUTOMATED_API_DOCS_COMPONENTSenables automated API documentation generation for these components.
154-158: No breaking change impact: generateApiDoc is not imported or used externally.The search confirms that
generateApiDocis only used internally withinomnidoc/generateApiDoc.ts. While the function is exported, no other files in the codebase import it. The only external import from this file inomnidoc.spec.tsis theOMNIDOC_AUTOMATED_API_DOCS_COMPONENTSconstant, not the function itself. The signature change therefore has no impact on external consumers.Likely an incorrect or invalid review comment.
| desc: { | ||
| 'en-US': ( | ||
| <section> | ||
| <p>Available since Recharts 3.6</p> | ||
| </section> | ||
| ), | ||
| }, |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# First, let's examine the ApiDoc type definition
cat www/src/docs/api/types.tsRepository: recharts/recharts
Length of output: 799
🏁 Script executed:
# Let's also look at the full context of the BarStackAPI.tsx file
head -80 www/src/docs/api/BarStackAPI.tsxRepository: recharts/recharts
Length of output: 2463
🏁 Script executed:
# Search for BarStack introduction in git history
git log --all --oneline --grep="BarStack" | head -10Repository: recharts/recharts
Length of output: 184
🏁 Script executed:
# Check package.json for version info and changelog for BarStack
fd -e "CHANGELOG*" -e "package.json" | xargs grep -l "3\.6\|BarStack" 2>/dev/null | head -5Repository: recharts/recharts
Length of output: 43
🏁 Script executed:
# Check git tags and dates around the BarStack commit
git log --all --oneline --decorate | grep -A 5 -B 5 "939c657\|BarStack"Repository: recharts/recharts
Length of output: 680
🏁 Script executed:
# Check package.json history and version tags
git tag -l | grep -E "v3\.[456]" | sort -VRepository: recharts/recharts
Length of output: 43
🏁 Script executed:
# Check when version 3.6 was released
git log --all --oneline --grep="3\.6" | head -5Repository: recharts/recharts
Length of output: 378
🏁 Script executed:
# Look at the commit directly to see if it mentions version
git show 939c657 --statRepository: recharts/recharts
Length of output: 3073
🏁 Script executed:
cat package.json | grep -A 2 "\"version\""Repository: recharts/recharts
Length of output: 141
🏁 Script executed:
# Check CHANGELOG or release notes for version info
fd -type f -name "CHANGELOG*" -o -name "HISTORY*" -o -name "RELEASES*" | head -3 | xargs head -50 2>/dev/nullRepository: recharts/recharts
Length of output: 231
Remove or update the version reference — BarStack was just added and Recharts is currently at 3.5.1, not 3.6.
The desc structure is properly typed in ApiDoc and matches the code. However, the claim "Available since Recharts 3.6" is incorrect; the current package version is 3.5.1. Update the version number to match the actual release version when BarStack becomes available, or remove the version reference if this documentation is not yet finalized for release.
🤖 Prompt for AI Agents
In www/src/docs/api/BarStackAPI.tsx around lines 59 to 65, the description text
incorrectly states "Available since Recharts 3.6" while the current package is
3.5.1; update the desc entry to either remove the version reference entirely or
change it to the correct version when BarStack is actually released (e.g.,
replace or remove the paragraph node so it no longer claims availability in
3.6).
There was a problem hiding this comment.
I am preparing the documentation now, ahead of time so that it is ready for the release.
There was a problem hiding this comment.
@PavelVanecek, got it! Preparing the documentation ahead of time for the 3.6 release makes sense. Just ensure the version number aligns with the actual release version when it goes out. Thanks for clarifying!
|
Staging Deployment Details
These deployments will remain available for 30 days. To update snapshots: Comment |
Description
I think now we have feature parity with what the website offers, and we can start autogenerating all component pages once we copy over all the comments. Half manual work!
Related Issue
#6069
Summary by CodeRabbit
New Features
Documentation
Tests
✏️ Tip: You can customize this high-level summary in your review settings.