Skip to content

Export TooltipIndex and other types from public API, add ESLint rule to prevent internal imports#6676

Merged
PavelVanecek merged 4 commits intomainfrom
copilot/export-tooltipindex-and-eslint-rule
Dec 6, 2025
Merged

Export TooltipIndex and other types from public API, add ESLint rule to prevent internal imports#6676
PavelVanecek merged 4 commits intomainfrom
copilot/export-tooltipindex-and-eslint-rule

Conversation

Copy link
Contributor

Copilot AI commented Nov 23, 2025

Rebase Complete and Ready for Merge

  • Rebased on latest origin/main (commit 2ab4c23, 48 new commits)
  • Resolved merge conflict in CustomActiveShapePieChart.tsx (added PieSectorDataItem import)
  • Fixed 5 ScatterChart example files from PR Convert couple of storybooks to unit tests and examples #6669:
    • www/src/docs/exampleComponents/ScatterChart/BubbleChart.tsx
    • www/src/docs/exampleComponents/ScatterChart/JointLineScatterChart.tsx
    • www/src/docs/exampleComponents/ScatterChart/ScatterChartWithLabels.tsx
    • www/src/docs/exampleComponents/ScatterChart/SimpleScatterChart.tsx
    • www/src/docs/exampleComponents/ScatterChart/ThreeDimScatterChart.tsx
  • Improved documentation with error handling guidance
  • All linting checks pass (except pre-existing omnidoc/coloredDiff.ts)
  • All type checks pass
  • All unit tests pass (234 example component tests, 30 route tests)

Total files updated with internal import fixes: 13 files

Original prompt

This section details on the original issue you should resolve

<issue_title>Export TooltipIndex from public API and add ESLint rule to prevent internal imports</issue_title>
<issue_description>## Problem

TooltipIndex is currently being imported from an internal implementation path:

import { TooltipIndex } from 'recharts/types/state/tooltipSlice';

This path references internal implementation details that are not part of the stable public API. While the type appears in published type definitions, it is not exported from the main package entry points (recharts).

