Skip to content

netlify recipes vscode crashes when reading .vscode/settings.json that contains comments #5407

@kaelig

Description

@kaelig

Describe the bug

netlify recipes vscode fails to read .vscode/settings.json when it contains comments.

 ›   Error: Could not open VS Code settings file: Unexpected token / in JSON at position 4

I'd recommend using the comment-json npm package instead of native JSON to parse, patch, and stringify settings.json while preserving comments.

Steps to reproduce

  1. Add // comment at the top of .vscode/settings.json
  2. Run netlify recipes vscode

Environment

  System:
    OS: macOS 13.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 1.86 GB / 32.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.12.1 - ~/.nvm/versions/node/v18.12.1/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v18.12.1/bin/yarn
    npm: 8.19.2 - ~/.nvm/versions/node/v18.12.1/bin/npm
  npmPackages:
    netlify-cli: 12.5.0 => 12.5.0

Metadata

Metadata

Labels

type: bugcode to address defects in shipped code

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions