cosmiconfig
cosmiconfig copied to clipboard
add support for TOML?
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
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.
@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!
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.
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.
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.
Chiming in with an additional point of data, since I'm in favor of this: Prettier has had TOML support since August 2018.
Maybe you'd be interested in confinode, as adding TOML support is straightforward with it (see here).
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.
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.