Fork me on GitHub

Hallo! I'm playing around with the :hooks feature of clj-kondo, and I'd like to use clojure spec to use s/cat to easily parse the macro form, but SCI says it couldn't find clojure spec. Is there some extra step I need to take to get spec in there, or is it simply unsupported by SCI?


clojure spec isn't currently supported in clj-kondo hooks


Would adding a .gitignore file automatically in the .clj-kondo directory be a bad idea? To ignore the .cache:


@levitanong Note that spec is still alpha, so even if I would add spec, I would not be comfortable with adding spec1 or spec2 in this stage. Another issue is that hooks usually return transformed nodes. Spec would probably only be useful for generating warnings based on the sexprs, not transformation, but maybe it can be used in that way too, not sure.


Ah, my intent is to make a hook for ghostwheel's >defn, which is basically just defn with something extra. Manually manipulating the form is quite a hassle since defn can take many forms, but s/conform can make it manageable with s/cat and stuff like s/? and s/*. But, it's not supported, so c'est la vie! I will manage 🙂


Also feel welcome to contribute your hook back to the config repo


Thanks for the tip! Another question: Where is hooks-api defined? I can't find it so far in the repository. 😮


re: contrib, i'll do my best!


The API is documented here: The code is here: But note that anything that is not documented, should be considered implementation detail and might change or be removed.


I was looking at that clj file, but it didn't match the require statement, so I assumed it was somewhere else 😮 Is some other process involved in exposing this file as a different namespace on execution?


@levitanong Yes, the hooks are interpreted using sci:


Oh okay, I get it now! I see the sci/init call


Thanks! I think this is enough for me to get going.


I just realized there isn't much point in making a hook for ghostwheel because >defn is actually compatible with defn. so I can just use lint-as. I originally also wanted to use spec to use spec to immediately validate the form (i.e. making ghostwheel do its job statically) but that's not possible, so 🤷 😂


it's a good learning experience though!


It's a bit experimental, but if you want to play with it


Going through the readme, pretty cool! Is it compatible with clojurescript though? tried it of the cuff, but i'm getting a required namespace not available error, even after adding "configs/inspector" to my :config-paths


@levitanong hmm, no, it currently only works on the JVM, but I think a .cljs version could be made


as long as it spits out the correct data


ah, alas. I'm currently working on a cljs project right now. I do have a clj project that i'll work on over the weekend, so i'll definitely try inspector on that!