clj-kondo

https://github.com/clj-kondo/clj-kondo
borkdude 2021-02-17T10:48:56.208400Z

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

dharrigan 2021-02-17T10:50:26.208600Z

That's great! 🙂

codeasone 2021-02-17T11:22:24.210Z

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:

2021-02-17T11:31:30.210400Z

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

2021-02-17T11:32:48.210600Z

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

👍 1
codeasone 2021-02-17T11:57:21.211200Z

Thanks for the input @delaguardo. 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.

borkdude 2021-02-17T12:00:08.211400Z

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

borkdude 2021-02-17T12:00:20.211600Z

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

codeasone 2021-02-17T12:08:14.211800Z

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.

codeasone 2021-02-17T12:08:58.212Z

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.

borkdude 2021-02-17T12:09:37.212200Z

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

borkdude 2021-02-17T18:57:19.213500Z

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/

1
1