Proposed Solution

  1. Export TooltipIndex from public API: Re-export TooltipIndex from the main package entry point (src/index.ts) to make it part of the stable public API.

  2. Add ESLint rule: Implement an ESLint rule to prevent imports from internal paths like recharts/types/state/* to avoid regressions in the future. The rule should enforce that all imports from recharts use only the public entry point src/index.ts.

Context

This issue was identified in PR #6669 where multiple example components import TooltipIndex from the internal path:

  • www/src/docs/exampleComponents/ScatterChart/BubbleChart.tsx
  • www/src/docs/exampleComponents/ScatterChart/JointLineScatterChart.tsx
  • www/src/docs/exampleComponents/ScatterChart/ScatterChartWithLabels.tsx
  • www/src/docs/exampleComponents/ScatterChart/SimpleScatterChart.tsx
  • www/src/docs/exampleComponents/ScatterChart/ThreeDimScatterChart.tsx

Related PR: #6669
Comment thread: #6669 (comment)

Acceptance Criteria

  • TooltipIndex is exported from a public entry point
  • All internal imports are updated to use the public API
  • ESLint rule is added to prevent future imports from internal paths
  • ESLint rule is documented

cc @PavelVanecek</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Summary by CodeRabbit

  • New Features

    • Expanded public API to include additional type exports for improved developer experience
  • Documentation

    • Added guidance on correct import patterns in development documentation
    • Updated all documentation examples to follow public API import conventions

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 23, 2025

Walkthrough

This PR establishes a stable public API for Recharts by exporting previously internal types through the main entry point, adding ESLint enforcement rules to prevent direct imports from internal paths, and updating all documentation examples to use the public API instead of internal implementation paths.

Changes

Cohort / File(s) Summary
Documentation & Guidelines
DEVELOPING.md
Added new "Import restrictions" guidance section detailing that all imports from recharts must use the public API entry point, with examples of valid and invalid import paths.
ESLint Configuration
eslint.config.mjs
Added new ESLint rule pattern to no-restricted-imports forbidding imports from recharts/types/* and recharts/src/*, extending the existing scoped pattern-based restriction to enforce public API usage.
Public API Exports
src/index.ts
Expanded public exports to include: TooltipIndex from state/tooltipSlice, BarRectangleItem from cartesian/Bar, TreemapNode from chart/Treemap, and DataKey and AxisInterval from util/types.
Example Components – Import Consolidation
www/src/docs/apiExamples/Funnel/FunnelExample.tsx,
www/src/docs/exampleComponents/BarChart/BarChartWithCustomizedEvent.tsx,
www/src/docs/exampleComponents/ComposedChart/BandedChart.tsx,
www/src/docs/exampleComponents/Legend/LegendEffectOpacity.tsx,
www/src/docs/exampleComponents/LineChart/LineChartAxisInterval.tsx,
www/src/docs/exampleComponents/PieChart/CustomActiveShapePieChart.tsx,
www/src/docs/exampleComponents/ScatterChart/*.tsx (5 files),
www/src/docs/exampleComponents/Tooltip/CustomContentOfTooltip.tsx,
www/src/docs/exampleComponents/TreeMap/CustomContentTreemap.tsx
Consolidated imports by moving type imports from internal paths (recharts/types/*, recharts/src/*) to the public recharts entry point. No functional or behavioral changes; only import source consolidation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Areas requiring extra attention:

  • src/index.ts – Verify all four newly exported types are properly re-exported and correctly aliased where needed (e.g., BarProps, TreemapProps)
  • eslint.config.mjs – Confirm the ESLint rule pattern correctly targets all internal paths and message is clear
  • Example files – Spot-check a few representative examples from different component types to ensure imports consolidate correctly and no symbols are missing

Possibly related PRs

Suggested reviewers

  • ckifer

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main changes: exporting TooltipIndex and other types from the public API and adding an ESLint rule to prevent internal imports, matching the primary objectives of the PR.
Description check ✅ Passed The description provides details about the rebase, merge conflict resolution, file updates, and test results, though it does not follow the template sections (Related Issue, Motivation, Testing approach, Types of changes, Checklist).
Linked Issues check ✅ Passed The PR fulfills all acceptance criteria from issue #6674: TooltipIndex is exported from src/index.ts (public entry point), all internal imports across 13 files are updated to use the public API, an ESLint rule is added to eslint.config.mjs to prevent internal recharts paths, and documentation guidance is added to DEVELOPING.md.
Out of Scope Changes check ✅ Passed All changes are directly related to the linked issue #6674 objectives: exporting types from the public API, adding ESLint rules, updating example files to use public imports, and documenting the import restrictions. No unrelated changes detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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 copilot/export-tooltipindex-and-eslint-rule

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2ab4c23 and 63b225d.

📒 Files selected for processing (16)
  • DEVELOPING.md (1 hunks)
  • eslint.config.mjs (1 hunks)
  • src/index.ts (4 hunks)
  • www/src/docs/apiExamples/Funnel/FunnelExample.tsx (1 hunks)
  • www/src/docs/exampleComponents/BarChart/BarChartWithCustomizedEvent.tsx (1 hunks)
  • www/src/docs/exampleComponents/ComposedChart/BandedChart.tsx (1 hunks)
  • www/src/docs/exampleComponents/Legend/LegendEffectOpacity.tsx (1 hunks)
  • www/src/docs/exampleComponents/LineChart/LineChartAxisInterval.tsx (1 hunks)
  • www/src/docs/exampleComponents/PieChart/CustomActiveShapePieChart.tsx (1 hunks)
  • www/src/docs/exampleComponents/ScatterChart/BubbleChart.tsx (1 hunks)
  • www/src/docs/exampleComponents/ScatterChart/JointLineScatterChart.tsx (1 hunks)
  • www/src/docs/exampleComponents/ScatterChart/ScatterChartWithLabels.tsx (1 hunks)
  • www/src/docs/exampleComponents/ScatterChart/SimpleScatterChart.tsx (1 hunks)
  • www/src/docs/exampleComponents/ScatterChart/ThreeDimScatterChart.tsx (1 hunks)
  • www/src/docs/exampleComponents/Tooltip/CustomContentOfTooltip.tsx (1 hunks)
  • www/src/docs/exampleComponents/TreeMap/CustomContentTreemap.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (DEVELOPING.md)

Run type checking on the codebase using npm run check-types

**/*.{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/exampleComponents/ComposedChart/BandedChart.tsx
  • www/src/docs/exampleComponents/ScatterChart/SimpleScatterChart.tsx
  • www/src/docs/apiExamples/Funnel/FunnelExample.tsx
  • www/src/docs/exampleComponents/Tooltip/CustomContentOfTooltip.tsx
  • src/index.ts
  • www/src/docs/exampleComponents/ScatterChart/BubbleChart.tsx
  • www/src/docs/exampleComponents/PieChart/CustomActiveShapePieChart.tsx
  • www/src/docs/exampleComponents/ScatterChart/ThreeDimScatterChart.tsx
  • www/src/docs/exampleComponents/ScatterChart/JointLineScatterChart.tsx
  • www/src/docs/exampleComponents/BarChart/BarChartWithCustomizedEvent.tsx
  • www/src/docs/exampleComponents/LineChart/LineChartAxisInterval.tsx
  • www/src/docs/exampleComponents/TreeMap/CustomContentTreemap.tsx
  • www/src/docs/exampleComponents/ScatterChart/ScatterChartWithLabels.tsx
  • www/src/docs/exampleComponents/Legend/LegendEffectOpacity.tsx
**/*.{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/exampleComponents/ComposedChart/BandedChart.tsx
  • www/src/docs/exampleComponents/ScatterChart/SimpleScatterChart.tsx
  • www/src/docs/apiExamples/Funnel/FunnelExample.tsx
  • www/src/docs/exampleComponents/Tooltip/CustomContentOfTooltip.tsx
  • src/index.ts
  • www/src/docs/exampleComponents/ScatterChart/BubbleChart.tsx
  • www/src/docs/exampleComponents/PieChart/CustomActiveShapePieChart.tsx
  • www/src/docs/exampleComponents/ScatterChart/ThreeDimScatterChart.tsx
  • www/src/docs/exampleComponents/ScatterChart/JointLineScatterChart.tsx
  • www/src/docs/exampleComponents/BarChart/BarChartWithCustomizedEvent.tsx
  • www/src/docs/exampleComponents/LineChart/LineChartAxisInterval.tsx
  • www/src/docs/exampleComponents/TreeMap/CustomContentTreemap.tsx
  • www/src/docs/exampleComponents/ScatterChart/ScatterChartWithLabels.tsx
  • www/src/docs/exampleComponents/Legend/LegendEffectOpacity.tsx
src/**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (DEVELOPING.md)

Run ESLint and Prettier on the codebase using npm run lint

Files:

  • src/index.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/index.ts
🧠 Learnings (14)
📓 Common learnings
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.
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.
📚 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:

  • DEVELOPING.md
  • www/src/docs/exampleComponents/ComposedChart/BandedChart.tsx
  • www/src/docs/exampleComponents/ScatterChart/SimpleScatterChart.tsx
  • www/src/docs/apiExamples/Funnel/FunnelExample.tsx
  • www/src/docs/exampleComponents/Tooltip/CustomContentOfTooltip.tsx
  • src/index.ts
  • www/src/docs/exampleComponents/ScatterChart/BubbleChart.tsx
  • www/src/docs/exampleComponents/PieChart/CustomActiveShapePieChart.tsx
  • www/src/docs/exampleComponents/ScatterChart/ThreeDimScatterChart.tsx
  • eslint.config.mjs
  • www/src/docs/exampleComponents/ScatterChart/JointLineScatterChart.tsx
  • www/src/docs/exampleComponents/BarChart/BarChartWithCustomizedEvent.tsx
  • www/src/docs/exampleComponents/LineChart/LineChartAxisInterval.tsx
  • www/src/docs/exampleComponents/TreeMap/CustomContentTreemap.tsx
  • www/src/docs/exampleComponents/ScatterChart/ScatterChartWithLabels.tsx
  • www/src/docs/exampleComponents/Legend/LegendEffectOpacity.tsx
📚 Learning: 2025-11-25T01:22:48.289Z
Learnt from: CR
Repo: recharts/recharts PR: 0
File: DEVELOPING.md:0-0
Timestamp: 2025-11-25T01:22:48.289Z
Learning: Applies to **/*.{ts,tsx} : Run type checking on the codebase using `npm run check-types`

Applied to files:

  • DEVELOPING.md
📚 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 **/*.{js,ts,tsx} : Ensure code lints by running `npm run lint` and follows Airbnb's Style Guide

Applied to files:

  • DEVELOPING.md
📚 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:

  • DEVELOPING.md
📚 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:

  • DEVELOPING.md
📚 Learning: 2025-11-25T01:22:48.289Z
Learnt from: CR
Repo: recharts/recharts PR: 0
File: DEVELOPING.md:0-0
Timestamp: 2025-11-25T01:22:48.289Z
Learning: Applies to src/**/*.{js,jsx,ts,tsx} : Run ESLint and Prettier on the codebase using `npm run lint`

Applied to files:

  • DEVELOPING.md
📚 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: Ensure the test suite passes by running `npm run test` before submitting a pull request

Applied to files:

  • DEVELOPING.md
📚 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} : Do not use `as` type assertions in TypeScript; the only exception is `as const`

