This is somewhat of a similar ask to #250, but with a little different use context:
I'd like to put my XO configuration in a separate file (.xorc.*), just like how ESLint and Prettier do it.
Having all of those config options in a single file really clutters up my package.json, and I'd like to be able to more easily copy/symlink files from a central location, instead of having to copy/paste configurations into my package.json every time.
IssueHunt Summary
IssueHunt has been backed by the following sponsors. Become a sponsor
Using a package like cosmiconfig, to replace pkg-conf altogether, seems like the best option. It will import configurations from a variety of locations, including package.json, .xorc, .xorc.json, .xorc.yaml, .xorc.js, etc.
Additionally, _I think_ it removes the need for defining { "xo" : false } in nested package.jsons — instead of traversing upwards until it finds the first package.json, and skipping it if skipOnFalse is true (like with pkg-conf), it will just keep searching upwards until it finds a defined config. So if you just want to use a single top-level xo config, just define it in the uppermost package.json (or .xorc) and nowhere else.
and I'd like to be able to more easily copy/symlink files from a central location, instead of having to copy/paste configurations into my package.json every time.
Why are you copy-pasting the config each time? That sounds like a maintenance nightmare. Instead, just create a shareable ESLint config file and all you need in your package.json is:
{
"xo": {
"extends": "name-of-your-shareable-config"
}
}
That's beside the point though — XO is so customizable, that it's really frustrating that I _have to_ put my config in the package.json, especially when so many other tools make that optional. While it may work great for a lot of people, I'm personally not a fan of defining my configurations in my package.json — I want nothing in there besides metadata and dependencies.
I issued a pull request yesterday (hopefully) with the fix.
A reason to adopt cosmiconfig would be https://github.com/xojs/xo/pull/279#issuecomment-356021126
This is now accepted. See https://github.com/xojs/xo/pull/279#issuecomment-407250935.
@issuehuntfest has funded $80.00 to this issue. See it on IssueHunt
A global configuration, which is referenced in package.json would be a nice option. I want to start working on a solution.
@bunysae I'm not interested in supporting global config like that (https://github.com/xojs/xo/issues/250 what I will accept). That comes with a lot of surprising downsides. This issue is about supporting external (local) config file.
Okay i will support local and global shareable files as mentioned in your comment.
@sindresorhus has rewarded $72.00 to @pvdlg. See it on IssueHunt
Most helpful comment
A reason to adopt
cosmiconfigwould be https://github.com/xojs/xo/pull/279#issuecomment-356021126