justdlabs / cli

The command line interface for Justd.
https://getjustd.com
MIT License
5 stars 0 forks source link

CLI fails to parse tsconfig.json with comments #3

Open benmerckx opened 3 days ago

benmerckx commented 3 days ago

Originally reported here: justdlabs/justd#244

Describe the bug Just tried to init a new project that started with bun init. Bun creates a tsconfig.json file with the following contents:

{
  "compilerOptions": {
    // Enable latest features
    "lib": ["ESNext", "DOM"],
    "target": "ESNext",
    "module": "ESNext",
    "moduleDetection": "force",
    "jsx": "react-jsx",
    "allowJs": true,

    // Bundler mode
    "moduleResolution": "bundler",
    "allowImportingTsExtensions": true,
    "verbatimModuleSyntax": true,
    "noEmit": true,

    // Best practices
    "strict": true,
    "skipLibCheck": true,
    "noFallthroughCasesInSwitch": true,

    // Some stricter flags (disabled by default)
    "noUnusedLocals": false,
    "noUnusedParameters": false,
    "noPropertyAccessFromIndexSignature": false
  }
}

Running bunx justd-cli@latest init next produces the following error:

✖ Failed to parse tsconfig.json.

Removing the comments (to adhere to JSON) passes the cli

To Reproduce Steps to reproduce the behavior:

  1. Create tsconfig with a comment
  2. Run npx justd-cli@latest init
  3. See error

Expected behavior Support comments in tsconfig.json

irsyadadl commented 3 days ago

At least right now, just remove the //

see this