Applied to files:

  • DEVELOPING.md
📚 Learning: 2025-11-25T01:23:14.977Z
Learnt from: CR
Repo: recharts/recharts PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T01:23:14.977Z
Learning: Applies to **/*.spec.{ts,tsx} : 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`

Applied to files:

  • DEVELOPING.md
📚 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/**/*.spec.{ts,tsx} : Aim for 100% unit test code coverage when writing new code

Applied to files:

  • DEVELOPING.md
📚 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:

  • www/src/docs/exampleComponents/ComposedChart/BandedChart.tsx
  • www/src/docs/exampleComponents/ScatterChart/SimpleScatterChart.tsx
  • www/src/docs/exampleComponents/Tooltip/CustomContentOfTooltip.tsx
  • www/src/docs/exampleComponents/ScatterChart/BubbleChart.tsx
  • www/src/docs/exampleComponents/PieChart/CustomActiveShapePieChart.tsx
  • www/src/docs/exampleComponents/ScatterChart/ThreeDimScatterChart.tsx
  • eslint.config.mjs
  • www/src/docs/exampleComponents/ScatterChart/JointLineScatterChart.tsx
  • www/src/docs/exampleComponents/BarChart/BarChartWithCustomizedEvent.tsx
  • www/src/docs/exampleComponents/ScatterChart/ScatterChartWithLabels.tsx
  • www/src/docs/exampleComponents/Legend/LegendEffectOpacity.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} : When testing tooltips on hover, use `vi.runOnlyPendingTimers()` after each `userEvent.hover()` call or use the `showTooltip` helper function from `tooltipTestHelpers.ts` to account for requestAnimationFrame delays

