Skip to content

[Omnidoc] Add links and prop sorting, generate Area doc#6762

Merged
PavelVanecek merged 7 commits intomainfrom
omnidoc
Dec 12, 2025
Merged

[Omnidoc] Add links and prop sorting, generate Area doc#6762
PavelVanecek merged 7 commits intomainfrom
omnidoc

Conversation

@PavelVanecek
Copy link
Collaborator

@PavelVanecek PavelVanecek commented Dec 11, 2025

Description

New features in omnidoc:

  • Props are sorted
  • Allows links
  • Allows @inline to have more meaningful types online, and reuse in TypeScript

And autogenerated Area doc

Related Issue

#6069

Summary by CodeRabbit

Release Notes

  • New Features

    • Area and ZIndexLayer components now included in automated API documentation generation
    • New exported types for enhanced API surface (StackId, DataKey, SymbolType, ViewBox, CurveType)
    • Improved type documentation with inline type support
  • Documentation

    • Added context metadata to components for better documentation clarity
    • Enhanced API documentation with improved type information and prop examples

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 11, 2025

Walkthrough

This PR refactors the API documentation generation system to support inline type metadata. Key changes include updating type handling in omnidoc/readProject.ts to return structured type information with inline flags, enhancing generateApiDoc.ts to use the new type metadata, reorganizing Area API documentation files, and adding JSDoc context annotations throughout components.

Changes

Cohort / File(s) Summary
ESLint Configuration
eslint.config.mjs
Added new ESLint rule override specifically for auto-generated API docs, disabling specific rules in the generated docs target directory.
Omnidoc Core System
omnidoc/readProject.ts, omnidoc/generateApiDoc.ts
Refactored type handling: getTypeOf() now returns { name: string; isInline: boolean } instead of string; added alias symbol resolution with inline tag detection; simplifyType() now accepts isInline parameter; exported new splitTypeString() helper; added getLinksFromProp() for collecting prop examples; Area and ZIndexLayer added to automated components list.
Omnidoc Testing
omnidoc/readProject.spec.ts, omnidoc/readApiDoc.spec.ts, omnidoc/simplifyType.spec.ts
Updated test assertions to expect structured type objects instead of strings; removed obsolete Area onAnimationStart test; added new simplifyType test suite covering unions, nested structures, and inline handling.
Component JSDoc Annotations
src/cartesian/Area.tsx, src/cartesian/Bar.tsx, src/cartesian/ErrorBar.tsx, src/cartesian/Line.tsx, src/cartesian/Scatter.tsx, src/chart/AreaChart.tsx, src/chart/BarChart.tsx, src/chart/ComposedChart.tsx, src/chart/FunnelChart.tsx, src/chart/LineChart.tsx, src/chart/ScatterChart.tsx
Added JSDoc @provides and @consumes context tags to document component context interactions (e.g., CartesianChartContext, LabelListContext, ErrorBarContext, BarStackContext).
Public Type Exports
src/cartesian/Area.tsx, src/component/Label.tsx, src/component/LabelList.tsx, src/component/Text.tsx, src/shape/Curve.tsx, src/state/cartesianAxisSlice.ts, src/state/chartDataSlice.ts, src/util/ChartUtils.ts, src/util/types.ts
Added new type aliases with @inline annotations (BaseValue, LabelContentType, LabelPosition, LabelFormatter, CurveType, StackId, DataKey, SymbolType, ViewBox); extended LegendType and AreaSvgProps; narrowed Area public prop surface.
API Documentation Reorganization
www/src/docs/api/Area.ts, www/src/docs/api/AreaAPI.tsx
Deleted manually-maintained Area API file; created auto-generated replacement with comprehensive props metadata, component relationships, and examples.
API Documentation Updates
www/src/docs/api/BarStackAPI.tsx, www/src/docs/api/LabelAPI.tsx, www/src/docs/api/TextAPI.tsx, www/src/docs/api/ZIndexLayerAPI.tsx, www/src/docs/api/index.ts
Updated prop type declarations for radius (BarStack), label fields (content, formatter, position, viewBox); expanded text anchor types; reordered and clarified ZIndexLayer props; updated import references for new AreaAPI module.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

  • omnidoc/readProject.ts: Core logic refactoring with alias symbol resolution and inline type detection; complex type transformation requiring careful validation
  • omnidoc/generateApiDoc.ts: Substantial changes to type handling, prop example collection, and component automation; integration with new type metadata object format
  • www/src/docs/api/AreaAPI.tsx: Large, detailed API documentation requiring verification of prop descriptions, defaults, and component relationships
  • Type system changes across 8+ files: Widespread type signature updates and new exports requiring consistency checks; verify @inline annotation correctness and impact on documentation generation

