clj-kondo 2026-09-17

hey! any plans to implement new linters on top of :excess & :missing? like levenshtein distance hints vs known params : "you wrote :for-update but did you mean :for-update?" kind of warnings

πŸ™ 1

clj-kondo already checks keys that are missing, what is still missing?

Check for typos on calls to fns taking maps with destructuring (:keys)

if a key is not required, how can you be sure it's a typo

@borkdude we can’t be sure, but perhaps we could suggest when we think it’s likely: ex:

(defn foo [{:keys [for-update?]}])

(foo {:for-update true})
kind of like https://github.com/bhauman/spell-spec?

people should stop using question marks in keywords imo.

πŸ‘ 2

but yeah we could make a linter for this that is turned off by default

not sure what the impact on performance is (probably ok)

it would probably would have to be integrated with the type system since that records all the accumulated keys

well I guess it's not necessarily bound to excess & missing

I'm proposing the following change: if a namespace is used in a hook (macro-expansion), clj-kondo will consider it as already being required. This allows you to use macros that use other namespaces without requiring those namespaces (as is often the case in clj-kondo). I think the false positives outweigh the false negatives here.

that's probably fine, yeah

what are the false negatives?

false negative could be when e.g. a clojurescript JVM macro expands into a namespace usage that isn't required at runtime. but very rare I'd say. and no regressions found

πŸ‘ 1

in that case, i'd say you're good to go