clj-kondo 2025-04-29

I'd like to do the equivalent of {:linters {:unused-binding {:exclude-destructured-as true}}} for a specific node returned from a custom hook. What's the easiest way of doing this?

Example node sexpr: [a {:as b ...} [... :as c]]. Can I add a meta to the whole node? Something like (vary-meta node assoc :clj-kondo/ignore [:unused-binding]) but more specific. Or must I drill down to b and c specifically?

the meta should work I think

but a more easy solution could be to just generate a dummy node where you are using the local

not sure which one is easier, you choose

Which meta exactly? And on what nodes? It works on b and c, but I'm asking if I can avoid drilling down 🙂 Dummy nodes do sound simpler.

on the surrounding node should work as well

on the whole destructuring vector

But that would also ignore unused b1 in [{:as b :keys [b1]}], for which I'd like to warn.

true, then generating dummy nodes seems the only option

are you the one generating the binding or the user?

> generate a dummy node where you are using the local what node do you recommend for this btw?

maybe a vector with the names, [a b c] or so?

just anywhere in the expanded body, doesn't matter since these are ignored as unused-values

won't a vector cause an usused value ?

> doesn't matter since these are ignored as unused-values

if I recall correctly

don't know how I missed that part of your earlier message

Yep, can confirm dummy nodes work. Thanks @borkdude!

👍 1