You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Trailing comma in default settings.json when using split JSON editor causes warning that can't be removed. #80419
My tsconfig.json files recently started showing errors when there is a trailing comma in them. TSC allows trailing commas and I would rather not remove them as it makes editing easier. What changed that is causing jsonc checker to start erroring on trailing comma? How can I go back to the old behavior?
There are several file formats out there that allow comments in JSON but not trailing commas.
(e.g. tslint.json, eslint.json)
So I made a change so that by default jsonc no longer accepts trailing commas.
Trailing commas are only ignored for jsonc files if they have a schema associated that specifies that trailing commas are allowed.
That's done with a property in the schema root: allowTrailingCommas: true
(note that I just changed from allowsTrailingCommas to allowTrailingCommas, please only use allowTrailingCommas)
I added that to the schemas of our settings files. Note that the schemas of our settings files are dynamically generated, so it's all in code
It looks like the error is coming from the default settings 'editor', which has no schema associated. Sandeep Somavarapu (@sandy081) Can you associate a schema there, or just generate code without trailing comma?
Activity
ladyrick commentedon Sep 6, 2019
I have the same problem.
danplisetsky commentedon Sep 7, 2019
Same here on Mac. I also have prettier as the default formatter:
Turning it off doesn't help though.
MicahZoltu commentedon Sep 8, 2019
My
tsconfig.jsonfiles recently started showing errors when there is a trailing comma in them. TSC allows trailing commas and I would rather not remove them as it makes editing easier. What changed that is causingjsoncchecker to start erroring on trailing comma? How can I go back to the old behavior?wlchn commentedon Sep 11, 2019
Same issue here. Happened after I updated to 1.38, and edited user setting.
I'm also using split json config:
and using
prettieras the default formatterrobjac commentedon Sep 11, 2019
this is happening to me -- every time i open or close the settings.json split viewer, a new problem is created.
inliquid commentedon Sep 15, 2019
Same here.
sandy081 commentedon Sep 20, 2019
Martin Aeschlimann (@aeschli) Is this new with jsonc that showing a warning with trailing comma?
aeschli commentedon Sep 20, 2019
There are several file formats out there that allow comments in JSON but not trailing commas.
(e.g. tslint.json, eslint.json)
So I made a change so that by default
jsoncno longer accepts trailing commas.Trailing commas are only ignored for jsonc files if they have a schema associated that specifies that trailing commas are allowed.
That's done with a property in the schema root:
allowTrailingCommas: true(note that I just changed from
allowsTrailingCommastoallowTrailingCommas, please only useallowTrailingCommas)I added that to the schemas of our settings files. Note that the schemas of our settings files are dynamically generated, so it's all in code
It looks like the error is coming from the default settings 'editor', which has no schema associated.
Sandeep Somavarapu (@sandy081) Can you associate a schema there, or just generate code without trailing comma?
I'll make a fix for
tsconfig.jsonallow trailing commas in tsconfig.json (for #80419)
sandy081 commentedon Sep 24, 2019
Thanks Martin Aeschlimann (@aeschli), I can see if I can avoid trailing comma.
SHxKM commentedon Oct 4, 2019
So this is closed as in fixed? I just got referred here after opening #81920. Is the fix in the nightly build?
aeschli commentedon Oct 4, 2019
Yes, in the insiders ('nightly') build.