This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-04-08
Channels
- # announcements (13)
- # asami (9)
- # aws (1)
- # aws-lambda (1)
- # babashka (37)
- # beginners (70)
- # calva (19)
- # cider (23)
- # clara (10)
- # clj-kondo (15)
- # cljdoc (14)
- # clojure (3)
- # clojure-bay-area (1)
- # clojure-europe (40)
- # clojure-nl (3)
- # clojure-serbia (1)
- # clojure-uk (31)
- # clojuredesign-podcast (1)
- # clojurescript (9)
- # community-development (7)
- # data-oriented-programming (1)
- # datomic (44)
- # emacs (13)
- # figwheel-main (14)
- # fulcro (6)
- # jobs (6)
- # malli (15)
- # meander (7)
- # off-topic (74)
- # other-languages (1)
- # pathom (3)
- # portal (3)
- # re-frame (25)
- # reagent (6)
- # reitit (2)
- # reveal (1)
- # rewrite-clj (6)
- # ring (5)
- # shadow-cljs (11)
- # specter (7)
- # xtdb (7)
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 testswas wondering if there are any hints for the pre-compiled macro form in ClojureScript, or annotations on the macro
(where promise/then
and promise/resolve
are function wrappers for (.then p some-fn)
to make it safer to call)
@steven.proctor You can write a custom hook for this macro or just turn off arity warnings in that macro. https://github.com/clj-kondo/clj-kondo/blob/master/doc/config.md https://github.com/clj-kondo/clj-kondo/blob/master/doc/linters.md https://github.com/clj-kondo/clj-kondo/blob/master/doc/hooks.md
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?
@steven.proctor That is possible. That mechanism is explained here: https://github.com/clj-kondo/clj-kondo/blob/master/doc/config.md#exporting-and-importing-configuration