Possibly related PRs

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 12.50% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description check ❓ Inconclusive The PR description covers the main features added and references the related issue, but lacks detail on motivation, testing approach, and type of change classification. Expand description with motivation/context for the features, testing details, and mark appropriate change type checkboxes to provide reviewers with complete context.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly summarizes the main changes: adding links and prop sorting features to omnidoc, plus generating Area documentation. It directly relates to the substantial changeset.
✨ 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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🧹 Nitpick comments (4)
www/src/docs/api/index.ts (1)

54-54: Inconsistent file extension in import path.

This import explicitly includes the .tsx extension, while all other imports in this file omit file extensions. Consider removing the extension for consistency:

-import { AreaAPI } from './AreaAPI.tsx';
+import { AreaAPI } from './AreaAPI';
omnidoc/simplifyType.spec.ts (1)

9-14: Consider removing or updating the outdated comment.

The comment on line 11 references "Current buggy behavior" but the test now expects the function to work correctly. This comment may be misleading for future readers.

  it('should handle unions with object types containing unions', () => {
    const input = '"top" | "left" | { x?: number | Percent; y?: number | Percent; }';
-   // Current buggy behavior would likely return a mangled string
-   // Expected behavior:
    expect(simplifyType(input, true)).toBe(input);
  });
omnidoc/readProject.ts (1)

568-572: Consider more descriptive variable names.

The variables declarations2 and declaration0 could be renamed for clarity:

