Skip to content

Conversation

@shulaoda
Copy link
Member

@shulaoda shulaoda commented Nov 6, 2025

closes #790

Implement solution-style tsconfig resolution similar to tsconfck' resolveSolutionTSConfig. This automatically selects the correct tsconfig for a file in monorepo/solution-style projects with project references.

Changes:

  • Add TsConfig::resolve_for_file method to resolve the appropriate tsconfig based on file inclusion patterns
  • Add TsConfig::is_file_included to check if files match tsconfig's include/exclude/files patterns
  • Add TsConfig::is_glob_match for glob pattern matching with support for TypeScript's pattern normalization
  • Integrate solution-style resolution in TsconfigDiscovery::Auto mode
  • Add fast-glob dependency for efficient pattern matching
  • Add comprehensive test suite with 6 tests covering basic resolution,
    exclude patterns, allowJs, extensions, and edge cases
  • Add test fixtures for monorepo scenarios with multiple packages

The implementation respects TypeScript's file inclusion rules including:

  • files array (highest priority)
  • include patterns with implicit **/* globstar
  • exclude patterns
  • allowJs configuration for JavaScript files
  • All TypeScript extensions (ts, tsx, mts, cts, js, jsx, mjs, cjs)

I’ll add more tests for the is_file_included and is_glob_match methods in the next PRs.

Copy link
Member Author

shulaoda commented Nov 6, 2025


How to use the Graphite Merge Queue

Add the label merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@codecov
Copy link

codecov bot commented Nov 6, 2025

Codecov Report

❌ Patch coverage is 89.33333% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.82%. Comparing base (2de408b) to head (521372f).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/tsconfig.rs 89.18% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #815      +/-   ##
==========================================
- Coverage   93.93%   93.82%   -0.12%     
==========================================
  Files          17       17              
  Lines        3098     3172      +74     
==========================================
+ Hits         2910     2976      +66     
- Misses        188      196       +8     

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@shulaoda shulaoda force-pushed the 11-06-feat_tsconfig_implement_solution-style_tsconfig_resolution branch from 817c769 to 8c5e2e0 Compare November 6, 2025 09:01
@shulaoda shulaoda requested a review from Copilot November 6, 2025 09:03
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements solution-style TypeScript configuration resolution for monorepo projects with project references. The implementation follows similar logic to tsconfck's resolveSolutionTSConfig, ensuring that files are resolved against the correct tsconfig in a multi-project setup.

Key changes:

  • Added resolve_for_file method to determine the correct tsconfig for a file in a solution-style project
  • Implemented file inclusion/exclusion logic with is_file_included and is_glob_match methods
  • Integrated the new resolution logic into the main resolver workflow

Reviewed Changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/tsconfig.rs Added solution-style tsconfig resolution with file inclusion/exclusion pattern matching
src/lib.rs Integrated resolve_for_file into the tsconfig resolution workflow
src/tests/tsconfig_solution_style.rs Comprehensive test suite for solution-style resolution scenarios
src/tests/mod.rs Registered new test module
Cargo.toml Added fast-glob dependency for glob pattern matching
Cargo.lock Updated lock file with new dependencies
fixtures/tsconfig/cases/solution_style/* Test fixtures for solution-style resolution scenarios

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 6, 2025

CodSpeed Performance Report

Merging #815 will not alter performance

Comparing 11-06-feat_tsconfig_implement_solution-style_tsconfig_resolution (521372f) with main (1dfdc55)

Summary

✅ 10 untouched
⏩ 5 skipped1

Footnotes

  1. 5 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@shulaoda shulaoda force-pushed the 11-06-feat_tsconfig_implement_solution-style_tsconfig_resolution branch from 8c5e2e0 to b7b4cf2 Compare November 6, 2025 09:13
@shulaoda shulaoda force-pushed the 11-06-feat_tsconfig_implement_solution-style_tsconfig_resolution branch from b7b4cf2 to 521372f Compare November 6, 2025 09:25
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