Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Find a way to make Hiccup forms easier to analyze #522

Open
Deraen opened this issue Dec 22, 2020 · 1 comment
Open

Find a way to make Hiccup forms easier to analyze #522

Deraen opened this issue Dec 22, 2020 · 1 comment

Comments

@Deraen
Copy link
Member

Deraen commented Dec 22, 2020

clj-kondo/clj-kondo#25

  • Optional way to create normal Reagent components from functions using some keyword, like :n> :$. Would work the same way as [comp], but the keyword would make it possible to find the calls.
    • Namespaced keyword would be even better, but would be quite verbose.
  • Provide function based API to optionally replace Hiccup syntax (like om.dom, helix.dom).
@borkdude
Copy link

borkdude commented Dec 23, 2020

Alternatives (not necessarily better than what's already mentioned):

  • macro which expands into a vector call:
(defmacro f [& args] `[~@args])
(r/f component  1 2 3)

This solution doesn't need any changes to other code in Reagent, but allows static analysis to detect reagent calls accurately.

  • clj-kondo could have a mode in which it always treats [foo 1 2 3] as a function call in .cljs files. False positives should be handled by users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants