Fork me on GitHub
#clj-kondo
<
2020-09-29
>
zilti10:09:52

For those interested: I created an RPM for clj-kondo. AppImage and .deb builds may follow. https://build.opensuse.org/package/show/home:zilti:clojure/clj-kondo

borkdude10:09:18

@zilti Amazing. Feel free to add to the install instructions in the clj-kondo repo

serioga12:09:35

looks like I cannot do #?(:clj #_{:clj-kondo/ignore [:unused-binding]}) 🙂

borkdude12:09:48

there's an issue for that, will fix

borkdude12:09:54

oh with reader conditional. can you please give the full example. it might be a different issue

ullrich12:09:20

omg, I just spent an hour understanding why (name my-keyword) didn’t work while (clj->js my-keyword) did… classic case of shadowed variable. Can’t wait for kondo support for this 😄 “Name is forever nom.”

serioga12:09:52

@borkdude full example is simple: I want to ignore bindings for :clj but not for :cljs. So I did not find solution for this. But I can create ticket.

borkdude13:09:03

@serioga this works:

(ns foo-ns
  {:clj-kondo/config '{:linters {:unused-binding {:level #?(:clj :off :cljs :warning)}}}})

(defn foo [x]
  #?(:cljs x))

serioga13:09:49

but I need to disable for the form only, not whole namespace.

borkdude13:09:06

then use an underscore for the branch you want to ignore

serioga13:09:29

“then use an underscore for the branch you want to ignore” I did not understand, what do you mean

#_{:clj-kondo/ignore [:unused-binding]}
(defn- select-field
  [state column options idx remove-value classes]
  ...)

borkdude13:09:00

(defn foo [#?(:cljs x
              :clj _x)]
  #?(:cljs x))

serioga13:09:52

this is too hardcore 🙂

borkdude13:09:20

or simply:

(defn foo [x]
  x ;; ignore for clj
  #?(:cljs x))

borkdude13:09:29

what you would like is:

#_{:clj-kondo/ignore #?(:clj [:unused-binding] :cljs []}
right?

borkdude13:09:47

this isn't supported yet, but I'll see what I can do for next release

serioga13:09:41

well, I aware about workarounds. I thought to use new “Ignore warnings in an expression” feature as less obtrusive but found that I want it to be selective for file type 🙂

borkdude13:09:11

can you confirm the above is what you want?

serioga13:09:49

yes, I've tryed, it compiles and does not work :-)

serioga13:09:29

yes, this is fine.

borkdude13:09:38

ok, the problem is that reader comments are processed before reader conditionals, but I'll see if that can be fixed

serioga13:09:49

Maybe you will find place for the specification of the effective file type in the :clj-kondo/ignore data itself 🙂

borkdude13:09:58

I think using reader conditionals for this is more elegant

3
serioga14:09:10

interesting, clj-kondo does not parse valid (or)

Can't parse dev\user.clj, Wrong number of args (0) passed to: clj-kondo.impl.types.utils/union-type

borkdude14:09:17

feel free to post an issue