Skip to content

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

Closed

Description

@Deraen

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).

Activity

  1. borkdude commented on Dec 23, 2020

    @borkdude

    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.
  2. Kaspazza commented on Nov 5, 2024

    @Kaspazza

    Form-2 components are marked by clj-kondo as unused binding

    (defn outer 
      [a b c]            ;; <--- those parameters will get marked by clj-kondo as unused-binding
      ;;  ....
      (fn [a b c]        ;; <--- they are repeated here
        [:div
          (str a b c)]))
    
  3. borkdude commented on Nov 5, 2024

    @borkdude

    @Kaspazza The way to solve this is to write:

    (defn outer [_a _b _c] ...)
    
  4. Kaspazza commented on Nov 5, 2024

    @Kaspazza

    @borkdude Hmmm, I was in a mindset it is used so there should be no warning... But it makes sense... Thanks!

  5. locked and limited conversation to collaborators on Jan 28, 2025
  6. converted this issue into a discussion #620 on Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions