Hi. How can I get clj-kondo to follow symlinks when loading config?
In a Clojure submodule, in a monorepo, I have a .clj-kondo symlink to ../.clj-kondo. But when I run clj-kondo from that submodule's directory, --lint output indicates that the config is not being loaded.
If I add --config-dir ../.clj-kondo, it runs as expected.
You could also add this in your local project:
.clj-kondo/config.edn
with:
{:config-paths ["../../.clj-kondo"]}this will load the additional ../.clj-kondo directory
the double ../../ is because of it's relativeness to the config file
Yes! That seems like what I need. Let me try...
it would probably be nice to follow the symlink too btw, Github issue welcome
Hmmm... maybe it was loading the config via the symlink, but something else is wrong.
The sub-dir is called base. When I run clj-kondo --lint src test from base (with a config as suggested above OR a symlinked dir), I get a whole bunch of "Unresolved symbol" errors regarding deps that are in base/deps.edn. When I run clj-kondo --config-dir ../.clj-kondo --lint src test I don't see any of those "Unresolved symbol" errors.
OTOH, when I clear out the .clj-kondo/config.edn in my repo root, I get more errors, due to all the customizations (hooks, lint-as, etc) no longer being loaded.
Could it be that deps are cached in a path-sensitive way, causing the imports for those deps to not resolve correctly when run from the base sub-dir?
The affected libs are potemkin and manifold, if that matters.
I need a repro in code in a github repo since doing this in prose is too confusing for me :)
.
I ran the instructions from https://github.com/clj-kondo/clj-kondo/blob/master/doc/install.md#installation-script-macos-and-linux on my macbook and got:
$ ./install-clj-kondo
Downloading to /tmp
mv: rename /tmp/clj-kondo to /usr/local/bin/clj-kondo: Permission denied
It seems like this has been run into before.
https://clojurians.slack.com/archives/CHY97NXE2/p1708629564843289?thread_ts=1708625016.482119&cid=CHY97NXE2
I was able to work around it, but it might be worth a mention in the docs.
Thanks! gratitudeThe docs say something about sudo I believe
I did ctrl+f on this page https://github.com/clj-kondo/clj-kondo/blob/master/doc/install.md#installation-script-macos-and-linux and couldn't find any mention of sudo.
Ah then it must be the babashka READMe that mentions it
Sorry for confusing those
No problem!