I'm soon resuming work on the macroexpand feature and would still very much like feedback on this. https://clojureverse.org/t/feedback-wanted-on-new-clj-kondo-macroexpansion-feature/6043
In a different issue someone suggested it would be useful to have a hook in the function call so you can lint arguments to some function yourself. This would be a generalization of the macroexpand feature as it is proposed now. E.g. with re-frame, a dispatch function should get a qualified keyword. This is something people can't do with the analysis output today (although that could also be extended with the sexpr).
so like this:
@borkdude it would be nice to attach location info somehow
one of the problems in the above example is that keywords and numbers don't carry metadata
also I think rather than throwing people can return :findings
with :level
, :row
, :col
etc.
The row and col come from the metadata of the sexpr elements, but in case of numbers of keywords these aren't present
Of course the function could get an additional :node
thing which is the raw rewrite-clj node
and then you can lookup the metadata yourself
using (-> node :children second meta)
for example
A basic thing to do is point at the argument
The rewrite node is most powerful
> A basic thing to do is point at the argument what do you mean?
A common use case that it would be nice to make easy.
right, or a path into the sexpr, like [1 0]
which would mean the second child node and then the first child node of that
and then clj-kondo can figure it out
this is probably already a power-feature, so the raw rewrite-clj node is probably good to start with
Yeah I think you're right
I'm not sure you can close 468 from this, as custom linters might be broader, like less than 10 functions per namespace.
I followed you until like less than 10 functions per namespace.
I mean, then I became confused about what you are trying to say
with fixed location:
unless people give me more concrete use cases, I don't know what to make of 468 really
but I think the macroexpansion -> hooks generalization is a good one