Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add clj-kondo support for defstate macro #30

Merged
merged 4 commits into from
Dec 3, 2022
Merged

Conversation

D00mch
Copy link
Contributor

@D00mch D00mch commented Nov 26, 2022

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: clj-kondo/clj-kondo#1528

@aroemers
Copy link
Owner

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

It has been rewritten to use the macroexpand functionality of
clj-kondo; this makes it more readable and maintainable.
@aroemers
Copy link
Owner

aroemers commented Dec 2, 2022

@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
Copy link
Contributor Author

D00mch commented Dec 3, 2022

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

@aroemers aroemers merged commit 989282e into aroemers:2.x Dec 3, 2022
@aroemers aroemers self-assigned this Dec 3, 2022
@aroemers
Copy link
Owner

aroemers commented Dec 3, 2022

Thanks for testing! It is released as 2.3.0.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants