Fork me on GitHub

Today I show you how to use babashka and clj-kondo to find var usages in the current project.


That's great! 🙂


Any mitigation or advice concerning the following false warning report? Seems to be down to the use of the reader condition #?@ in a cljc file:


you can add a comment to instruct clj-kondo to ignore that problem for :clj

#_{:clj-kondo/ignore #?(:clj [:unused-binding] :cljs [])}
(defn foo
  #?(:clj 1 :cljs x))


in fact this is not a false warning report. for cljc files clj-kondo is trying to analyze all contexts (clj and cljs) and your snippet has unused binding for clj scope

👍 3

Thanks for the input @U04V4KLKC. It would be nice if I could configure the lint reports so that:

#_{:clj-kondo/ignore #?(:clj [:unused-binding] :cljs [])}
(defn foo
  #?(:clj 1 :cljs x))
style "ignoring" is applied across the board for my .cljc files and their associated vars, as I see similar reports quite often in my work project.


@U191H9E5C Why would you disable the warning for one language and not the other?


You can simply disable unused-binding warnings for the entire namespace


We have a tree of cljc code containing uix components, which we render server-side and subsequently render in a "rehydrated" context where cljs logic kicks-in. A number of our functions have parameters that are only referenced in the :cljs expressions within the functions, hence the clj-kondo warnings I showed in the example above are prevalent.


Most of the time I don't care if a parameter is used in either clj or cljs land, I only care if it isn't used anywhere in a function. Hopefully it makes sense.


Feel free to post an issue about this (and I will label it with the sponsor tag :))


If you are interested in clojure-lsp (powered by clj-kondo), @ericdallo will be presenting at the Dutch Clojure Meetup in 5 minutes. Welcome to join. Details here:

clojure-lsp 3
clj-kondo 3