Respect the XDG base directory specification
See original GitHub issueHello,
I searched in the issues here and shockingly I haven’t found this mentioned.
Currently, cosmiconfig searches up the parent tree from the working directory, stopping at $HOME
, which is fine and most, I would assume, are okay with this.
However, for filesystem psychopaths like myself, it pains me to have to move any sort of user configuration file out $XDG_CONFIG_HOME/project-name/
directory (usually, ~/.config/project-name/
) and pollute my home directory.
Any thoughts on adding this as a final search path?
You can read up on the specification here and here.
In short, using prettier as an example, I’d imagine the workflow to go like this…
- Perform the current lookup traversal as it is done right now.
- If nothing found, check the following:
$XDG_CONFIG_HOME/prettier/config
$XDG_CONFIG_HOME/prettier/[...current standard file name checks]
Thanks for considering.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:8
- Comments:18 (7 by maintainers)
Top Results From Across the Web
XDG Base Directory - ArchWiki
Application Legacy Path Supported Since
ALSA ~/.asoundrc 577df36 · 1.2.3
Android Studio ~/.AndroidStudioX.X Android Studio 4.1
Anki ~/Anki , ~/Documents/Anki
Read more >XDG Base Directory Specification
The XDG Base Directory Specification is based on the following concepts: ... All paths set in these environment variables must be absolute. If...
Read more >XDGBaseDirectorySpecification - Debian Wiki
The XDG Base Directory Specification (XDGBDS) defines four categories of so called DotFiles and the corresponding directories in a users ...
Read more >Respect the XDG Base Directory Specification #4109 - GitHub
Under Linux/Unix systems, there is the XDG Base Directory Specifiation that states where applications should store user-related data.
Read more >1038587 - Respect the XDG Base Directory Specification ...
Issue 1038587 : Respect the XDG Base Directory Specification when using libnss. This issue has been migrated to Launch, see link in final ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Reopening the issue to encourage more people to chime in.
Strong agree that
searchPlaces
should default to XDG compliance. Library authors (by and large) will not change the defaults. So cosmiconfig’s defaults will perpetuate to all users of all libs which use cosmicconfig. In one swift PR, cosmiconfig could give control to all the users of all the cosmic-dependent libs by just making searchPlaces default to XDG’s directories.