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

add support for TOML? #150

Open
foray1010 opened this issue Jun 23, 2018 · 10 comments
Open

add support for TOML? #150

foray1010 opened this issue Jun 23, 2018 · 10 comments

Comments

@foray1010
Copy link

foray1010 commented Jun 23, 2018

Would you mind me adding support for TOML? Because TOML looks simpler and less error-prone

There is a good article explaining the reason why TOML is better than YAML
https://arp242.net/weblog/yaml_probably_not_so_great_after_all.html

@olsonpm
Copy link
Contributor

olsonpm commented Jun 23, 2018

This is actually already doable via loaders. This functionality was recently added by davidtheclark in this pull request. If anything about it is unclear please let me know and I'll try to help out.

@foray1010
Copy link
Author

@olsonpm cool! I wonder if we can make TOML supported by default instead of requiring additional setting
because this library is required by so many useful tools (such as stylelint) and as far as I see they just use the default setting, it will be nice that TOML can also support by default!

@olsonpm
Copy link
Contributor

olsonpm commented Jun 23, 2018

I don't think we'll be adding more defaults. It's just too hard a line to draw on when to stop adding out-of-the-box supported languages and syntaxes - which is one of the reasons making it an option works well.

@davidtheclark
Copy link
Collaborator

Thanks @foray1010. I like the article: I find it convincing and I'll try using TOML more often :)

@olsonpm is right, though, that we won't be adding another default for TOML — not unless we see common reliance on it among cosmiconfig users. The "users" of cosmiconfig are not, however, the end users of tools like stylelint, but the authors of tools like stylelint. If stylelint users want TOML configuration, that's a feature request for stylelint; if lint-staged users want TOML configuration, that's a feature request for lint-staged. If stylelint and lint-staged and some other users then express that they'd like cosmiconfig to turn on TOML by default, we'd consider it.

because this library is required by so many useful tools (such as stylelint) and as far as I see they just use the default setting, it will be nice that TOML can also support by default!

Cosmiconfig should not be in control of this — that is, should not be making the decisions about adding more default configuration formats to libraries, unless those libraries want them.

So I'm happy to leave this issue open to see if library authors do want to add TOML to the defaults.

@dsifford
Copy link

dsifford commented Jul 4, 2018

Chiming in here just to say that I also think toml is superior to json and yaml. The Rust (cargo.toml) and Python (pyproject.toml) community seems to think so too.

@0az
Copy link

0az commented Jan 31, 2020

Chiming in with an additional point of data, since I'm in favor of this: Prettier has had TOML support since August 2018.

@sveyret

This comment was marked as spam.

@seivan
Copy link

seivan commented Apr 8, 2021

Just checking if there is any new opinions on this, I also need TOML and I'd reckon at this point it's caught some more traction enough to justify it as part of default loaders.

@d-fischer
Copy link
Member

Sounds like a good idea. What's the go-to lightweight parser for this?

The apparently most popular parser, @iarna/toml, which prettier also seems to use, does not support the latest version of the spec.

@cyyynthia
Copy link

Hi there, I see that this issue seem to be currently blocked by the lack of libraries. I don't want it to sound like self-promo but I'm the maintainer of https://www.npmjs.com/package/smol-toml, a lightweight TOML parser compliant with the 1.0.0 spec. Some prominent tools such as knip, rust-cache and unjs's confbox have adopted it, so I think it has seen quite a handful of real-world TOML files and I haven't heard about parsing issues for a while (which is something I'm happy about!).

I think it can fit the needs of cosmiconfig and bring native TOML support to this already very handy lib

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

10 participants