clj-kondo

https://github.com/clj-kondo/clj-kondo
zilti 2020-09-29T10:30:52.043800Z

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

borkdude 2020-09-29T10:32:18.044300Z

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

serioga 2020-09-29T12:04:35.045100Z

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

borkdude 2020-09-29T12:05:48.045300Z

there's an issue for that, will fix

borkdude 2020-09-29T12:08:54.045900Z

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

ullrich 2020-09-29T12:34:20.048400Z

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.”

serioga 2020-09-29T12:34:52.049Z

@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.

borkdude 2020-09-29T13:02:03.049200Z

@serioga this works:

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

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

serioga 2020-09-29T13:03:49.049900Z

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

borkdude 2020-09-29T13:12:06.050200Z

then use an underscore for the branch you want to ignore

serioga 2020-09-29T13:14:29.050900Z

“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]
  ...)

borkdude 2020-09-29T13:16:00.051800Z

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

serioga 2020-09-29T13:16:52.052500Z

this is too hardcore 🙂

borkdude 2020-09-29T13:17:20.052700Z

or simply:

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

borkdude 2020-09-29T13:19:29.053900Z

what you would like is:

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

borkdude 2020-09-29T13:19:47.054300Z

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

serioga 2020-09-29T13:20:41.055300Z

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 🙂

borkdude 2020-09-29T13:21:11.055600Z

can you confirm the above is what you want?

serioga 2020-09-29T13:21:49.055700Z

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

serioga 2020-09-29T13:22:29.056100Z

yes, this is fine.

borkdude 2020-09-29T13:22:38.056400Z

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

serioga 2020-09-29T13:24:49.057600Z

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

borkdude 2020-09-29T13:25:58.057900Z

I think using reader conditionals for this is more elegant

1
serioga 2020-09-29T14:10:10.058700Z

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

borkdude 2020-09-29T14:17:17.058900Z

feel free to post an issue