[@rushstack/node-core-library] use the JsonFile.save() update existing json5 syntax file error.
fansenze opened this issue · 0 comments
fansenze commented
Summary
use the JsonFile.save
(@rushstack/node-core-library
) update existing json5 syntax file error.
Repro steps
-
open this link
-
execute
node test.js
in terminal
Actual result: it will cause error in terminal: SyntaxError: Trailing comma in object at 4:1
Expected result: save successfully.
Details
Currently:
JsonFile.load
setjson5
mode tojju
by default, so that can load files bothjson
/cjson
/json5
syntax.JsonFile.save
not supportjson5
syntax string by default when setupdateExistingFile
astrue
.
Expected:
i think the default json syntax should remain consistent in JsonFile read/write functions.
Standard questions
Please answer these questions to help us investigate your issue more quickly:
Question | Answer |
---|---|
Package name: | @rushstack/node-core-library |
Package version? | 3.62.0 |
Operating system? | Mac |
Would you consider contributing a PR? | No |
Node.js version (node -v )? |
16.16.0 / 20.10.0 |