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

Convert configs from .json to .js or .ts #837

Open
Alexander-Taran opened this issue Mar 6, 2018 · 6 comments
Open

Convert configs from .json to .js or .ts #837

Alexander-Taran opened this issue Mar 6, 2018 · 6 comments

Comments

@Alexander-Taran
Copy link
Contributor

I'm submitting a discussion request

  • Language:
    all

  • Loader/bundler:
    all

Current behavior:

Config files are now mostly in .json format which does not allow comments.
https://stackoverflow.com/questions/244777/can-comments-be-used-in-json

  • What is the desired behavior?
    Have most config files in .js format
    Like webpack.config.js
module.exports = {
// same json, but now it can have comments along
}

  • What is the motivation / use case for changing the behavior?

I think it would be useful to have commented config files.
It improves usage by new developers. And is generally a good practice.
Like in website usage - every additional step increases drop rate.
Figuring out what that line means and how to use it now requires..
If it's not mentioned in the docs -> hours of googling and parsing the issues
That is for the patient ones

Some drawbacks: I guess that now configs are read and modified as objects and are written the same way by the CLI.
Maintaining that ease of modifying config with CLI would be a challenge.

there is a jsonc parser by MS
https://github.com/Microsoft/node-jsonc-parser

but no writer of course..

Well It is a dream of improving something for newcomers
Not actionable

@JoakimSoderberg
Copy link

Similar to #781 (Yaml config)... Commented configs is a must.

The huge gap between the cli help and actually having to edit the config file without any help is a big usability gap.

@3cp
Copy link
Member

3cp commented Aug 10, 2018

I also want my aurelia.json to be upgraded to aureliarc.js, not only for comments (which I want too), but also for simplifying cli implementation. We can conditionally build the config, so we can cut off some code from cli that supports condition in aurelia.json, like:

{
  "name": "aurelia-testing",
  "env": "dev"
}

@michaelw85
Copy link
Contributor

I would like to add a different motivation to prefer js over json config files. In my Aurelia setup I moved all my config files in an npm package (coding standards). JS files can easily extend another js/json config and be merged using a spread operator.

(Not a fan of adding comments btw, if you need to comment code it generally means something needs to be improved)

@3cp
Copy link
Member

3cp commented Feb 20, 2019

if you need to comment code it generally means something needs to be improved.

I think most coders will disagree 😃

@magnusdanielson
Copy link

Remeber that we are discussing add comments to configurations. I would say it is really valuable to have comments in configuration.

I would love to se .ts instead of .json

@Alexander-Taran
Copy link
Contributor Author

bump

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

No branches or pull requests

5 participants