Just a quick thank you to @tony.kay and everybody that contributed to Fulcro. I have been working through the Fulcro and Fulcro-RAD documents, and playing with Fulcro-RAD together with Datomic. My mind is blown! It is a truly remarkable piece of design and engineering. Thank you!!!
Has someone written a Clj-Kondo hook for defmutation
by any chance?
@adam678 I'm glossing over the syntax and it seems similar to defn
? So you can use {:lint-as {.../defmutation clojure.core/defn}}
perhaps.
Feel free to contribute config here: https://github.com/clj-kondo/config/blob/master/resources/clj-kondo.exports/clj-kondo/fulcro/config.edn
This config can also live in fulcro itself if the author is willing to receive a PR, so you will get it (almost) automatically when linting the classpath.
@borkdude Almost but I believe a hook is needed:
(defmutation foo [_]
(action [env] ...))
It accepts forms such as action
which should be rewritten as fn
in the hook (I guess that should do the trick). I can do it but wanted to be sure it wasn't done before. All I found is this mention:
@tvaughan https://clojurians-log.clojureverse.org/clj-kondo/2020-12-08Yeah, it's been mentioned a couple of times, but so far I have seen no real PR coming in ;)
I haven’t done any work on this
You might not believe it but https://cljdoc.org/d/com.fulcrologic/fulcro/ Enjoy!
Wow, this is a big deal actually! If you did it, then congrats to you
Great work @holyjak! 👏
For those on Mac I can also recommend https://kapeli.com/dash to access API documentation with a global shortcut (for ~any library on Clojars)
Hey, we're trying to use wrap-form-element
with the react-select
dropdown (https://react-select.com), but we have an issue with it losing focus when we have selected a new value. This behavior does not appear if we use the straight createElement
fn instead, then it keeps the focus after having selected a value.
(But if we use createElement
instead, we get another issue where we're not being able to directly set a new value on the select. We've tried using :value
, :defaultValue
, :inputValue
, :selectOption
, but nothing actually switches the selected option after it's been mounted even if the props change. So we're a bit stuck 😂)
This Clj-Kondo hook for defmutation
seems to work https://gist.github.com/helins-io/52d03847157b0dc95c6987844a74dd68
I'll use it a bit in a real project before PR'ing it to @borkdude.
@tony.kay In the longer term, would you consider a PR adding support for Clj-Kondo?
@tvaughan Indeed I noticed some false positives regarding unused vars. I wrote a second version yesterday and they are gone. Have you been using that latest version?
Just tried the new version. This seems to do the trick. Nice work @adam678!
FYI, adding "support" means adding a directory resources/clj-kondo.exports
which contains the relevant config + optional hook code for clj-kondo.
As an example:
https://github.com/wilkerlucio/pathom/blob/master/resources/clj-kondo.exports/com.wsscode/pathom/config.edn
Clj-kondo will find this automatically on the classpath when you lint the library in question and then will suggest to the user to include it.
Certainly not opposed…I think someone else was asking that as well..have not seen anything
Try a non-wrapped (create-element) and a sync transact!!
If you need help with this, just ping me either here or in #clj-kondo
Something change in cljdoc to support the cljs ecosystem better?
This is working for me @adam678 Thanks!
Oops. Spoke too soon. I see that some functions within defmutation are reported as unused. For example, I refer transact! and use it in ok-action. clj-kondo reports transact! as unused
I added {:analyze-call {com.fulcrologic.fulcro.mutations/defmutation fulcro.hooks/defmutation}}
under :hooks in config.edn, fyi
@adam678 I suggest you PR the config to the clj-kondo/config and let's iterate on that for a while. When we are mostly happy, we can migrate this to fulcro proper.
It doesn't have to be perfect the 1st time in the clj-kondo/config repo
and then we don't have to bother Tony too much with this :)
I've implemented a fix for Cljdoc to be able to deal with unknown tag literals such as #js
Hi everyone - I just published a beginner-level EQL tutorial to the fulcro-community guides. Corrections and feedback welcome! https://github.com/fulcro-community/guides/blob/main/tutorials/eql-pathom-overview.org
@tony.kay I asked this question https://clojurians.slack.com/archives/C0744GXCJ/p1613082907119400 and couldn’t get an answer. How do you kill and paste like you do here? https://youtu.be/3dZK5seIaVI?t=1238