Would it make sense to have an easy option for macroexpansion hooks which just passes the defmacro body directly to SCI? Use case is for really simple syntactical transformation macros which would be a direct copy-paste into the .clj-kondo folder anyway.
Isn’t this what the macroexpand hook already is?
Unless I'm mistaken, the target of the :macroexpand mapping can't refer to the source file itself?
E.g.
(ns hook.repro
{:clj-kondo/config
'{:hooks {:macroexpand {hook.repro/if-not-let
hook.repro/if-not-let}}}})
(defmacro if-not-let
[bindings then else]
`(if-let ~bindings ~else ~then))
(if-not-let [x 1] 2 3)
I'd have to copy it to a separate file in <project-root>/.clj-kondo/hook/repro.clj for it to be picked upI asked about this a while ago, see point 2 on what's missing for this to be possible https://github.com/clj-kondo/clj-kondo/discussions/2388#discussioncomment-10505710
my workaround has been to automate the copying of the macros I need and just make sure the namespaces containing the macros work standalone in sci https://github.com/typedclojure/typedclojure/blob/main/script/regen-kondo.sh
thanks for the comment. I was AFK and I was about to link to an earlier thread
whoops, I only looked in Issues before asking 🤦 Will follow up there, thanks!