-              const declarations2 = aliasSymbol.getDeclarations();
-              const declaration0 = declarations2[0];
-              if (declarations2.length > 0 && Node.isTypeAliasDeclaration(declaration0)) {
-                return declaration0.getTypeNode()?.getText() ?? part.getText();
+              const aliasDeclarations = aliasSymbol.getDeclarations();
+              const firstAliasDeclaration = aliasDeclarations[0];
+              if (aliasDeclarations.length > 0 && Node.isTypeAliasDeclaration(firstAliasDeclaration)) {
+                return firstAliasDeclaration.getTypeNode()?.getText() ?? part.getText();
               }
omnidoc/generateApiDoc.ts (1)

241-241: Redundant condition in URL check.

Since 'https' starts with 'http', the second condition is always covered by the first.

-      const isExternal = url.startsWith('http') || url.startsWith('https');
+      const isExternal = url.startsWith('http');
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b8f09a4 and 6bf5c05.

📒 Files selected for processing (32)
  • eslint.config.mjs (2 hunks)
  • omnidoc/generateApiDoc.ts (9 hunks)
  • omnidoc/readApiDoc.spec.ts (0 hunks)
  • omnidoc/readProject.spec.ts (1 hunks)
  • omnidoc/readProject.ts (2 hunks)
  • omnidoc/simplifyType.spec.ts (1 hunks)
  • src/cartesian/Area.tsx (5 hunks)
  • src/cartesian/Bar.tsx (1 hunks)
  • src/cartesian/ErrorBar.tsx (1 hunks)
  • src/cartesian/Line.tsx (1 hunks)
  • src/cartesian/Scatter.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/ScatterChart.tsx (1 hunks)
  • src/component/Label.tsx (2 hunks)
  • src/component/LabelList.tsx (2 hunks)
  • src/component/Text.tsx (1 hunks)
  • src/shape/Curve.tsx (2 hunks)
  • src/state/cartesianAxisSlice.ts (1 hunks)
  • src/state/chartDataSlice.ts (1 hunks)
  • src/util/ChartUtils.ts (1 hunks)
  • src/util/types.ts (6 hunks)
  • www/src/docs/api/Area.ts (0 hunks)
  • www/src/docs/api/AreaAPI.tsx (1 hunks)
  • www/src/docs/api/BarStackAPI.tsx (2 hunks)
  • www/src/docs/api/LabelAPI.tsx (5 hunks)
  • www/src/docs/api/TextAPI.tsx (2 hunks)
  • www/src/docs/api/ZIndexLayerAPI.tsx (1 hunks)
  • www/src/docs/api/index.ts (2 hunks)
💤 Files with no reviewable changes (2)
  • www/src/docs/api/Area.ts
  • omnidoc/readApiDoc.spec.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:

  • www/src/docs/api/BarStackAPI.tsx
  • src/state/chartDataSlice.ts
  • src/component/Label.tsx
  • src/cartesian/Scatter.tsx
  • src/state/cartesianAxisSlice.ts
  • src/shape/Curve.tsx
  • src/chart/BarChart.tsx
  • omnidoc/readProject.ts
  • src/chart/ComposedChart.tsx
  • src/chart/LineChart.tsx
  • src/chart/FunnelChart.tsx
  • www/src/docs/api/AreaAPI.tsx
  • src/component/LabelList.tsx
  • omnidoc/simplifyType.spec.ts
  • src/cartesian/Line.tsx
  • src/chart/AreaChart.tsx
  • www/src/docs/api/TextAPI.tsx
  • src/cartesian/Bar.tsx
  • src/util/ChartUtils.ts
  • src/component/Text.tsx
  • www/src/docs/api/index.ts
  • omnidoc/readProject.spec.ts
  • src/cartesian/Area.tsx
  • src/cartesian/ErrorBar.tsx
  • www/src/docs/api/LabelAPI.tsx
  • src/chart/ScatterChart.tsx
  • src/util/types.ts
  • www/src/docs/api/ZIndexLayerAPI.tsx
  • 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:

  • www/src/docs/api/BarStackAPI.tsx
  • src/state/chartDataSlice.ts
  • src/component/Label.tsx
  • src/cartesian/Scatter.tsx
  • src/state/cartesianAxisSlice.ts
  • src/shape/Curve.tsx
  • src/chart/BarChart.tsx
  • omnidoc/readProject.ts
  • src/chart/ComposedChart.tsx
  • src/chart/LineChart.tsx
  • src/chart/FunnelChart.tsx
  • www/src/docs/api/AreaAPI.tsx
  • src/component/LabelList.tsx
  • omnidoc/simplifyType.spec.ts
  • src/cartesian/Line.tsx
  • src/chart/AreaChart.tsx
  • www/src/docs/api/TextAPI.tsx
  • src/cartesian/Bar.tsx
  • src/util/ChartUtils.ts
  • src/component/Text.tsx
  • www/src/docs/api/index.ts
  • omnidoc/readProject.spec.ts
  • src/cartesian/Area.tsx
  • src/cartesian/ErrorBar.tsx
  • www/src/docs/api/LabelAPI.tsx
  • src/chart/ScatterChart.tsx
  • src/util/types.ts
  • www/src/docs/api/ZIndexLayerAPI.tsx
  • omnidoc/generateApiDoc.ts
**/*.{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:

  • www/src/docs/api/BarStackAPI.tsx
  • src/state/chartDataSlice.ts
  • src/component/Label.tsx
  • src/cartesian/Scatter.tsx
  • src/state/cartesianAxisSlice.ts
  • src/shape/Curve.tsx
  • src/chart/BarChart.tsx
  • omnidoc/readProject.ts
  • src/chart/ComposedChart.tsx
  • src/chart/LineChart.tsx
  • src/chart/FunnelChart.tsx
  • www/src/docs/api/AreaAPI.tsx
  • src/component/LabelList.tsx
  • omnidoc/simplifyType.spec.ts
  • src/cartesian/Line.tsx
  • src/chart/AreaChart.tsx
  • www/src/docs/api/TextAPI.tsx
  • src/cartesian/Bar.tsx
  • src/util/ChartUtils.ts
  • src/component/Text.tsx
  • www/src/docs/api/index.ts
  • omnidoc/readProject.spec.ts
  • src/cartesian/Area.tsx
  • src/cartesian/ErrorBar.tsx
  • www/src/docs/api/LabelAPI.tsx
  • src/chart/ScatterChart.tsx
  • src/util/types.ts
  • www/src/docs/api/ZIndexLayerAPI.tsx
  • 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/state/chartDataSlice.ts
  • src/component/Label.tsx
  • src/cartesian/Scatter.tsx
  • src/state/cartesianAxisSlice.ts
  • src/shape/Curve.tsx
  • src/chart/BarChart.tsx
  • src/chart/ComposedChart.tsx
  • src/chart/LineChart.tsx
  • src/chart/FunnelChart.tsx
  • src/component/LabelList.tsx
  • src/cartesian/Line.tsx
  • src/chart/AreaChart.tsx
  • src/cartesian/Bar.tsx
  • src/util/ChartUtils.ts
  • src/component/Text.tsx
  • src/cartesian/Area.tsx
  • src/cartesian/ErrorBar.tsx
  • src/chart/ScatterChart.tsx
  • src/util/types.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/simplifyType.spec.ts
  • omnidoc/readProject.spec.ts
🧠 Learnings (7)
📚 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/state/chartDataSlice.ts
  • src/state/cartesianAxisSlice.ts
  • src/util/ChartUtils.ts
  • src/chart/ScatterChart.tsx
📚 Learning: 2025-12-08T08:23:26.219Z
Learnt from: PavelVanecek
Repo: recharts/recharts PR: 6750
File: src/state/selectors/axisSelectors.ts:593-602
Timestamp: 2025-12-08T08:23:26.219Z
Learning: In the recharts codebase, `DataKey<any>` is an intentional exception to the "no any" rule while proper typing is being developed. This should not be flagged in reviews.

Applied to files:

  • src/state/chartDataSlice.ts
  • src/util/types.ts
📚 Learning: 2025-11-19T14:08:01.728Z
Learnt from: PavelVanecek
Repo: recharts/recharts PR: 6659
File: www/src/components/GuideView/Performance/index.tsx:232-250
Timestamp: 2025-11-19T14:08:01.728Z
Learning: In Recharts version 3.4.2, object-as-prop optimizations were introduced to reduce unnecessary re-renders when new object references are passed as props. This affects the recommendation for the `react-perf/jsx-no-new-object-as-prop` ESLint rule.

Applied to files:

  • src/chart/BarChart.tsx
📚 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 **/*.{ts,tsx} : Type function parameters and return values explicitly in TypeScript, do not rely on implicit any or inference; exceptions are React components and trivial functions

Applied to files:

  • omnidoc/readProject.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:

  • src/chart/LineChart.tsx
  • www/src/docs/api/index.ts
  • src/chart/ScatterChart.tsx
📚 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/simplifyType.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 : Update Storybook stories when APIs have been changed to ensure they work as expected

Applied to files:

  • omnidoc/generateApiDoc.ts
🧬 Code graph analysis (4)
www/src/docs/api/AreaAPI.tsx (1)
www/src/docs/api/types.ts (1)
  • ApiDoc (21-27)
omnidoc/simplifyType.spec.ts (1)
omnidoc/generateApiDoc.ts (1)
  • simplifyType (76-141)
src/cartesian/Area.tsx (1)
src/util/ChartUtils.ts (1)
  • StackId (480-480)
omnidoc/generateApiDoc.ts (2)
omnidoc/readProject.ts (1)
  • getAllTagTexts (42-53)
www/src/docs/api/types.ts (1)
  • PropExample (4-8)
⏰ 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 (40)
src/component/LabelList.tsx (2)

128-131: Documentation annotations align with PR objectives.

The @inline JSDoc annotation on the public ImplicitLabelListType export enables the type to be displayed inline in generated documentation and supports type reuse in TypeScript, as intended by the PR.


151-153: Context consumption is accurately documented.

The @consumes LabelListContext annotation correctly documents that the LabelList function consumes context via the useCartesianLabelListContext() and usePolarLabelListContext() calls (lines 156–157). This supports the omnidoc generation enhancements described in the PR.

src/state/chartDataSlice.ts (1)

11-12: LGTM! The @inline JSDoc annotation aligns with the PR's omnidoc enhancements. All types are properly defined using unknown rather than any, and all function parameters and return values are explicitly typed as per coding guidelines.

src/chart/ComposedChart.tsx (1)

9-12: JSDoc context annotation looks correct

ComposedChart is just a thin wrapper around CartesianChart, so documenting that it provides CartesianChartContext is accurate and keeps API docs aligned with other cartesian chart components.

src/cartesian/Line.tsx (1)

869-873: Line’s provides/consumes metadata matches implementation

Line wraps its render tree in LineLabelListProvider and uses cartesian chart layout/plot-area hooks, so documenting it as providing LabelListContext and consuming CartesianChartContext matches the actual behavior.

src/chart/AreaChart.tsx (1)

9-12: Accurate @provides tag for AreaChart

AreaChart delegates to CartesianChart, which owns the cartesian context, so marking AreaChart as providing CartesianChartContext is a correct and useful doc annotation.

src/component/Text.tsx (1)

58-75: Good use of @inline on shared Text helper types

Annotating TextAnchor, TextVerticalAnchor, and RenderableText with @inline is consistent with how these unions are used and should improve the generated API docs without affecting runtime behavior.

eslint.config.mjs (1)

430-437: Reasonable ESLint override for generated API docs

Scoping generatedApiDocsOverrides to www/src/docs/api/** and disabling only no-template-curly-in-string is a minimal, well-targeted relaxation for autogenerated files, and its placement in the export array ensures it takes effect after the general website rules.

Also applies to: 465-465

src/cartesian/ErrorBar.tsx (1)

281-285: Correctly documenting ErrorBar as consuming ErrorBarContext

Since ErrorBarInternal / ErrorBarImpl rely on useErrorBarContext, marking the public ErrorBar component as @consumes ErrorBarContext correctly reflects its dependency in the generated docs.

src/cartesian/Bar.tsx (1)

1075-1081: Bar’s context provides/consumes tags align with implementation

Bar sets up SetErrorBarContext, uses BarLabelListProvider (backed by CartesianLabelListContextProvider), and already depends on cartesian layout and bar stack hooks, so the new @provides ErrorBarContext / @provides LabelListContext annotations complement the existing @consumes tags accurately.

src/chart/LineChart.tsx (1)

9-12: LineChart context JSDoc matches behavior

LineChart simply delegates to CartesianChart, so adding @provides CartesianChartContext correctly advertises that it provides the cartesian chart context for consumers.

www/src/docs/api/BarStackAPI.tsx (1)

9-9: LGTM: Type definitions made explicit.

The prop types are now explicit inline unions rather than type references, improving documentation clarity and aligning with the PR's inline type metadata goals.

Also applies to: 40-40

src/chart/BarChart.tsx (1)

11-11: LGTM: Context provider documented.

The @provides annotation adds valuable metadata about the context this component provides, improving API documentation without affecting runtime behavior.

src/shape/Curve.tsx (1)

60-79: LGTM: Enhanced type documentation.

The @inline annotation enables better documentation generation by expanding the CurveType union inline, and the added @link and @see tags provide helpful references to d3-shape documentation and examples.

Also applies to: 109-110

www/src/docs/api/TextAPI.tsx (1)

171-171: LGTM: Type definitions made explicit.

The prop types are now explicit string literal unions rather than type references, improving documentation clarity and consistency with the PR's inline type metadata approach.

Also applies to: 193-193

src/util/types.ts (1)

60-65: LGTM: Inline annotations added for documentation generation.

The @inline annotations enable the omnidoc system to expand these types inline in generated documentation, improving API documentation readability. The expanded LegendType union with 'line', 'plainline', and 'rect' is an additive, backward-compatible change.

Also applies to: 73-76, 78-92, 635-640, 890-893, 1024-1051, 1070-1100

src/util/ChartUtils.ts (1)

476-480: LGTM: New public type alias improves API clarity.

The exported StackId type makes the stack identifier type explicit and reusable, improving API documentation and type consistency across the codebase.

src/state/cartesianAxisSlice.ts (1)

8-11: LGTM: Inline annotation added for documentation.

The @inline annotation enables better documentation generation for the AxisId type, consistent with the broader pattern across the codebase.

src/chart/ScatterChart.tsx (1)

11-11: LGTM: Context provider documented.

The @provides annotation adds valuable metadata about the context this component provides, improving API documentation without affecting runtime behavior.

www/src/docs/api/index.ts (1)

69-69: LGTM!

The Area entry correctly references the new AreaAPI documentation module, consistent with the PR's objective to generate Area component documentation.

src/cartesian/Scatter.tsx (1)

814-818: LGTM!

The JSDoc annotations correctly document the context relationships for the Scatter component, aligning with similar annotations added to other chart components in this PR.

src/chart/FunnelChart.tsx (1)

9-12: LGTM!

The JSDoc annotation correctly documents that FunnelChart provides CartesianChartContext, consistent with the broader PR effort to document context relationships across chart components.

omnidoc/simplifyType.spec.ts (1)

1-19: LGTM on test coverage!

Good test coverage for the simplifyType function, including edge cases for simple unions, complex object types with unions, and nested structures with the isInline parameter.

omnidoc/readProject.spec.ts (1)

925-946: LGTM!

The updated tests correctly validate the new structured return type from getTypeOf() and the inline type expansion feature. Good use of partial matchers for the complex union type assertions.

www/src/docs/api/ZIndexLayerAPI.tsx (1)

5-39: LGTM!

The prop reordering prioritizes the required zIndex prop over the optional children prop, which improves the API documentation structure. The descriptions clearly explain the z-index layering semantics and portal behavior.

src/component/Label.tsx (2)

33-36: LGTM!

The @inline annotation and export of LabelContentType enable the omnidoc system to generate expanded inline type documentation, improving the public API surface.


67-75: LGTM!

Good addition of LabelPosition and LabelFormatter type exports with @inline annotations. These provide clearer type documentation for consumers of the Label component API.

omnidoc/readProject.ts (1)

515-585: Well-structured type metadata implementation.

The enhanced getTypeOf method now returns structured type information that enables better documentation generation. The multiple fallback strategies for resolving alias symbols (lines 536-547) improve robustness.

src/cartesian/Area.tsx (5)

75-78: LGTM!

The @inline JSDoc tag and exported BaseValue type are clean additions for documentation generation purposes. The type definition is concise and correctly captures the valid baseline values.


226-226: Good refactor: Using imported StackId type.

Using the shared StackId type from src/util/ChartUtils.ts improves consistency across the codebase. This aligns the public prop type with the internal type definition.


241-243: LGTM!

The JSDoc enrichment with @link and @see tags provides valuable documentation for users. The external link to d3-shape curves and the internal example reference are appropriate.


270-273: LGTM!

Expanding the Omit to exclude additional internal props ('path', 'pathRef', 'baseLine', 'dangerouslySetInnerHTML') appropriately narrows the public API surface by hiding implementation details from consumers.


1079-1083: LGTM!

The @provides and @consumes JSDoc annotations document the context relationships, which is valuable for understanding component hierarchy and for the automated API doc generation.

www/src/docs/api/AreaAPI.tsx (1)

1-602: Overall: Comprehensive API documentation.

The documentation covers the Area component's props thoroughly with appropriate descriptions, defaults, and examples. The event handlers are extensive but correctly inherited from the SVG props.

www/src/docs/api/LabelAPI.tsx (1)

99-132: LGTM!

The expanded type definitions for parentViewBox, position, value, and viewBox provide more informative API documentation. Using concrete union types like Required<CartesianViewBox> | Required<PolarViewBox> and the detailed position literal union helps users understand the expected values.

omnidoc/generateApiDoc.ts (5)

38-71: LGTM!

The splitTypeString function correctly handles nested structures by tracking bracket depth. This is essential for parsing complex union types without splitting inside generic parameters or object types.


76-141: LGTM!

The enhanced simplifyType function with the isInline flag allows preserving complex types when the source explicitly marks them for inline documentation. The recursive handling of union parts and the simplification heuristics are reasonable.


198-253: Well-structured link extraction helper.

The getLinksFromProp function handles various JSDoc tag formats (@see, @link, {@link ...}) and correctly parses URL/name pairs with deduplication. The prefix stripping for recharts.github.io URLs is a nice touch for cleaner internal links.


317-352: Good prop sorting implementation.

The sorting prioritizes: required props → recharts props → recharts events → other props → other events, with alphabetical ordering within each category. This provides a logical structure for API documentation.


271-272: LGTM!

Using the structured typeInfo object with isInline flag enables the documentation generator to respect the @inline JSDoc annotations and preserve complex types when appropriate.

},
{
name: 'activeDot',
type: 'false | true | Function | React.JSXElementConstructor<any>>',
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Syntax error: Unbalanced angle bracket in type.

The type string has an extra closing angle bracket.

-      type: 'false | true | Function | React.JSXElementConstructor<any>>',
+      type: 'false | true | Function | React.JSXElementConstructor<any>',
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
type: 'false | true | Function | React.JSXElementConstructor<any>>',
type: 'false | true | Function | React.JSXElementConstructor<any>',
🤖 Prompt for AI Agents
In www/src/docs/api/AreaAPI.tsx around line 31, the type string has an unmatched
closing angle bracket ("type: 'false | true | Function |
React.JSXElementConstructor<any>>',"); remove the extra ">" so the generic is
balanced (React.JSXElementConstructor<any>) and update the string accordingly;
ensure the resulting string is "false | true | Function |
React.JSXElementConstructor<any>" (with proper quotes) or convert to a real
TypeScript type instead of a malformed string if appropriate.

{ name: 'data', type: 'Array<unknown>', isOptional: true },
{
name: 'dot',
type: 'false | true | Function | React.JSXElementConstructor<any>>',
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Same typo: Unbalanced angle bracket.

Same issue as with activeDot prop type.

-      type: 'false | true | Function | React.JSXElementConstructor<any>>',
+      type: 'false | true | Function | React.JSXElementConstructor<any>',
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
type: 'false | true | Function | React.JSXElementConstructor<any>>',
type: 'false | true | Function | React.JSXElementConstructor<any>',
🤖 Prompt for AI Agents
In www/src/docs/api/AreaAPI.tsx around line 122, the prop type string has an
unbalanced angle bracket ("React.JSXElementConstructor<any>>"); remove the
extraneous closing ">" so it reads "React.JSXElementConstructor<any>" (i.e., fix
the typo by balancing the generic angle brackets) and verify the surrounding
quote and punctuation remain correct.

{ name: 'isRange', type: 'boolean', isOptional: true },
{
name: 'label',
type: 'false | true | ReactNode | Function | React.JSXElementConstructor<any>> | Props',
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Unbalanced angle bracket in label type.

The type string has unbalanced brackets.

-      type: 'false | true | ReactNode | Function | React.JSXElementConstructor<any>> | Props',
+      type: 'false | true | ReactNode | Function | React.JSXElementConstructor<any> | Props',
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
type: 'false | true | ReactNode | Function | React.JSXElementConstructor<any>> | Props',
type: 'false | true | ReactNode | Function | React.JSXElementConstructor<any> | Props',
🤖 Prompt for AI Agents
In www/src/docs/api/AreaAPI.tsx around line 174, the type string for `label`
contains an extra/unbalanced angle bracket; remove the stray '>' (or otherwise
balance the generic angle brackets) and ensure the union parts are separated
correctly so the entire type string has matching '<' and '>' for any
React.JSXElementConstructor generic and no dangling bracket at the end.

{ name: 'onWheel', type: 'WheelEventHandler<P, T>', isOptional: true },
{ name: 'onWheelCapture', type: 'WheelEventHandler<P, T>', isOptional: true },
],
parentComponents: ['AreaChart', 'BarChart', 'ComposedChart', 'FunnelChart', 'LineChart', 'ScatterChart'],
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cat -n src/cartesian/Area.tsx | sed -n '850,870p'

Repository: recharts/recharts

Length of output: 872


Correct parentComponents list to match implementation.

The Area component explicitly returns null if chartName is not 'AreaChart' or 'ComposedChart' (lines 859-862 in src/cartesian/Area.tsx). The list should only include 'AreaChart' and 'ComposedChart'; remove BarChart, FunnelChart, LineChart, and ScatterChart.

🤖 Prompt for AI Agents
In www/src/docs/api/AreaAPI.tsx around line 600, the parentComponents array is
incorrect — it currently includes BarChart, FunnelChart, LineChart, and
ScatterChart but the Area component only returns content for 'AreaChart' and
'ComposedChart'; update the parentComponents list to contain only 'AreaChart'
and 'ComposedChart' so the docs match the component implementation.

@codecov
Copy link

codecov bot commented Dec 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.74%. Comparing base (ee0b17b) to head (6bf5c05).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6762      +/-   ##
==========================================
+ Coverage   93.70%   93.74%   +0.04%     
==========================================
  Files         515      515              
  Lines       43011    43336     +325     
  Branches     5018     5018              
==========================================
+ Hits        40302    40627     +325     
  Misses       2703     2703              
  Partials        6        6              

☔ 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.

@github-actions
Copy link
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.

{ name: 'onSeeked', type: 'ReactEventHandler<P, T>', isOptional: true },
{ name: 'onSeekedCapture', type: 'ReactEventHandler<P, T>', isOptional: true },
{ name: 'onSeeking', type: 'ReactEventHandler<P, T>', isOptional: true },
{ name: 'onSeekingCapture', type: 'ReactEventHandler<P, T>', isOptional: true },
Copy link
Member

Choose a reason for hiding this comment

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

do we want all these events in here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not entirely necessary but also why not. They're sorted at the bottom, and not hiding anything interesting below.

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