Skip to content

Prefer index barrels for relative auto-imports - #64035

Draft
Ryan Cavanaugh (RyanCavanaugh) with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-auto-import-prioritization
Draft

Prefer index barrels for relative auto-imports#64035
Ryan Cavanaugh (RyanCavanaugh) with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-auto-import-prioritization

Conversation

Copilot AI commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Auto-import source selection used alphabetical ordering to break ties between direct files and index.ts barrels, producing inconsistent imports based on filename casing and spelling.

  • Ranking

    • Prefer index-file re-exports among otherwise-equivalent relative candidates.
    • Preserve path-depth ranking, cycle avoidance, and ambient/package import behavior.
  • Coverage

    • Add a NodeNext regression case where double.ts previously outranked index.ts.
    • Update existing barrel-order expectations.
// Before
import { double } from "./utils/double/double.js";

// Preferred
import { double } from "./utils/double/index.js";

Copilot AI and others added 2 commits August 26, 2026 17:05
Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix auto-import prioritization for index.ts files Prefer index barrels for relative auto-imports Aug 26, 2026
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.

Auto-import prioritizes files alphabetically before index.ts inside a folder, ignoring the barrel

2 participants