Skip to content

[Omnidoc] add examples and parents-children to the docs generator#6751

Merged
ckifer merged 9 commits into
mainfrom
omnidoc
Dec 9, 2025
Merged

[Omnidoc] add examples and parents-children to the docs generator#6751
ckifer merged 9 commits into
mainfrom
omnidoc

Conversation

@PavelVanecek

@PavelVanecek PavelVanecek commented Dec 8, 2025

Copy link
Copy Markdown
Collaborator

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

    • API docs now show component context relationships (parent/children), multi-language descriptions, per-property usage examples, and @SInCE info.
    • ZIndexLayer can accept children and is documented in the examples registry.
  • Documentation

    • Label API consolidated and integrated into the docs index.
    • Added provider/consumer annotations across charts/axes to enrich generated docs.
  • Tests

    • Updated tests to reflect new JSDoc tag handling and example extraction.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Dec 8, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Adds context-aware API doc generation by building a context map from JSDoc @provides/@consumes tags, migrates JSDoc tag storage from Map to tuple arrays with helper accessors, surfaces per-prop examples and @since metadata, and introduces/updates component JSDoc annotations and Label/ZIndexLayer API docs across the repo.

Changes

Cohort / File(s) Summary
Context-aware API doc generation
omnidoc/generateApiDoc.ts
Added buildContextMap(componentNames, projectReader); changed generateApiDoc(...) to accept contextMap; populate apiDoc.parentComponents and apiDoc.childrenComponents from the context map; attach per-prop examples as prop.format; derive multi-locale apiDoc.desc with @since; updated stringifyApiDoc() to emit new fields; added 'Label' and 'ZIndexLayer' to OMNIDOC_AUTOMATED_API_DOCS_COMPONENTS.
JSDoc tag infra & examples
omnidoc/readProject.ts, omnidoc/readProject.spec.ts
Switched JSDoc tag storage from `Map<string,string
Component context annotations (JSDoc only)
src/cartesian/*, src/chart/*, src/polar/*
src/cartesian/Bar.tsx, src/cartesian/BarStack.tsx, src/cartesian/ReferenceArea.tsx, src/cartesian/ReferenceDot.tsx, src/cartesian/ReferenceLine.tsx, src/cartesian/XAxis.tsx, src/cartesian/YAxis.tsx, src/chart/AreaChart.tsx, src/chart/BarChart.tsx, src/chart/ComposedChart.tsx, src/chart/FunnelChart.tsx, src/chart/LineChart.tsx, src/chart/PieChart.tsx, src/chart/RadarChart.tsx, src/chart/RadialBarChart.tsx, src/chart/ScatterChart.tsx, src/polar/PolarRadiusAxis.tsx
Added @provides / @consumes JSDoc annotations (e.g., CartesianLabelContext, CartesianViewBoxContext, PolarViewBoxContext, PolarLabelContext) to document providers/consumers. No runtime changes.
Label component docs migration & examples
src/component/Label.tsx, www/src/docs/api/Label.ts (deleted), www/src/docs/api/LabelAPI.tsx
Added JSDoc examples and @consumes to Label.tsx; deleted legacy www/src/docs/api/Label.ts; added www/src/docs/api/LabelAPI.tsx exporting LabelAPI: ApiDoc with props, defaults, formats, and parentComponents.
ZIndexLayer component & docs
src/zIndex/ZIndexLayer.tsx, www/src/docs/api/ZIndexLayerAPI.tsx, www/src/docs/apiExamples/ZIndexLayer/index.tsx, www/src/docs/apiExamples/index.tsx, www/src/docs/apiCates.ts
ZIndexLayerProps now allows optional children?: React.ReactNode; added ZIndexLayerAPI doc object; added example zIndexLayerApiExamples and registered it in allApiExamples; added ZIndexLayer to general-components list.
API docs registry & UI updates
www/src/docs/api/index.ts, www/src/docs/api/BarStackAPI.tsx, www/src/views/APIViewNew.tsx, www/src/docs/api/LabelAPI.tsx, www/src/docs/api/BarStackAPI.tsx
Replaced old Label import with LabelAPI; added ZIndexLayerAPI to allExamples; converted BarStackAPI.desc to localized JSX and added childrenComponents; APIViewNew now threads componentName prop into ParentComponents and ChildrenComponents and updated their signatures.
Tests / snapshots
omnidoc/readApiDoc.spec.ts, omnidoc/readProject.spec.ts
Updated tests/snapshots to include ZIndexLayer and to reflect array-based JSDoc tags and example extraction.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25–35 minutes

  • Areas needing extra attention:
    • omnidoc/generateApiDoc.ts — correctness of context map construction, handling multiple providers/consumers, and integration into existing generation flow.
    • omnidoc/readProject.ts — tag-array parsing, semantics of getTagText / getAllTagTexts, and getExamplesOf fallback/deduping behavior.
    • Label/ZIndexLayer API changes — ensure new docs shape matches UI expectations and removed legacy Label doc is fully replaced.
    • www/src/views/APIViewNew.tsx — verify rendering when parentComponents / childrenComponents are absent or empty.

Possibly related PRs

Suggested labels

enhancement, feature request

Suggested reviewers

  • ckifer

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 68.75% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description check ❓ Inconclusive The description is minimal and lacks required sections from the template (motivation, testing details, type of change, and checklist items are missing). Add missing sections from the template: explain the motivation/problem solved, describe how changes were tested, specify the type of change, and complete the checklist items.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding examples and parent-child relationships to the omnidoc documentation generator.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch omnidoc

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 .tsx extension 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 @example text 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

📥 Commits

Reviewing files that changed from the base of the PR and between cf325bd and d1ceb0c.

📒 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 use any type (implicit or explicit) in TypeScript code
Prefer unknown over any and 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 use as type assertions in TypeScript; the only exception is as const

Files:

  • src/chart/AreaChart.tsx
  • src/chart/LineChart.tsx
  • src/cartesian/ReferenceArea.tsx
  • src/cartesian/Bar.tsx
  • src/chart/BarChart.tsx
  • src/cartesian/BarStack.tsx
  • src/chart/ScatterChart.tsx
  • www/src/views/APIViewNew.tsx
  • omnidoc/readProject.spec.ts
  • src/cartesian/ReferenceLine.tsx
  • www/src/docs/api/index.ts
  • src/component/Label.tsx
  • www/src/docs/api/LabelAPI.tsx
  • src/cartesian/XAxis.tsx
  • omnidoc/readProject.ts
  • src/chart/FunnelChart.tsx
  • src/cartesian/YAxis.tsx
  • src/cartesian/ReferenceDot.tsx
  • src/chart/RadarChart.tsx
  • src/chart/PieChart.tsx
  • src/chart/RadialBarChart.tsx
  • omnidoc/generateApiDoc.ts
  • src/polar/PolarRadiusAxis.tsx
  • src/chart/ComposedChart.tsx
  • www/src/docs/api/BarStackAPI.tsx
**/*.{js,ts,tsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Ensure code lints by running npm run lint and follows Airbnb's Style Guide

Files:

  • src/chart/AreaChart.tsx
  • src/chart/LineChart.tsx
  • src/cartesian/ReferenceArea.tsx
  • src/cartesian/Bar.tsx
  • src/chart/BarChart.tsx
  • src/cartesian/BarStack.tsx
  • src/chart/ScatterChart.tsx
  • www/src/views/APIViewNew.tsx
  • omnidoc/readProject.spec.ts
  • src/cartesian/ReferenceLine.tsx
  • www/src/docs/api/index.ts
  • src/component/Label.tsx
  • www/src/docs/api/LabelAPI.tsx
  • src/cartesian/XAxis.tsx
  • omnidoc/readProject.ts
  • src/chart/FunnelChart.tsx
  • src/cartesian/YAxis.tsx
  • src/cartesian/ReferenceDot.tsx
  • src/chart/RadarChart.tsx
  • src/chart/PieChart.tsx
  • src/chart/RadialBarChart.tsx
  • omnidoc/generateApiDoc.ts
  • src/polar/PolarRadiusAxis.tsx
  • src/chart/ComposedChart.tsx
  • www/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.tsx
  • src/chart/LineChart.tsx
  • src/cartesian/ReferenceArea.tsx
  • src/cartesian/Bar.tsx
  • src/chart/BarChart.tsx
  • src/cartesian/BarStack.tsx
  • src/chart/ScatterChart.tsx
  • src/cartesian/ReferenceLine.tsx
  • src/component/Label.tsx
  • src/cartesian/XAxis.tsx
  • src/chart/FunnelChart.tsx
  • src/cartesian/YAxis.tsx
  • src/cartesian/ReferenceDot.tsx
  • src/chart/RadarChart.tsx
  • src/chart/PieChart.tsx
  • src/chart/RadialBarChart.tsx
  • src/polar/PolarRadiusAxis.tsx
  • src/chart/ComposedChart.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (DEVELOPING.md)

All imports from recharts must use the public API entry point; imports from internal paths like recharts/types/* or recharts/src/* are not allowed

Files:

  • src/chart/AreaChart.tsx
  • src/chart/LineChart.tsx
  • src/cartesian/ReferenceArea.tsx
  • src/cartesian/Bar.tsx
  • src/chart/BarChart.tsx
  • src/cartesian/BarStack.tsx
  • src/chart/ScatterChart.tsx
  • www/src/views/APIViewNew.tsx
  • omnidoc/readProject.spec.ts
  • src/cartesian/ReferenceLine.tsx
  • www/src/docs/api/index.ts
  • src/component/Label.tsx
  • www/src/docs/api/LabelAPI.tsx
  • src/cartesian/XAxis.tsx
  • omnidoc/readProject.ts
  • src/chart/FunnelChart.tsx
  • src/cartesian/YAxis.tsx
  • src/cartesian/ReferenceDot.tsx
  • src/chart/RadarChart.tsx
  • src/chart/PieChart.tsx
  • src/chart/RadialBarChart.tsx
  • omnidoc/generateApiDoc.ts
  • src/polar/PolarRadiusAxis.tsx
  • src/chart/ComposedChart.tsx
  • www/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.tsx rather than running all tests with npm 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.tsx
  • src/chart/BarChart.tsx
  • src/chart/ScatterChart.tsx
  • www/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.ts
  • src/chart/RadialBarChart.tsx
  • src/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 PolarLabelContext annotation 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 BarStackContext annotation accurately documents that Bar consumes the BarStackContext via the useStackId hook (line 1032). This supports the API documentation generator's context-aware relationship mapping.

src/component/Label.tsx (2)

81-82: LGTM!

The @example annotations provide clear, concise usage examples for the value, children, and content props. 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 @consumes annotations accurately document all four contexts that the Label component consumes:

  • CartesianViewBoxContext via useViewBox (line 183)
  • PolarViewBoxContext via selectPolarViewBox (line 218)
  • CartesianLabelContext via useCartesianLabelContext (line 619)
  • PolarLabelContext via usePolarLabelContext (line 618)
src/cartesian/ReferenceArea.tsx (1)

176-179: LGTM!

The @provides CartesianLabelContext annotation accurately documents that ReferenceArea provides this context via CartesianLabelContextProvider (lines 152-156).

src/cartesian/BarStack.tsx (1)

147-151: LGTM!

The @provides BarStackContext annotation accurately documents that BarStack provides this context via BarStackContext.Provider (line 140). The existing @since 3.6 tag is preserved correctly.

src/chart/ComposedChart.tsx (1)

9-12: LGTM!

The @provides CartesianViewBoxContext annotation correctly documents that ComposedChart (via CartesianChart) 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 CartesianViewBoxContext annotation is consistent with the pattern used in other chart components like ComposedChart.

src/cartesian/ReferenceDot.tsx (1)

176-179: LGTM!

The @provides CartesianLabelContext annotation accurately documents that ReferenceDot provides this context via CartesianLabelContextProvider (lines 146-156).

src/cartesian/XAxis.tsx (1)

213-216: The @provides CartesianLabelContext annotation 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 that Bar is a valid child component of BarStack, 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 getExamplesOf functionality for reading @example tags 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 CartesianLabelContext annotation correctly documents that this component provides the CartesianLabelContext via CartesianLabelContextProvider (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 PolarViewBoxContext annotation 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 CartesianLabelContext annotation correctly documents that YAxis provides label context, consistent with similar annotations on XAxis and other cartesian components.

www/src/views/APIViewNew.tsx (1)

92-96: LGTM!

The addition of componentName prop to both ParentComponents and ChildrenComponents improves 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 Label entry now correctly references LabelAPI from 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 Map to 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 } | undefined correctly 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 parentComponents list covers charts, axes, and reference components appropriately.


1-1: The JSX transform configuration is correct. The www/tsconfig.json already specifies "jsx": "react-jsx", which is the modern JSX transform that does not require a React import. Since LabelAPI.tsx is located in the www directory, 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/@consumes tags is sound. The non-null assertions on lines 114 and 123 are safe because the map entry is guaranteed to exist after the set call.


177-181: LGTM on examples handling.

Correctly retrieves examples and only adds format when 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.

Comment thread omnidoc/generateApiDoc.ts Outdated
Comment thread www/src/views/APIViewNew.tsx Outdated
@codecov

codecov Bot commented Dec 8, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.91%. Comparing base (cf325bd) to head (a1bffb9).
⚠️ Report is 1 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@github-actions

github-actions Bot commented Dec 8, 2025

Copy link
Copy Markdown
Contributor

Staging Deployment Details

These deployments will remain available for 30 days.

To update snapshots: Comment /update-snapshots on this PR to automatically update the baseline screenshots.

@codecov

codecov Bot commented Dec 8, 2025

Copy link
Copy Markdown

Bundle Report

Changes will increase total bundle size by 1.78kB (0.07%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
recharts/bundle-cjs 1.16MB 890 bytes (0.08%) ⬆️
recharts/bundle-es6 1.0MB 890 bytes (0.09%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: recharts/bundle-cjs

Assets Changed:

Asset Name Size Change Total Size Change (%)
cartesian/Bar.js 38 bytes 27.37kB 0.14%
component/Label.js 145 bytes 20.58kB 0.71%
polar/PolarRadiusAxis.js 40 bytes 10.7kB 0.38%
cartesian/ReferenceLine.js 43 bytes 10.26kB 0.42%
cartesian/YAxis.js 44 bytes 8.96kB 0.49%
cartesian/ReferenceArea.js 43 bytes 7.71kB 0.56%
cartesian/XAxis.js 44 bytes 7.52kB 0.59%
cartesian/ReferenceDot.js 43 bytes 6.9kB 0.63%
cartesian/BarStack.js 29 bytes 5.74kB 0.51%
zIndex/ZIndexLayer.js 19 bytes 3.37kB 0.57%
chart/RadialBarChart.js 42 bytes 3.15kB 1.35%
chart/RadarChart.js 42 bytes 3.11kB 1.37%
chart/PieChart.js 42 bytes 3.09kB 1.38%
chart/ComposedChart.js 46 bytes 1.43kB 3.32%
chart/ScatterChart.js 46 bytes 1.43kB 3.33%
chart/FunnelChart.js 46 bytes 1.43kB 3.34%
chart/BarChart.js 46 bytes 1.42kB 3.35%
chart/AreaChart.js 46 bytes 1.42kB 3.36%
chart/LineChart.js 46 bytes 1.42kB 3.36%
view changes for bundle: recharts/bundle-es6

Assets Changed:

Asset Name Size Change Total Size Change (%)
cartesian/Bar.js 38 bytes 25.66kB 0.15%
component/Label.js 145 bytes 18.72kB 0.78%
polar/PolarRadiusAxis.js 40 bytes 9.35kB 0.43%
cartesian/ReferenceLine.js 43 bytes 8.9kB 0.49%
cartesian/YAxis.js 44 bytes 7.58kB 0.58%
cartesian/ReferenceArea.js 43 bytes 6.54kB 0.66%
cartesian/XAxis.js 44 bytes 6.18kB 0.72%
cartesian/ReferenceDot.js 43 bytes 5.78kB 0.75%
cartesian/BarStack.js 29 bytes 4.55kB 0.64%
zIndex/ZIndexLayer.js 19 bytes 3.16kB 0.6%
chart/RadialBarChart.js 42 bytes 2.26kB 1.9%
chart/RadarChart.js 42 bytes 2.23kB 1.92%
chart/PieChart.js 42 bytes 2.23kB 1.92%
chart/ComposedChart.js 46 bytes 619 bytes 8.03% ⚠️
chart/BarChart.js 46 bytes 617 bytes 8.06% ⚠️
chart/ScatterChart.js 46 bytes 617 bytes 8.06% ⚠️
chart/FunnelChart.js 46 bytes 615 bytes 8.08% ⚠️
chart/AreaChart.js 46 bytes 611 bytes 8.14% ⚠️
chart/LineChart.js 46 bytes 611 bytes 8.14% ⚠️

@github-actions

github-actions Bot commented Dec 8, 2025

Copy link
Copy Markdown
Contributor

Staging Deployment Details

These deployments will remain available for 30 days.

To update snapshots: Comment /update-snapshots on this PR to automatically update the baseline screenshots.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (3)
www/src/docs/api/ZIndexLayerAPI.tsx (1)

21-39: Consider aligning the zIndex prop type with the actual component signature.

The actual ZIndexLayerProps in src/zIndex/ZIndexLayer.tsx defines zIndex: number | undefined, but here the type is documented as just 'number'. While the description mentions the undefined case (Line 34), the type field could be more precise.

Also, with isOptional: false (Line 24), this suggests zIndex is required, yet the component accepts undefined. Consider whether this should be isOptional: true with type 'number | undefined' for consistency.

omnidoc/generateApiDoc.ts (2)

187-196: The as type assertion could be avoided.

Per coding guidelines, as type assertions should be avoided. The assertion here is used to narrow the type for JSON serialization. Consider defining the defaultVal type more precisely in the ApiProps type 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 ApiProps type to properly type defaultVal to match what getDefaultValueOf returns. Based on coding guidelines, prefer refining types over using assertions.


99-129: Consider simplifying the Map access pattern.

The has() check followed by get()! 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

📥 Commits

Reviewing files that changed from the base of the PR and between 86ad200 and a1bffb9.

⛔ Files ignored due to path filters (1)
  • www/test/__snapshots__/navigation.spec.ts.snap is 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 use any type (implicit or explicit) in TypeScript code
Prefer unknown over any and 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 use as type assertions in TypeScript; the only exception is as const

Files:

  • src/zIndex/ZIndexLayer.tsx
  • www/src/docs/api/ZIndexLayerAPI.tsx
  • www/src/docs/api/BarStackAPI.tsx
  • www/src/docs/apiCates.ts
  • www/src/docs/apiExamples/index.tsx
  • www/src/docs/apiExamples/ZIndexLayer/index.tsx
  • omnidoc/readApiDoc.spec.ts
  • omnidoc/generateApiDoc.ts
**/*.{js,ts,tsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Ensure code lints by running npm run lint and follows Airbnb's Style Guide

Files:

  • src/zIndex/ZIndexLayer.tsx
  • www/src/docs/api/ZIndexLayerAPI.tsx
  • www/src/docs/api/BarStackAPI.tsx
  • www/src/docs/apiCates.ts
  • www/src/docs/apiExamples/index.tsx
  • www/src/docs/apiExamples/ZIndexLayer/index.tsx
  • omnidoc/readApiDoc.spec.ts
  • omnidoc/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 recharts must use the public API entry point; imports from internal paths like recharts/types/* or recharts/src/* are not allowed

Files:

  • src/zIndex/ZIndexLayer.tsx
  • www/src/docs/api/ZIndexLayerAPI.tsx
  • www/src/docs/api/BarStackAPI.tsx
  • www/src/docs/apiCates.ts
  • www/src/docs/apiExamples/index.tsx
  • www/src/docs/apiExamples/ZIndexLayer/index.tsx
  • omnidoc/readApiDoc.spec.ts
  • omnidoc/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.tsx rather than running all tests with npm 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 ZIndexLayer component. 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 ZIndexLayer entry is properly integrated into the allApiExamples registry.

Also applies to: 49-49

www/src/docs/apiCates.ts (1)

20-30: LGTM!

The ZIndexLayer component is appropriately categorized under general-components, and the multi-line formatting improves readability.

omnidoc/readApiDoc.spec.ts (1)

57-57: LGTM!

The inline snapshot correctly reflects the addition of ZIndexLayer to the public API surface.

www/src/docs/apiExamples/ZIndexLayer/index.tsx (1)

1-11: LGTM!

The new examples file follows the established pattern. The PrahaMetro component is a good choice for demonstrating ZIndexLayer functionality, 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.4 tag properly documents the version availability, and the formatting with backticks around z-index improves readability.

omnidoc/generateApiDoc.ts (3)

131-149: LGTM!

The generateComponentDescription function properly handles the @since tag with the sinceTag?.text guard, addressing the previous review concern about potential "undefined" text in descriptions.


24-30: LGTM!

The addition of Label and ZIndexLayer to OMNIDOC_AUTOMATED_API_DOCS_COMPONENTS enables automated API documentation generation for these components.


154-158: No breaking change impact: generateApiDoc is not imported or used externally.

The search confirms that generateApiDoc is only used internally within omnidoc/generateApiDoc.ts. While the function is exported, no other files in the codebase import it. The only external import from this file in omnidoc.spec.ts is the OMNIDOC_AUTOMATED_API_DOCS_COMPONENTS constant, not the function itself. The signature change therefore has no impact on external consumers.

Likely an incorrect or invalid review comment.

Comment on lines +59 to +65
desc: {
'en-US': (
<section>
<p>Available since Recharts 3.6</p>
</section>
),
},

@coderabbitai coderabbitai Bot Dec 9, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

# First, let's examine the ApiDoc type definition
cat www/src/docs/api/types.ts

Repository: 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.tsx

Repository: recharts/recharts

Length of output: 2463


🏁 Script executed:

# Search for BarStack introduction in git history
git log --all --oneline --grep="BarStack" | head -10

Repository: 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 -5

Repository: 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 -V

Repository: recharts/recharts

Length of output: 43


🏁 Script executed:

# Check when version 3.6 was released
git log --all --oneline --grep="3\.6" | head -5

Repository: recharts/recharts

Length of output: 378


🏁 Script executed:

# Look at the commit directly to see if it mentions version
git show 939c657 --stat

Repository: 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/null

Repository: 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).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I am preparing the documentation now, ahead of time so that it is ready for the release.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@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!

@github-actions

github-actions Bot commented Dec 9, 2025

Copy link
Copy Markdown
Contributor

Staging Deployment Details

These deployments will remain available for 30 days.

To update snapshots: Comment /update-snapshots on this PR to automatically update the baseline screenshots.

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.

2 participants