clj-kondo

p-himik 2026-06-28T21:17:07.035179Z

I might be missing something obvious or doing something stupid. proj/a.cljc:

(ns proj.a
  (:require [proj.b :as b]
            #?(:cljs [clojure.spec.alpha :as s])))

#?(:cljs
   (do
     (s/def ::x ::b/x)))
proj/b.cljc
(ns proj.b
  (:require [clojure.spec.alpha :as s]))

(s/def ::x any?)
clj-kondo highlights proj.b in [proj.b :as b] above as not used, probably because b is used only within the :cljs reader conditional. However: • :as-alias wouldn't work since nothing else loads proj.b • Moving [proj.b :as b] inside the :cljs reader conditional wouldn't work because the reader would complain with "Invalid token: b/x" • Requiring it twice, once "raw" and the other time with :as-alias, produces another warning So seems that I can either unwrap the second reader conditional (works in my case but might not work in general where ::x has different definitions in CLJ and CLJS) or ignore the warning locally.

p-himik 2026-06-28T21:18:30.749099Z

Oh, I guess I can require [proj.b :as b] under the first :cljs and just proj.b under a new :clj. That's... not neat.

borkdude 2026-06-28T21:19:02.642319Z

> :as-alias wouldn't work since nothing else loads proj.b huh, I don't understand that one

p-himik 2026-06-28T21:19:44.662509Z

proj.b has side-effects when it's getting loaded - the definition of the spec. If nothing loads that namespace, the spec does not exist. :as-alias does not load the namespace.

borkdude 2026-06-28T21:19:53.967449Z

#?(:cljs [proj.b :as :b]
   :clj [proj.b :as-alias :b])
that's not neat, but it works

p-himik 2026-06-28T21:20:18.632369Z

Ah, right - that's what my first comment in the thread should be.

borkdude 2026-06-28T21:20:45.564159Z

nothing else loads proj.b. you want it to be loaded in clj as well?

p-himik 2026-06-28T21:21:41.354389Z

Yes, not all its specs are properly qualified. Shoddy, I know - legacy stuff.

borkdude 2026-06-28T21:21:42.070649Z

I think there's an open issue for this, also related to #_::b/x being triggered in the reader. the reader should probably not barf on this. there's a JIRA for it

borkdude 2026-06-28T21:22:09.757429Z

with open issue I meant JIRA, but I think there's also a kondo one for it

p-himik 2026-06-28T21:22:51.397589Z

Yeah, or (comment ...), I remember it all to well. :)

borkdude 2026-06-28T21:23:04.994079Z

for now probably an ignore hint on the proj.b :as b is justified

p-himik 2026-06-28T21:23:17.931389Z

I think even Dustin mentioned it somewhere related to "Clojure is falling apart".

p-himik 2026-06-28T21:23:58.919659Z

Eh, I went the "not neat" route. To surprise myself in a year, when I get back to this piece of code with no memory of it whatsoever.

borkdude 2026-06-28T21:24:18.444399Z

"Saving to memory..."

1
p-himik 2026-06-28T21:24:51.111869Z

It's like that "1 TB SSD" for 10 € from Temu. :D