Skip to content

fix: support JSONC format in oxlintrc/oxfmtrc migration#1195

Merged
fengmk2 merged 7 commits intovoidzero-dev:mainfrom
connorshea:patch-1
Mar 29, 2026
Merged

fix: support JSONC format in oxlintrc/oxfmtrc migration#1195
fengmk2 merged 7 commits intovoidzero-dev:mainfrom
connorshea:patch-1

Conversation

@connorshea
Copy link
Copy Markdown
Contributor

@connorshea connorshea commented Mar 29, 2026

Summary

  • Add .oxlintrc.jsonc and .oxfmtrc.jsonc as valid config file names in the migrator detector
  • Use jsonc-parser instead of JSON.parse so oxlint/oxfmt config files with JSONC syntax (comments, trailing commas) are parsed correctly during migration — this also fixes .oxlintrc.json files that use JSONC syntax, since oxlint supports JSONC regardless of extension
  • Add snap test with JSONC features (comments, trailing commas) to verify the migration works

Closes #1193

Ref: oxc-project/oxc#19870

This does not actually parse it as a JSONC file still, but it's a valid filename for Oxlint's config file and so should be accepted, as of oxc-project/oxc#19870

Signed-off-by: Connor Shea <connor.james.shea@gmail.com>
@netlify
Copy link
Copy Markdown

netlify bot commented Mar 29, 2026

Deploy Preview for viteplus-preview canceled.

Name Link
🔨 Latest commit adb54b9
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/69c92695163dba0008e599ac

@fengmk2 fengmk2 self-assigned this Mar 29, 2026
@fengmk2
Copy link
Copy Markdown
Member

fengmk2 commented Mar 29, 2026

@connorshea Thanks, I will add snap test for this change before merge.

@fengmk2 fengmk2 changed the title fix: Add support for .oxlintrc.jsonc configuration file name in migrator fix: add support for .oxlintrc.jsonc configuration file name in migrator Mar 29, 2026
fengmk2 added 2 commits March 29, 2026 19:53
Verifies that the migrator detects and merges .jsonc config files
into vite.config.ts, matching the existing .json behavior.
…tation

The migrator detects .oxlintrc.jsonc but fails to parse it when
the file contains JSONC features like trailing commas, since it
uses JSON.parse instead of a JSONC parser.
Use readJsonFile with allowComments instead of JSON.parse so that
.oxlintrc.jsonc files with trailing commas and comments are parsed
correctly during migration.
@fengmk2 fengmk2 linked an issue Mar 29, 2026 that may be closed by this pull request
4 tasks
Covers the scenario from voidzero-dev#1193 where oxlint config files contain
comments, which caused JSON.parse to crash during migration.

Closes voidzero-dev#1193
@fengmk2 fengmk2 changed the title fix: add support for .oxlintrc.jsonc configuration file name in migrator fix: support JSONC format in oxlintrc/oxfmtrc migration Mar 29, 2026
Reproduces the exact scenario from voidzero-dev#1193 where .oxlintrc.json
contains JSONC syntax (comments) which caused JSON.parse to crash.
@fengmk2 fengmk2 merged commit e3c79b9 into voidzero-dev:main Mar 29, 2026
23 checks passed
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.

vp migrate fails on an .oxlintrc.json file with JSONC syntax

2 participants