Skip to content

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

@connorshea

Description

@connorshea

Describe the bug

I ran vp migrate on oxlint-migrate as a test, and discovered that it will error if there are code comments (or extra commas, probably) in the .oxlintrc.json file:

An .oxlintrc.json that triggers the crash:

{
  "$schema": "./node_modules/oxlint/configuration_schema.json",
  "categories": {
    "correctness": "error"
  },
  "rules": {
    // this is a comment
    "no-console": "error"
  },
  "globals": {},
  "ignorePatterns": []
}

Oxlint supports JSONC even if the filename is .json (this is maybe also true of oxfmt? not sure).

Reproduction

https://github.com/connorshea/vp-test

Steps to reproduce

  • pnpm install
  • vp migrate --no-interactive (or interactive, doesn't matter)
  • See it crash

I tried this and reproduced it on both the latest alpha and the latest stable.

System Info

VITE+ - The Unified Toolchain for the Web

Environment:
  Version  24.14.1
  Source   lts

Tool Paths:
  node  /Users/connorshea/.vite-plus/js_runtime/node/24.14.1/bin/node
  npm   /Users/connorshea/.vite-plus/js_runtime/node/24.14.1/bin/npm
  npx   /Users/connorshea/.vite-plus/js_runtime/node/24.14.1/bin/npx

VITE+ - The Unified Toolchain for the Web

vp v0.1.14

Local vite-plus:
  vite-plus  Not found

Tools:
  vite             Not found
  rolldown         Not found
  vitest           Not found
  oxfmt            Not found
  oxlint           Not found
  oxlint-tsgolint  Not found
  tsdown           Not found

Environment:
  Package manager  pnpm v10.32.1
  Node.js          v24.14.1

Used Package Manager

pnpm

Logs

vp-test % vp migrate            
VITE+ - The Unified Toolchain for the Web

◇ Set up pre-commit hooks to run formatting, linting, and type checking with auto-fixes?
  No

◇ Which agents are you using?
  ChatGPT (Codex)

◇ Which editor are you using?
  VSCode

◑  Checking config compatibility (0s)
Expected property name or '}' in JSON at position 133 (line 7 column 5)
SyntaxError: Expected property name or '}' in JSON at position 133 (line 7 column 5)
    at JSON.parse (<anonymous>)
    at mergeViteConfigFiles (file:///Users/connorshea/.vite-plus/0.1.15-alpha.5/node_modules/.pnpm/vite-plus@0.1.15-alpha.5_vite@8.0.3_@emnapi+core@1.9.1_@emnapi+runtime@1.9.1_/node_modules/vite-plus/dist/global/agent-CmMz9vxG.js:3943:27)
    at rewriteStandaloneProject (file:///Users/connorshea/.vite-plus/0.1.15-alpha.5/node_modules/.pnpm/vite-plus@0.1.15-alpha.5_vite@8.0.3_@emnapi+core@1.9.1_@emnapi+runtime@1.9.1_/node_modules/vite-plus/dist/global/agent-CmMz9vxG.js:3617:2)
    at executeMigrationPlan (file:///Users/connorshea/.vite-plus/0.1.15-alpha.5/node_modules/.pnpm/vite-plus@0.1.15-alpha.5_vite@8.0.3_@emnapi+core@1.9.1_@emnapi+runtime@1.9.1_/node_modules/vite-plus/dist/global/migrate.js:429:7)
    at async main (file:///Users/connorshea/.vite-plus/0.1.15-alpha.5/node_modules/.pnpm/vite-plus@0.1.15-alpha.5_vite@8.0.3_@emnapi+core@1.9.1_@emnapi+runtime@1.9.1_/node_modules/vite-plus/dist/global/migrate.js:529:17)
■ Canceled (0s)

Validations

Metadata

Metadata

Assignees

Type

Priority

None yet

Effort

None yet

Target date

None yet

Start date

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions