-
Notifications
You must be signed in to change notification settings - Fork 2k
feat: add JSONC support #10083
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
feat: add JSONC support #10083
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
chris-olszewski
approved these changes
Mar 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. Maybe get another review for the Rust changes (especially loader.rs
) since I rewrote some chunks.
Looks great to me. Thanks for all the assists. |
chris-olszewski
added a commit
that referenced
this pull request
Mar 31, 2025
### Description #10083 introduced a bug where we swallow validation errors and end up silently ignoring these workspace `turbo.json` files. This PR fixes that by distinguishing a missing `turbo.json` from a failed read. The bug stems from the fact that a missing file and a failed read were both errors so `turbo_json.or(turbo_jsonc)` could choose a missing turbo.json error (which is fine, not all workspaces need `turbo.json`s) over a validation error for the file that is present. We replace `.or` with an extremely explicit `match` that goes through all the possible combinations. ### Testing Instructions Added unit test Quick manual verification ``` [0 olszewski@macbookpro] /Users/olszewski/code/vercel/turborepo $ turbo_dev build WARNING No locally installed `turbo` found. Using version: 2.4.5-canary.6. turbo 2.4.5-canary.6 turbo_json_parse_error × Failed to parse turbo.json. ╰─▶ × Found an unknown key `lol`. ╭─[cli/turbo.json:9:7] 8 │ "rust-src": { 9 │ "lol": true, · ───── 10 │ "env": [ ╰──── ```
probably related: #10323 |
1 task
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
JSONC allows the use of comments in JSON files. Until now, our configuration parser allowed comments in JSON by accident, which made for awkwardness talked about in #3793.
With this PR, we're now able to support
turbo.jsonc
in both the root configuration and in Package Configurations. The file will be properly used for hashing and users can use.jsonc
that will work with their editors and other tooling.Testing Instructions
Tests have been added in this PR and I've hand-tested with
create-turbo
, bothturbo
and some packages. Would appreciate some more hand-testing, just in case, along with your code review.