Skip to content

feat(tsconfig): support JSONC comments in tsconfig.json files#476

Merged
alexander-akait merged 1 commit intomainfrom
jsonc
Feb 27, 2026
Merged

feat(tsconfig): support JSONC comments in tsconfig.json files#476
alexander-akait merged 1 commit intomainfrom
jsonc

Conversation

@xiaoxiaojx
Copy link
Member

@xiaoxiaojx xiaoxiaojx commented Feb 27, 2026

Summary
Fixes #475

What kind of change does this PR introduce?
feat

Did you add tests for your changes?
Yes

Does this PR introduce a breaking change?
No

If relevant, what needs to be documented once your changes are merged or what have you already documented?
Nothing

@codecov
Copy link

codecov bot commented Feb 27, 2026

Codecov Report

❌ Patch coverage is 74.74747% with 25 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.67%. Comparing base (f7f15d9) to head (3cb56d5).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
lib/util/strip-json-comments.js 73.03% 20 Missing and 4 partials ⚠️
lib/util/fs.js 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #476      +/-   ##
==========================================
- Coverage   93.42%   92.67%   -0.76%     
==========================================
  Files          49       50       +1     
  Lines        2388     2483      +95     
  Branches      719      751      +32     
==========================================
+ Hits         2231     2301      +70     
- Misses        128      149      +21     
- Partials       29       33       +4     
Flag Coverage Δ
integration 92.67% <74.74%> (-0.76%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

const config = await readJson(fileSystem, configFilePath);
const config = await readJson(fileSystem, configFilePath, {
stripComments: true,
});
Copy link
Member

Choose a reason for hiding this comment

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

The main problem here what readJson will not cache fs calls, because we have options here, we cache only calls without options, maybe we need to introduce readJsonc

Copy link
Member Author

Choose a reason for hiding this comment

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

Here, we cache the fs calls. We’re not passing the arguments through to FileSystem — this is a readJson helper wrapped in utils. I’m not sure whether we still need to implement a readJsonc method in FileSystem.
https://github.com/webpack/enhanced-resolve/pull/476/changes#diff-68a304bd1f2cab3fd1377549ad55b1bd26e250aa52bf9afbba06a6da4280876fR41

Copy link
Member

Choose a reason for hiding this comment

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

Oh, I see, thanks

@alexander-akait
Copy link
Member

@xiaoxiaojx let's rebase, wrong order merge 😞 and we can merge

@alexander-akait alexander-akait merged commit 03120de into main Feb 27, 2026
26 of 28 checks passed
@alexander-akait alexander-akait deleted the jsonc branch February 27, 2026 17:46
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.

resolve.tsconfig crashes when tsconfig.json has comments

2 participants