This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-03-21
Channels
- # announcements (1)
- # architecture (392)
- # babashka (3)
- # beginners (1)
- # calva (2)
- # cider (1)
- # clojure (30)
- # clojure-denmark (2)
- # clojure-dev (9)
- # clojure-europe (13)
- # clojure-italy (2)
- # clojure-japan (17)
- # clojure-korea (8)
- # clojure-nl (1)
- # clojure-norway (74)
- # clojure-uk (3)
- # clojurescript (6)
- # code-reviews (8)
- # conjure (1)
- # data-science (1)
- # datascript (7)
- # datomic (1)
- # fulcro (1)
- # graalvm (9)
- # humbleui (3)
- # hyperfiddle (11)
- # leiningen (4)
- # lsp (7)
- # malli (7)
- # off-topic (57)
- # other-languages (9)
- # overtone (7)
- # shadow-cljs (30)
- # sql (15)
- # squint (3)
- # timbre (3)
- # vim (6)
Has anyone created hooks for clj-kondo
to prevent the warnings with e/server
& e/client
?
i believe not, but as of the recent incremental compilation changes that released around christmas, this may now be feasible, namely because platform reader conditionals :cljs :clj now do the obvious expected thing in electric code blocks
I'm just getting to know electric, so I don't know what changes you are referring to I'm afraid. Maybe it's actually really easy.. Something along the lines of this maybe.
(defn cljs-wrap
[{:keys [node]}]
{:node :reader-conditional
:forms [(assoc node :tag :cljs)]})
Iām doing this kind of thing:
(ns my-ns
{:clj-kondo/config
'{:linters {:unresolved-namespace {:exclude #?(:clj [cljs-only-ns-1
cljs-only-ns-2]
:cljs [clj-only-ns-1
clj-only-ns-2])}
:unresolved-symbol {:exclude #?(:clj [cljs-only-symbol-1
cljs-only-symbol-2]
:cljs [clj-only-symbol-1
clj-only-symbol-2])}}}}
(:require
...))
We have a fiddle if you want some inspiration https://github.com/hyperfiddle/electric-fiddle/blob/main/src/electric_tutorial/demo_color.cljc
Is there a best practice for listening to a dom event in electric? I saw this https://github.com/hyperfiddle/electric/blob/master/src/hyperfiddle/electric_ui4.cljc#L105 but I'm not 100% clear on what it's doing (and I don't recall this being mentioned in the tutorial, but I could have missed it)
@U06KR2E1LHM Which events were you thinking? You can listen to events on each of the ui components with nested (dom/on ...)
for electric fns and (dom/on! )
for pure clojurescript
(dom/on "keydown" ...)
Sometimes I attach javascript to the dom to trigger functions on page load etc. For ui components the dom/on[!]s are good