-
-
Notifications
You must be signed in to change notification settings - Fork 135
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Give back some power to the end users #288
Conversation
Co-authored-by: T6 <t6@t6.fyi>
Co-authored-by: T6 <t6@t6.fyi>
This approach seems bad to me.
Maybe I was wrong? |
Just configure both extensions.
Why would you deliberately want to say that your library/tool doesn't want to adhere to the end user's naming conventions? This is a strict improvement for end users and I don't see why consumers would have to have any say in this. |
Maybe the first point wasn't actually made clear enough in the library. The |
If Prettier want support this, shouldn't this enough? const {config: {searchPlaces}} = cosmiconfig("cosmiconfig").search()
const {config: prettierConfig} = cosmiconfig("prettier", {searchPlaces}).search() No one requested it, why would we make things complicate? |
So you propose that every single tool maintainer wanting to support this needs to copy and paste a snippet of code into their own code base, which pretends they are cosmiconfig? That's the whole point of a library completely taken apart. After a while, there would be subtle incompatibilities, not to mention that many (like you, apparently) don't even realize the problem that this solves, and in turn, probably won't include it. After all, no one made this before now, and no one requested it either, which is the perfect segue to your next question:
The problem is that tooling maintainers are usually living inside their own bubble. Yes, no tooling maintainer may have requested this, but I've heard a bunch of voices saying that their application, which uses a bunch of tools that have config files, all put these config files into the root of the project, which becomes annoying quickly. The addition of the Now, after I drifted away from the question a bit, I shall answer with a question of my own: Why are you so strictly against a new, optional feature that tooling maintainers don't even really have to care about? If you don't want people to use it, just don't tell them. For the most part, at least at first, people will still be unaware of this feature because they're unaware of cosmiconfig itself even though it's in their dependency tree, possibly even multiple times. |
Never mind. Hope other tool maintainers like it. Just for the record, "No one requested it" I mean I didn't see any Prettier user asked for it in Prettier repository. |
This change intends to make configuration more configurable for the end users, to suit the end user's project structure rather than the structures that (possibly multiple different) tooling maintainers imagined.
Examples
With a file named
.config.yml
in your project root with the following contents:and given that you're using stylelint and prettier (with both using a version of cosmiconfig that supports this), cosmiconfig will only look at the file
.config/stylelint.yml
and.config/prettier.yml
.The same should work from a package.json "cosmiconfig" key.
An additional feature I plan to add here is to be able to put configuration for cosmiconfig consumers directly into this file, a little bit like it works now in package.json (#261):
This was in a previous local version of mine, but I decided to remove it, because the general approach seemed too shaky to me, but I intend to try again.
To do
package.json
using acosmiconfig
key.config.{yml,yaml,json,js,cjs}
file using acosmiconfig
keyloaders
key in a non-JS file)Fixes #261
This is intended to be in a minor update, so there should be no breaking changes.
Please add your thoughts to this, I appreciate any feedback 馃檪