rushstack icon indicating copy to clipboard operation
rushstack copied to clipboard

fix: malformed package.json by explicitly setting jsonSyntax to strict

Open kenrick95 opened this issue 1 year ago • 0 comments

Summary

Attempt to fix #4811

Details

I investigated and found out that when saving JSON with "jju.update", it always use Json5 mode. This may cause issue when updating things that expect strict JSON like package.json.

So the fix here is to pass a jsonSyntax option to let PackageJsonEditor use that JsonSyntax.Strict mode.

How it was tested

I build locally and it works on the repro: https://github.com/kenrick95/rush-repro-rush-add-malformed-package-json

Screenshot 2024-06-27 at 10 46 12

Impacted documentation

  • IJsonFileStringifyOptions adds "jsonSyntax" as an option. Is that okay?

kenrick95 avatar Jun 27 '24 02:06 kenrick95