clj-kondo 2025-09-17

has swapping the arguments to get ever happened to you? like (get 1 {1 :foo}) someone made linter for it here: https://github.com/clj-kondo/clj-kondo/pull/2625/files but I'm not sure if it makes sense to have this linter? happy to hear from you

the only real time that's happened is in a thread-through that i have backwards

couldn't this be solved in the user config by providing stricter type signature for get ?

that's what I was thinking too. we could solve this via the type system in clj-kondo by stating that numbers and keywords aren't ilookups

and then ignore the fact that users can extend ilookup to those

because who in their right mind would do that... right? ;)

get/update/take et al are the functions that I'll most-frequently double-check to confirm I have the right order, I usually do, but whether it be threading like Darin mentioned, or my current braincell being half-powered, one will slip by every now and again

agree that in threads I probably also have double checked it and made mistakes

I did find an issue in a production codebase when making the get type more strict (than it really is since it never throws):

so maybe it's worth it!

👍 1
❤️ 1
🎉 2

Now merged to master. Give it a go if you can on your work project and look for ILookup lint warnings

clj -Sdeps '{:deps {clj-kondo/clj-kondo {:git/sha "a1ec30c187e0b79b32c859dcbdbadfa5ad02b734" :git/url ""}}}' -M -m clj-kondo.main --lint src:test

🎉 3

Does kondo have a linter for

(let [result (blah ,,,)]
  result)
? I don't see anything, but am I missing it?

what would the lint be for?

unnecessary let; it could just be (blah ,,,)

it finds redundant (do ... ) already, so yeah it should be covered