Applied to files:

  • www/src/docs/exampleComponents/Tooltip/CustomContentOfTooltip.tsx
📚 Learning: 2025-11-16T09:14:24.918Z
Learnt from: PavelVanecek
Repo: recharts/recharts PR: 6640
File: src/cartesian/Bar.tsx:156-159
Timestamp: 2025-11-16T09:14:24.918Z
Learning: In recharts, SSR (Server-Side Rendering) is not yet supported—charts don't render at all in SSR environments. The `isAnimationActive: 'auto'` mode is preparatory work for future SSR support, so testing of this mode should be deferred until SSR support is actually implemented.

Applied to files:

  • www/src/docs/exampleComponents/ScatterChart/ThreeDimScatterChart.tsx
  • www/src/docs/exampleComponents/ScatterChart/JointLineScatterChart.tsx
  • www/src/docs/exampleComponents/ScatterChart/ScatterChartWithLabels.tsx
  • www/src/docs/exampleComponents/Legend/LegendEffectOpacity.tsx
⏰ 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). (1)
  • GitHub Check: Build, Test, Pack
🔇 Additional comments (19)
www/src/docs/apiExamples/Funnel/FunnelExample.tsx (1)

1-1: Importing FunnelTrapezoidItem from recharts public API is correct

FunnelTrapezoidItem is properly exported from the main recharts entry point (src/index.ts), and the import consolidation removes any internal path dependency. The type is used correctly as a component prop annotation, with all accessed properties (lowerWidth, upperWidth, x, y, width, labelViewBox) matching the exported type definition. This aligns with the PR's goal of enforcing public-entry imports.

