Fork me on GitHub
#clj-kondo
<
2021-02-17
>
borkdude10:02:56

Today I show you how to use babashka and clj-kondo to find var usages in the current project. https://youtu.be/TvBmtGS0KJE

dharrigan10:02:26

That's great! 🙂

codeasone11:02:24

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

delaguardo11:02:30

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

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

delaguardo11:02:48

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
codeasone11:02:21

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
  [x]
  #?(: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.

borkdude12:02:08

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

borkdude12:02:20

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

codeasone12:02:14

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.

codeasone12:02:58

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.

borkdude12:02:37

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

borkdude18:02:19

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: https://www.meetup.com/en-AU/The-Dutch-Clojure-Meetup/events/trmqnpyccdbnb/

clojure-lsp 3
clj-kondo 3