This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-04-13
Channels
- # announcements (6)
- # babashka (96)
- # beginners (159)
- # calva (16)
- # cider (17)
- # clj-kondo (4)
- # cljdoc (6)
- # cljfx (3)
- # clojure (202)
- # clojure-europe (21)
- # clojure-italy (2)
- # clojure-nl (36)
- # clojure-spec (6)
- # clojure-uk (16)
- # clojurescript (29)
- # conjure (25)
- # cursive (29)
- # data-science (12)
- # datalog (18)
- # datomic (58)
- # depstar (73)
- # duct (16)
- # emacs (65)
- # events (3)
- # fulcro (8)
- # honeysql (12)
- # jackdaw (6)
- # jobs (7)
- # jobs-discuss (3)
- # kaocha (50)
- # leiningen (8)
- # lsp (14)
- # malli (83)
- # meander (34)
- # off-topic (2)
- # polylith (4)
- # proletarian (7)
- # re-frame (8)
- # releases (9)
- # remote-jobs (3)
- # shadow-cljs (101)
- # sql (1)
- # tools-deps (48)
- # vim (7)
- # xtdb (13)
- # yada (14)
This isn’t any fault of kondo’s, but I’m wondering how others handle this situation: I have a .cljc
file that looks like this
(ns my.cljc.file
(:require #?(:clj [datomic.client.api :as d])
[my.model.thing :as thing]
[my.model.account :as account]))
#?(:clj
(defn some-function
[]
{::thing/x 42
::account/id 123}))
Because of the way kondo lints cljc files (one pass with clj, one pass with cljs) both the my.model.*
requires are marked as unused. This is because technically they aren’t used by the cljs side. But, if I were to move my.model.*
requires up into the #?(:clj …)
conditional, suddenly the ns can no longer be read, and tools.reader
will complain about “unresolved keyword alias ::thing/x
”. So tools.reader ignores the reader conditionals, and even in cljs, will attempt to read what’s inside of the #?(:clj ..)
conditional forms.
Has anyone figured out a clever way to solve this dilemma? At the moment I’m just living with a few “unused namespace” warnings, but they start to become very noisy…