Skip to content

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

Description

@coderabbitai

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

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions