Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: allow config files to end with ".json5" #84

Open
FelixGraf opened this issue Feb 3, 2023 · 4 comments
Open

Feature Request: allow config files to end with ".json5" #84

FelixGraf opened this issue Feb 3, 2023 · 4 comments

Comments

@FelixGraf
Copy link
Contributor

For roughly a month, it's possible to use JSON5 syntax in the config files, thanks to #73. For code editors to understand that this is possible, allowing the config files to end with .json5 as the file extension might make sense.

When now using comments in the JSON file, both VS Code and WebStorm complain that this is a forbidden syntax. Having the file renamed to default.json5 resolves the warnings.

If this is a desired feature, I will try to send a PR for it :)

Bildschirm­foto 2023-02-03 um 15 57 32

Bildschirm­foto 2023-02-03 um 15 57 03

@tusharmath
Copy link
Owner

Would be awesome if you could send a PR!

@FelixGraf
Copy link
Contributor Author

FelixGraf commented Feb 6, 2023

@tusharmath, on it at the moment :)

But I want to clarify what should happen when there is both a .json and a .json5 config file.

I see the following options:

  1. merge both file contents (which one should take precedence?)
  2. only parse one file and ignore the other one (which one should take precedence?)
  3. throw an error explaining that there should be only one config file of the same type

Currently, I'm leaning toward implementing the third option, as it does not make much sense to have two separate files of the same type, but I'd love to hear your opinion!

@tusharmath
Copy link
Owner

I don't think we should throw errors. This is a fundamental problem with the current design of the library. You will face the same issue if you have a .yml file also.
Have a look at #86 with the proposed new design. I think it can make life much easier and a design which is less opinionated and more robust.

@arthu
Copy link

arthu commented Jul 28, 2023

It would be great if the library can support all format including .json, .json5 and yaml.

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

No branches or pull requests

3 participants