Fork me on GitHub

I did a threading macro for Promises in ClojureScript to make a Promise (.then p fn) chain look like the normal threading operator macro. clj-kondo started giving arity warnings on the functions that are going to be “threaded”, and was wondering if there is a way to hint at the arity fix: e.g.

(=> promise/resolve({})
  (assoc :a 1))


and it would give the arity warning on assoc equivalent, when the macro rewrites it to be:

(promise/then (promise/resolve {}) (fn [x] (assoc x : a)))
so it does get the correct arity when the ClojureScript is compiled and run, as it gives the expected results when doing tests


was wondering if there are any hints for the pre-compiled macro form in ClojureScript, or annotations on the macro


since the standard threading operators don’t give those warning


(where promise/then and promise/resolve are function wrappers for (.then p some-fn) to make it safer to call)


Love your podcast btw!


Thanks, and thanks!!!


I have never configured clj-kondo before, so a question on general practice: the macro is in a promise library, it is possible to setup the clj-kondo config with that project so that all projects that use the macro get the config, or does that need to be configured in each project that uses it?


is that for the config.edn, the hooks definition, or both?


@borkdude thanks!!! I think the lint-as config works, since I was basing it off the -> operator, it looks like I can just lint it as that operator


ah great :)