question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Respect the XDG base directory specification

See original GitHub issue

Hello,

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…

  1. Perform the current lookup traversal as it is done right now.
  2. 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:open
  • Created 5 years ago
  • Reactions:8
  • Comments:18 (7 by maintainers)

github_iconTop GitHub Comments

7reactions
davidtheclarkcommented, Jan 16, 2019

Reopening the issue to encourage more people to chime in.

5reactions
jasonkarnscommented, Mar 24, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found