Skip to content

Allow JSON with comments in jsconfig.json #7426

Description

@mrmckeb

Is your proposal related to a problem?

This is a follow-on from #7248. Right now, we don't support JSONC (JSON with comments) in jsconfig.json files.

Describe the solution you'd like

After a discussion with @iansu, we see two paths:

  1. Implement the same solution as we did for TypeScript. This is easy, but would require us making TypeScript a dependency of react-scripts.
  2. The above, but instead of installing 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.

Activity

  1. modified the milestones: 3.2, 3.1 on Jul 25, 2019
  2. miraage commented on Jul 25, 2019

    @miraage

    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)

  3. mrmckeb commented on Jul 25, 2019

    @mrmckeb
    ContributorAuthor

    @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).

  4. lianapache commented on Jul 25, 2019

    @lianapache

    @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?

  5. mrmckeb commented on Jul 25, 2019

    @mrmckeb
    ContributorAuthor

    Great, thanks @lianapache!

    You should take a look at how verifyTypeScriptSetup.js works and either extend that, or see what can be shared here :)

  6. lianapache commented on Jul 25, 2019

    @lianapache

    @mrmckeb, Sure 👍 Thanks for the tip!

  7. miraage commented on Jul 25, 2019

    @miraage

    @mrmckeb we can pin TS version via react-dev-utils in that case, like cross-spawn and chalk.

  8. 9 remaining items

  9. added this to the 3.4 milestone on Dec 5, 2019
  10. esvyridov commented on Dec 5, 2019

    @esvyridov
    Contributor

    @mrmckeb I think I would try to implement the second path. The plan is:

    1. Check if there are comments in jsconfig
    2. If yes then I'll inform user that we found a comment in jsconfig and we need to install typescript to devDependencies in order to parse it.
    3. If not then just parse it
  11. mrmckeb commented on Dec 9, 2019

    @mrmckeb
    ContributorAuthor

    @esvyridov, what if we did this?

    1. Check if TS is installed, and parse with that - or parse without if not installed.
    2. If we fail, and TS was not installed, tell the user that they need to install TypeScript as a dependency if they want to support JSONC.
  12. esvyridov commented on Dec 11, 2019

    @esvyridov
    Contributor

    @mrmckeb PR #8140 is ready

  13. modified the milestones: 3.4, 3.5 on Feb 14, 2020
  14. modified the milestones: 5.1, 5.0.1 on Dec 17, 2021
  15. modified the milestones: 5.0.1, 5.0.2 on Apr 12, 2022
  16. DipakHalkude commented on Sep 23, 2025

    @DipakHalkude

    I'd love to contribute to this issue. And I made a PR please check it:) https://github.com/facebook/create-react-app/pull/17148

  17. tysoncung commented on Oct 21, 2025

    @tysoncung

    I'm interested in working on this issue. Could you provide more context about what you're looking for? Any additional details about requirements or constraints would be helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions