-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
feat: add option to configure standard via rc config file #194
base: master
Are you sure you want to change the base?
Conversation
This is very useful as it means our package.json only changes when deps change instead of also configs. Any view on this PR? |
Any view on this? I see that |
I like this idea since I assume the primary goal is to allow a .standardrc within the project directory? Is there an implied feature that That said, if we can define |
e812986
to
5a3cd56
Compare
@jasonkarns correct, that was my idea. I configure effectively all of my other tooling using dedicated config files except You make an interesting point. Admittedly, I am not familiar with the XDG basedir spec, besides just skimming it, but definitely familiar with some of the problems that it's trying to address 😄. I see some tools I use, like ESLint currently uses Aligning with ESLint and how it scans for a config file seems more kosher for this project IMO. That being said, if a maintainer thinks otherwise, perhaps merging #214, i'll be happy to make the changes that you suggested. |
e28ab8a
to
d22f7df
Compare
Good idea, unfortunately there are conflicts with |
Thanks for the followup @divlo . I can rebase and fix the conflicts. Though I need to make some changes to compliment #214 w.r.t @jasonkarns comment. Looks like cosmiconfig doesn't respect XDG (cosmiconfig/cosmiconfig#152), so I am currently trying to put together a PR there that will hopefully be merged. Then we could use that here. |
2e6a4af
to
632fef0
Compare
@divlo I was able to figure out how to fallback to XDG config base dir without the PR to cosmiconfig. Though I probably will still try to PR there. Basically what happens is standard-engine does the regular search for a config file, up to the user's home dir. If a config isn't found, then it will check XDG_CONFIG_HOME/${cmd} for a config* file. I also added a test for this. I think this is ready to go. Let me know if it needs anything else! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job! Unfortunately, the Travis CI checks failed. Maybe because you used var
at some places.
Could you tell us, what would need to change once your changes on cosmiconfig is released ?
Also maybe we could add explanation about that feature in the README
.
I fixed the |
Hmm, looks like the test for XDG is failing on CI. The tests work on my local, so this is odd. 🤔 |
I wasn't clearing the require cache properly in the test, but it was using my own |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Thanks for Standard! ❤️
This adds the ability to configure the StandardJS engine outside of
package.json
, ie. in a file like.standardrc
,.standardrc.js
, etc. Config inpackage.json
is still prioritized over those options though, so no current behavior is changed. This removes a dep onpkg-conf
and adds a dep oncosmiconfig
.From
cosmiconfig
README:I personally prefer tooling configuration outside of
package.json
bc thenpackage.json
will change only when a dep or script is updated, basically; easier to spot in a PR. Also makes it easier to spot when tooling config changes in a PR as well.Also added a test for it as well.
Let me know what else it would need and thanks again!