Fork me on GitHub
#clj-kondo
<
2023-03-06
>
andersmurphy09:03:00

Hi, is there a way to use specs in :macroexpand hooks? I’m using a spec to conform some macro arguments and it doesn’t seem to work even when using the full name clojure.spec.alpha/def etc.

borkdude10:03:28

@U0JEEGD4N doesn't currently work. I want to wait until spec comes out of alpha in order to not increase binary size and have to support two versions

🙏 2
andersmurphy10:03:41

That’s fine I can use the messy first draft version of the macro (that doesn’t use spec) for the linting hook. For the most part the macroexpand hook just works which is really nice! Thank you, clj-kondo is awesome.

❤️ 2
camden21:03:44

Let’s say we have the following clj-kondo configuration:

{:lint-as {foo.core/mydefn- clojure.core/defn-}}
clj-kondo will correctly make mydefn- lint as a private function. What I want is the analogous behavior for def:
{:lint-as {foo.core/mydef- clojure.core/def-}} ;; ?! clojure.core/def- doesn't exist: you have to add the ^:private meta tag to a def to get it to be private
Any way to get this behavior?

borkdude21:03:22

I'm afraid this doesn't exist. Probably a hook will make this work.

camden21:03:44

bummer, thanks!

borkdude21:03:16

but does:

(my-def ^:private foo ...) 
work perhaps?

borkdude21:03:32

It seems so

camden21:03:00

yeah i want developers consuming this not to have to do that

borkdude21:03:08

I figured as much

camden21:03:25

really appreciate the help though--will share back if i make a hook for this