clj-kondo

https://github.com/clj-kondo/clj-kondo
tvaughan 2020-12-08T17:58:01.070700Z

I'm trying to come up with an appropriate clj-kondo config for Fulcro mutations, https://book.fulcrologic.com/#_mutations. Specifically this form:

(defmutation add-person [params]
  (action [env] ...)
  (remote [env] ...)
  (rest [env] ...)
  (ok-action [env] ...)
  (error-action [env] ...))
Currently my config looks like:
{:lint-as
 {clojure.test.check.properties/for-all clojure.core/let
  com.fulcrologic.fulcro.components/defsc clojure.core/defn
  com.fulcrologic.fulcro.mutations/defmutation clojure.core/defn
  com.wsscode.pathom.connect/defresolver clojure.core/defn}
 :linters
 {:unresolved-symbol
  {:exclude
   [(com.fulcrologic.fulcro.mutations/defmutation [action error-action ok-action remote])]}}}}
This works, but I also want to have action, error-action, etc. treated like defn too. Is this possible?

borkdude 2020-12-08T22:06:12.071200Z

I activated discussions on clj-kondo: https://github.com/borkdude/clj-kondo/discussions. Nice way for archiving Q/A.

borkdude 2020-12-08T22:08:00.072500Z

@tvaughan Hmm, that looks similar to defprotocol or defrecord but not quite. I think your best best is to exclude all unresolved symbols or better, write a hook for fulcro and submit it to https://github.com/clj-kondo/config or the fulcro repo itself (https://github.com/borkdude/clj-kondo/blob/master/doc/config.md#exporting-and-importing-configuration)

tvaughan 2020-12-08T23:35:30.074Z

Looks like I'll need to write a hook. Thanks for the pointer @borkdude

Aleksander Rendtslev 2020-12-09T09:59:18.076800Z

@tvaughan let me know if you're jamming on this. I might take a stab at it today with the documentation borkdude posted below, but you'll probably get there faster if you're going for it

tvaughan 2020-12-09T11:19:16.080100Z

Hey @aleksander990 I won’t get to this until next week. Please go for it. I’ll be happy to play tester if you’d like