feat(oxfmt): Search both .json and .jsonc config file#14848
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for .oxfmtrc.jsonc configuration files in oxfmt, with .json files taking priority when both formats exist in the same directory. The configuration file discovery logic now searches for both file types during upward directory traversal.
Key Changes:
- Extended config file search to support both
.jsonand.jsoncextensions - Established priority where
.jsontakes precedence over.jsonc - Added test fixture to verify the priority behavior
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| apps/oxfmt/src/format.rs | Modified config discovery to iterate through both .json and .jsonc filenames with priority ordering |
| apps/oxfmt/tests/mod.rs | Added documentation explaining the test validates .json priority over .jsonc |
| apps/oxfmt/tests/fixtures/config_file/.oxfmtrc.jsonc | Added test fixture with semi: false to contrast with existing .json file |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
How to use the Graphite Merge QueueAdd either label to this PR to merge it via 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. |
Merge activity
|
5e9bee9 to
6dfcd80
Compare
## [0.7.0] - 2025-10-21 ### 🚀 Features - 6dfcd80 oxfmt: Search both .json and .jsonc config file (#14848) (leaysgur) - aa024d9 formatter: Wrap parenthesis for `AssignmentExpression` that are inside `ComputedMemberExpression` (#14834) (Dunqing) ### 🐛 Bug Fixes - 88fb768 formatter: Correct handling of ignore comment for `TSUnionType` and `TSMappedType` (#14824) (Dunqing) - f7727c7 formatter: Ignore comment doesn't work for the expression statement (#14817) (Dunqing) - 7a420a1 oxfmt: Handle `.d.ts` file correctly (#14835) (leaysgur) ### 🚜 Refactor - 6fa7420 oxfmt: Use custom ignore builder (#14850) (leaysgur) - 9d914a3 formatter: Improve comments handling (#14816) (Dunqing) - f52863d formatter: Improve handling of type cast node (#14815) (Dunqing)
The same as the CLI is now doing it: #14848

Fixes #14575