This is a follow-on from #7248. Right now, we don't support JSONC (JSON with comments) in jsconfig.json files.
After a discussion with @iansu, we see two paths:
react-scripts.typescript as a dependency of react-scripts, we would install it to the user's project if they are using a jsconfig.json file and don't have typescript installed.Discussion is welcome.
If you're interested in picking this up, please let us know.
https://www.npmjs.com/package/json5 seems to be quite popular. Both .json and .json5 could be supported with their syntax (i.e. no jsonc/json5 in .json files)
@miraage, I personally feel that adding a dependency to read JSONC files would be a poorer solution than adding TS as a dependency... adding TS actually gives us some other benefits, like potentially pinning TS versions (so that they align with the linting configs, etc).
@mrmckeb, I would like to pick this up.
Also, I think that moving TypeScript as a dependency to react-scripts sound like a breaking change, so I would rather go with the second option. What do you think?
Great, thanks @lianapache!
You should take a look at how verifyTypeScriptSetup.js works and either extend that, or see what can be shared here :)
@mrmckeb, Sure :+1: Thanks for the tip!
@mrmckeb we can pin TS version via react-dev-utils in that case, like cross-spawn and chalk.
Weldon guys
@mrmckeb What if we parse json file as string and remove all comments?
@esvyridov if you'd like to pick this up and give that a go, let me know.
@mrmckeb sure, I'll take this 馃憤
@mrmckeb I think I would try to implement the second path. The plan is:
@esvyridov, what if we did this?
@mrmckeb PR #8140 is ready
Most helpful comment
@mrmckeb we can pin TS version via react-dev-utils in that case, like cross-spawn and chalk.