Hello again. I'm getting an unexpected error: "Expected: char sequence or nil, received: map." The minimal example:
(defn foo []
(let [res (str)] ; any fn with ":ret :string", identity
{:b {:a res}})) ; works fine with (subs "" 0)
(str/split-lines
(:a ;<- here is the problematic line
(:b
(foo))))
Everything works fine if I use a nesting level other than 2. If I bind foo locally - it works fine too.bug, can you report it?
on github issues
sure
https://github.com/clj-kondo/clj-kondo/issues/2575 sorry, pretty short one, I'm a bit busy rn
thanks!
I'm also busy, with other clj-kondo issues laughcry
PSA ⚠️ Please try clj-kondo :mvn/version "2025.06.06-20250725.153320-16" if you can. This should solve a memory issue.
The goal is to be as fast as before, not slower. So if you can run this version against your main projects, that's be sweet.
Claude likes to generate code with nested reader conditionals (ie, #?(:cljs #?(:cljs (blah))). I don’t think clj-kondo has a linter to detect this situation and I can’t find documentation on how reader conditionals are represented in the AST. Can someone point me in the right direction?
Can confirm Claude went nuts doing this in a cljc for me this past month
This isn't invalid per se. E.g. sometimes I write:
#?(:clj (do #?(:clj 2 :bb 3))fair enough but claude seems to like
#?(:cljs (do #?(:clj 2 :bb 3))that's surely invalid
I mean, not invalid, but nonsense
🙂
exactly
clj-kondo does a decent job of keeping claude on a good path
we could make this a linting thing yeah, issue welcome
I have a few project-specific linters that help maintain architectural sanity. This particular linter would help a lot, I think
Yeah, I’ll open an issue
how it works in clj-kondo: it (currently) lints .cljc files two times: once for clojure and once for clojurescript. it selects the reader conditionals in a function called select-lang recursively. so we'd have to check this in this logic
after that clj-kondo is unaware of any reader conditionals
ah, so it doesn’t currently have the opportunity to detect a nested situation
yes, in select-lang I think
oh ok
but not sure
gotcha. I’ll open an issue and take a look at the code