aroemers / mount-lite

mount, but different and light
https://cljdoc.org/d/functionalbytes/mount-lite/
Eclipse Public License 1.0
102 stars 8 forks source link

Add clj-kondo support for defstate macro #30

Closed D00mch closed 1 year ago

D00mch commented 1 year ago

Lib users will have hooks copied into their local .clj-kondo folder:

image

Demo (defstate behaves like defonce, :start is required): defstate

Clj-kondo lib's hooks examples: https://github.com/clj-kondo/clj-kondo/discussions/1528

aroemers commented 1 year ago

Thanks for the PR. Know that I am looking at it and will provide feedback soon.

aroemers commented 1 year ago

@D00mch, Thanks again for the PR. While reviewing I saw that the implementation was not handling docstrings and metadata maps yet (defstate supports them, equal to a regular defn). It also didn't account yet for the implicit this parameter in the :stop expression.

I took the liberty of giving a try myself. Instead of using the analyze-call hook, I opted to use the macroexpand hook. I find it easier to work with.

Can you try your this version in your editor? (nice animations by the way!)

D00mch commented 1 year ago

Yes, it work great, and macroexpand is a better fit Screen Recording 2022-12-03 at 10 23 18

aroemers commented 1 year ago

Thanks for testing! It is released as 2.3.0.