Fork me on GitHub

Howdy. I'm using "let-def" instead of "let" to debug some things. Using emacs/lsp/clj-kondo I get warnings (which I find visually hard to ignore) around my "let-def" ... I tried

$ cat ~/.clj-kondo/config.edn 
{:lint-as {myspace/let-def clojure.core/let } }
but I still get warnings. Does lsp use a different config location??


Can you try without clojure-lsp?

clj-kondo --lint your.clj


oh you have it in your home config? this is not the right location. It should be:



Humm.... I wonder if I'm out of date.

$ /home/linuxbrew/.linuxbrew/Cellar/clj-kondo/2022.11.02/bin/clj-kondo --lint migrate/migrate_bt_code.clj 
migrate/migrate_bt_code.clj:45:13: error: Unresolved symbol: cols
migrate/migrate_bt_code.clj:46:9: error: Unresolved symbol: nxt
migrate/migrate_bt_code.clj:47:9: error: Unresolved symbol: authorrity-id-bch
migrate/migrate_bt_code.clj:48:9: error: Unresolved symbol: authority-description-bch
migrate/migrate_bt_code.clj:49:9: error: Unresolved symbol: authority-id
those are the let-def bindings


can you make a fully standalone git repo with a repro? then I'll have a look in an hour or so


also insert the config in the in .clj-kondo/config.edn in the repo root

bherrmann13:01:22 fyi, command line clj-kondo only reports 1 issue - yet emacs now shows 2... joy. but anyway, the single issue is in the repo.


move config.edn to .clj-kondo/config.edn


and then:

$ clj-kondo --lint m/my_boat.clj
linting took 26ms, errors: 0, warnings: 0


if you're using clojure-lsp, you might have to restart your session (once you put the config in the right place, I've seen two issues during this conversation!): lsp-workspace-restart



$ clojure-lsp --version
clojure-lsp 2022.05.03-12.35.40
clj-kondo 2022.04.26-SNAPSHOT


I think thats my problem.


upgrading wouldn't hurt, but after that it should work. let me know if you run into any other stuff


~/let-def-issue$ clojure-lsp --version
clojure-lsp 2023.01.26-11.08.16
clj-kondo 2023.01.20
~/let-def-issue$ emacs m/my_boat.clj
# emacs shows 2 errors in file
~/let-def-issue$ clj-kondo --lint m/my_boat.clj
m/my_boat.clj:10:11: error: Unresolved symbol: puma
linting took 10ms, errors: 1, warnings: 0
~/let-def-issue$ rm -rf .clj-kondo/
~/let-def-issue$ clj-kondo --lint m/my_boat.clj
linting took 10ms, errors: 0, warnings: 0

seems like emacs/clojure-lsp is not using ~/.clj-kondo/config.edn


fyi: CIDER 1.6.0 (Buenos Aires)


As I said earlier the home config should be in .config/clj-kondo


Sorry, I somehow missed that I had the config.edn file in the wrong directory. FYI: It seems clj-kondo reads from it though.

$ strace clj-kondo --lint m/my_boat.clj 2>&1 |grep --color config.edn
stat("/home/bob.herrmann/.clj-kondo/config.edn", {st_mode=S_IFREG|0664, st_size=133, ...}) = 0
open("/home/bob.herrmann/.clj-kondo/config.edn", O_RDONLY|O_LARGEFILE) = 4
lstat("/home/bob.herrmann/.clj-kondo/config.edn", {st_mode=S_IFREG|0664, st_size=133, ...}) = 0
but then I if I move the config (as you suggest)
$ strace clj-kondo --lint m/my_boat.clj 2>&1 |grep --color config.edn
stat("/home/bob.herrmann/.config/clj-kondo/config.edn", {st_mode=S_IFREG|0664, st_size=133, ...}) = 0
open("/home/bob.herrmann/.config/clj-kondo/config.edn", O_RDONLY|O_LARGEFILE) = 4
It uses that also. And! emacs/clojure-lsp seemed to like the latter one! (like you said.) Woo Hoo!! THANKS 👍 🔥 👍 🔥

🎉 2

@U0502D2GL It reads that file because it's the first .clj-kondo/config.edn it comes across in a parent directory. If you would have that config in $project/.clj-kondo/config it wouldn't have searched higher up.


Great, thanks. It is working great. And I'm very very happy. Seems irrational to be so excited about such a small thing, but man it kicks butt.

Daniel Jomphe21:01:37

After, what, 2 years of using clj-kondo, this is my first non-understood (potentially) false positive. Cheers for such a great, unobtrusive tool!!! With that said, here's what's puzzling me:


Can you post a snippet where I can reproduce this locally?

Daniel Jomphe21:01:41

Sure, thanks a lot!!

(defn foo
  ([^clojure.lang.Symbol var-sym]
  ([^String a-ns
    ^String a-name
    & {:keys [debug?]}]       ; remove both this & keys ...
   (str a-ns a-name debug?))) ;         and `debug?`    ... and error goes away

(foo 'inc)


Interesting, yes, this looks like a bug

Daniel Jomphe21:01:20

Might have appeared around the time we switched to Clojure 1.11.


Just place a #_:clj-kondo/ignore before (foo 'inc) to get rid of it


(as a workaround, I'll fix it)

Daniel Jomphe21:01:56

Yes, but I use it in many areas 🙂 Thanks a lot Michiel!


You can put this in your config to repair the type inference:

{:linters {:type-mismatch
              {:arities {1 {:args [:symbol]}
                         :varargs {:args [:string :string {:op :rest :spec :any}]}}}}}}}}

☝️ 2
Daniel Jomphe22:01:37

Yes, this does it - thanks a lot for the workaround. I'll keep an eye on release notes in the future to know when to remove the workaround. 🙂

Daniel Jomphe22:01:50

Subscribed to issue and starred the repo, thanks a lot again!!

😆 2