www/src/docs/exampleComponents/LineChart/LineChartAxisInterval.tsx (1)

1-1: Importing AxisInterval from the public recharts entry is correct

Using AxisInterval directly from 'recharts' keeps this example on the public API surface and avoids internal type paths, matching the new ESLint rule and export strategy.

www/src/docs/exampleComponents/TreeMap/CustomContentTreemap.tsx (1)

1-1: Using TreemapNode from the main recharts entry keeps the example on the public API

Pulling TreemapNode from 'recharts' (instead of any internal path) matches the new “no internal imports” policy while keeping the existing typings for CustomizedContent intact.

www/src/docs/exampleComponents/ScatterChart/ThreeDimScatterChart.tsx (1)

1-1: TooltipIndex now correctly sourced from the public recharts API

Importing TooltipIndex from 'recharts' matches the intent to stop using recharts/types/state/tooltipSlice and keeps this example aligned with the new ESLint restriction on internal paths. Based on learnings, this closes the earlier gap around TooltipIndex being internal-only.

www/src/docs/exampleComponents/ScatterChart/JointLineScatterChart.tsx (1)

1-1: Consistent TooltipIndex import from recharts across Scatter examples

Switching TooltipIndex to the main 'recharts' import keeps this example consistent with the other Scatter charts and compliant with the new no-restricted-imports rule for internal paths.

www/src/docs/exampleComponents/PieChart/CustomActiveShapePieChart.tsx (1)

1-1: Public PieSectorDataItem and TooltipIndex imports strengthen typings without changing behavior

