Random thought (rooted in how many of these I have due to react) that I wanted to get some basic feedback on before opening an issue: linting unused arguments when calling a function which destructures in it's arglist.
(defn foo [{:keys [a b]}])
...
(foo {:c 10})
For react, this is a lot of code because of props.
Obviously it only works for literal maps, but I still think it's pretty useful for that?
What do you mean with unused arguments?
Something else than clj-kondo already does apparently?
*unused parameters that should be
So in the above example you'd lint :c is not a used key
I don't think Clojure works that way in most cases: data is passing through all the time which is not used in one place but maybe down the line
It would be specifically for arglists destructuring where :as
is not used.
I think in most cases Clojure doesn't care about extra keys, except maybe in edges of systems
Wouldn't be an error, for sure. It's for when something is removed from use I guess.
Hmm, which would be a breaking change I guess. Only in internal use is it not. So perhaps not a good choice. But then again, arglists are warned about.
The change that got me here was removing a keyword arg from a component, and then replacing uses of that arg with a different one.
clj-kondo does have an option to check for required keys
I don't see that in the list of optional linters, could you point me the right way?
@dominicm it's part of the type stuff: https://github.com/borkdude/clj-kondo/blob/master/doc/types.md so you explicitly have to state the required and optional keys for a function's argument
I use it in one place in clj-kondo where I need to construct a map with 5 keys of which I always forget one