shadow-cljs

2025-09-15T07:11:00.112419Z

Hi! I had good time testing shadow-cljs on a frontend+firebase project so I’m trying to migrate an older one from lein. I’m down to getting a lot of warnings like this:

------ WARNING #4 - :undeclared-var --------------------------------------------
 Resource: exoscale/coax/coercer.cljc:99:5
--------------------------------------------------------------------------------
  96 |     (inst? x)
  97 |     x
  98 |     (string? x)
  99 |     (invalid-on-throw!
I’m not sure why migration caused this warning to appear - AFAICT it is a java symbol that is not present in cljs so the warning is valid. However I’d like to solve or silence it while keeping other possible warnings. Updating coax to 2.0.5 did not help. Any ideas much appreciated!

2025-09-15T07:16:48.478169Z

I guess the shadow-cljs specific question is if there’s a good way to silence this particular warning while still getting undeclared-var warnings from my own code

thheller 2025-09-15T07:23:55.100829Z

warnings from libraries should only show watch on the initial compile, but not repeat for watch recompiles. so I guess you can just ignore them?

👍 1
thheller 2025-09-15T07:25:48.244979Z

there is an option to ignore warnings in certain namespaces, but that applies for all warnings in that ns

thheller 2025-09-15T07:25:58.591099Z

and is part of :warnings-as-errors

2025-09-15T07:26:28.047479Z

thanks! that sounds good. If I can silence this one namespace and also make warnings errors for CI/CD that’s ideal

2025-09-15T07:26:46.109669Z

I’ll look into it. Thanks again for the suggestion and of course shadow 🙂

thheller 2025-09-15T07:26:47.303009Z

:compiler-options {:warnings-as-errors {:ignore #{exoscale.coax.*}}}

🙏 1
thheller 2025-09-15T07:27:41.093129Z

in the build config. supports a wildcard at the end. or just the full set of namespaces to ignore.

thheller 2025-09-15T07:28:43.784729Z

should maybe be fixed in the lib though as it will contain a reference to java.lang.Exception in the code, which if that bit is ever reached, will of course fail.

➕ 1
2025-09-15T07:37:18.900889Z

hmm, I could not get it to silence with the option above, although I got it working for other warnings as expected. Looking a bit deeper, it looks like the offending var is a macro

(ns exoscale.coax.coercer
  (:refer-clojure :exclude [identity])
  (:require [clojure.string :as str]
            #?@(:cljs [[cljs.reader]]
                :clj [[clojure.instant]
                      [exoscale.coax.utils :refer [invalid-on-throw!]]]))
  #?(:cljs (:require-macros [exoscale.coax.utils :refer [invalid-on-throw!]])
     :clj (:import (java.util UUID)
                   ( URI))))

2025-09-15T07:37:39.156659Z

maybe this type of conditional require is something not supported by shadow.cljs?

2025-09-15T07:48:58.990459Z

exoscale has an https://github.com/exoscale/coax/issues/13 on this

thheller 2025-09-15T12:42:29.046709Z

the required macro is the problem. not the require of it. that issue and the related PR did indeed fix it, but I guess was reverted at some point since that code is not there anymore.

✅ 1
thheller 2025-09-15T13:04:08.483739Z

https://github.com/exoscale/coax/issues/36

2025-09-15T15:41:36.646079Z

yes. I gather my options are a) patch the library b) ignore the warning. The issue is already threre in the lein build, the shadow build just warned me about it 👍