Importing PieSectorDataItem and TooltipIndex directly from 'recharts' lets renderActiveShape and defaultIndex stay strongly typed while avoiding any internal recharts/* paths, in line with the new rules.

www/src/docs/exampleComponents/ScatterChart/BubbleChart.tsx (1)

1-1: BubbleChart now uses TooltipIndex from the stable public API

Adding TooltipIndex to the main 'recharts' import keeps both MyTooltip and BubbleChart on the public API surface, eliminating the need for internal recharts/types/... imports while preserving existing typing for defaultIndex.

www/src/docs/exampleComponents/ScatterChart/SimpleScatterChart.tsx (1)

1-1: SimpleScatterChart’s TooltipIndex import now aligned with the public entrypoint

Using TooltipIndex from 'recharts' keeps this example within the public API and prevents reliance on internal recharts/types/... paths targeted by the new ESLint rule.

eslint.config.mjs (1)

111-117: no-restricted-imports correctly blocks internal recharts/types/* and recharts/src/* paths

The added patterns entry for ['recharts/types/*', 'recharts/src/*'] with a clear guidance message is a good fit for no-restricted-imports and enforces the “use only the public recharts entrypoint” policy, preventing regressions like importing TooltipIndex from internal state slices.

www/src/docs/exampleComponents/Tooltip/CustomContentOfTooltip.tsx (1)

1-11: LGTM! Import consolidation aligns with public API pattern.

The import statement correctly consolidates TooltipContentProps and TooltipIndex into the main recharts import, using the public API instead of internal implementation paths. This aligns with the PR objective to enforce stable public API usage.

Based on learnings, TooltipIndex was previously imported from internal paths like recharts/types/state/tooltipSlice, which should be avoided.

www/src/docs/exampleComponents/ScatterChart/ScatterChartWithLabels.tsx (1)

1-1: LGTM! TooltipIndex now imported from public API.

The import correctly includes TooltipIndex from the main recharts package, eliminating the previous internal import path dependency. This ensures compatibility with the stable public API.

Based on learnings, this addresses the issue where TooltipIndex should not be imported from recharts/types/state/tooltipSlice.

www/src/docs/exampleComponents/Legend/LegendEffectOpacity.tsx (1)

2-2: LGTM! DataKey imported from public API.

The import correctly consolidates DataKey into the main recharts import, following the established pattern of using only the public API entry point.

src/index.ts (4)

17-17: LGTM! TooltipIndex now part of public API.

The export of TooltipIndex from the tooltip slice makes this type available through the public API entry point, fulfilling a key PR objective. This enables consumers to import it from 'recharts' directly instead of using internal paths.

Based on learnings, this addresses the requirement that TooltipIndex should be exported from the public API entry points.


86-86: LGTM! BarRectangleItem exported alongside BarProps.

The addition of BarRectangleItem to the Bar type exports makes this type available through the public API, enabling proper typing for Bar component interactions (e.g., onClick handlers).


102-102: LGTM! TreemapNode exported alongside TreemapProps.

The addition of TreemapNode to the Treemap exports makes this type available through the public API for consumers who need to type Treemap node data.


118-118: LGTM! Utility types now part of public API.

The export of LegendType, DataKey, and AxisInterval makes these commonly-used utility types available through the public API, improving the type ergonomics for library consumers.

www/src/docs/exampleComponents/BarChart/BarChartWithCustomizedEvent.tsx (1)

2-2: LGTM! BarRectangleItem imported from public API.

The import correctly includes BarRectangleItem from the main recharts package, enabling proper typing for the Bar onClick handler without relying on internal paths.

www/src/docs/exampleComponents/ComposedChart/BandedChart.tsx (1)

14-14: LGTM! TooltipContentProps imported from public API.

The import correctly consolidates TooltipContentProps into the main recharts import block, following the established pattern throughout this PR.

DEVELOPING.md (1)

21-36: ESLint rule configuration is properly implemented.

The documentation is well-written and the import restrictions are enforced via the no-restricted-imports ESLint rule configured in eslint.config.mjs (lines 102-119). The rule targets recharts/types/* and recharts/src/* patterns with appropriate error messaging, ensuring that imports from internal paths will fail linting as documented.


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.

Copilot AI changed the title [WIP] Export TooltipIndex from public API and add ESLint rule Export TooltipIndex and other types from public API, add ESLint rule to prevent internal imports Nov 23, 2025
Copilot AI requested a review from PavelVanecek November 23, 2025 14:25
@codecov
Copy link

codecov bot commented Nov 23, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.93%. Comparing base (6026053) to head (63b225d).
⚠️ Report is 11 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6676      +/-   ##
==========================================
+ Coverage   93.92%   93.93%   +0.01%     
==========================================
  Files         502      502              
  Lines       41978    41978              
  Branches     4908     4909       +1     
==========================================
+ Hits        39427    39432       +5     
+ Misses       2546     2541       -5     
  Partials        5        5              

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

@PavelVanecek
Copy link
Collaborator

We need to merge and deploy the exports first, otherwise we can't deploy the website.

@codecov
Copy link

codecov bot commented Nov 24, 2025

Bundle Report

Bundle size has no change ✅

@PavelVanecek
Copy link
Collaborator

Okay starting from #6725 this should be unblocked.

@copilot please rebase on latest main branch.

Copy link
Contributor Author

Copilot AI commented Dec 5, 2025

Okay starting from #6725 this should be unblocked.

@copilot please rebase on latest main branch.

Rebased on latest main branch (commit 2ab4c23). Resolved merge conflict in CustomActiveShapePieChart.tsx and fixed 5 ScatterChart example files that were added in #6669. All imports now use the public API. Commit: 273d69c

Copilot AI and others added 4 commits December 6, 2025 00:02
…imports, add ESLint rule

Co-authored-by: PavelVanecek <1100170+PavelVanecek@users.noreply.github.com>
Co-authored-by: PavelVanecek <1100170+PavelVanecek@users.noreply.github.com>
@PavelVanecek PavelVanecek force-pushed the copilot/export-tooltipindex-and-eslint-rule branch from 20e7482 to 63b225d Compare December 5, 2025 15:10
@PavelVanecek PavelVanecek marked this pull request as ready for review December 5, 2025 15:14
@PavelVanecek
Copy link
Collaborator

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 5, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@PavelVanecek PavelVanecek merged commit 6e710ac into main Dec 6, 2025
38 of 39 checks passed
@PavelVanecek PavelVanecek deleted the copilot/export-tooltipindex-and-eslint-rule branch December 6, 2025 03:34
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.

Export TooltipIndex from public API and add ESLint rule to prevent internal imports

3 participants