You can see in the patch above that Clojure also enables or disables asserts via an environment variable clojure.spec.check-asserts. ClojureScript does the same via a combination of compile-asserts and runtime-asserts, with compile-asserts being defaulted by :elide-asserts config.
But, I suspect that, since macroexpansion is only a compile-time thing, and we don't need to enable or disable this at runtime like the above, this feature can simple be driven by a new compiler option, with a name inspired by Clojure's name, perhaps :spec-skip-macros (thinking that if we ever end up with other spec-based compiler options, they would look like :spec-).
Akin to Clojure's new ability https://github.com/clojure/clojure/commit/3d9b356306db77946bdf4809baeb660f94cec846
Perhaps ClojureScript would employ a new compiler option to control this?
Implementation guidance:
The check is here https://github.com/clojure/clojurescript/blob/4f3707624846a2cf0345859e41370ec172da73c4/src/main/clojure/cljs/analyzer.cljc#L3524
An interesting twist for this ticket is that Clojure does this via a system property: https://github.com/clojure/clojure/commit/3d9b356306db77946bdf4809baeb660f94cec846#diff-cc33726686a6b12900038d275b8eaa73R303
You can see in the patch above that Clojure also enables or disables asserts via an environment variable
clojure.spec.check-asserts. ClojureScript does the same via a combination of compile-asserts and runtime-asserts, with compile-asserts being defaulted by:elide-assertsconfig.But, I suspect that, since macroexpansion is only a compile-time thing, and we don't need to enable or disable this at runtime like the above, this feature can simple be driven by a new compiler option, with a name inspired by Clojure's name, perhaps
:spec-skip-macros(thinking that if we ever end up with other spec-based compiler options, they would look like:spec-).An example of code that examines a boolean compiler option: https://github.com/clojure/clojurescript/blob/4f3707624846a2cf0345859e41370ec172da73c4/src/main/clojure/cljs/analyzer.cljc#L170
Any new compiler option should be added to this set: https://github.com/clojure/clojurescript/blob/6062744a1600479d5b9c641db9fb15cbb1df023c/src/main/clojure/cljs/closure.clj#L194
For new compiler options, an associated PR should be made against https://github.com/clojure/clojurescript-site to document it in https://github.com/clojure/clojurescript-site/blob/master/content/reference/compiler-options.adoc