Fork me on GitHub
#clj-kondo
<
2021-11-25
>
orestis15:11:52

Is there a known issue with macros in ClojureScript code? I get warnings about unresolved vars whenever I use a macro that comes from a cljs namespace but is defined in a clj namespace.

borkdude15:11:38

"that comes from", do you mean "used in"?

orestis15:11:00

The macro is defined in foo.clj, there's also a foo.cljs and the consuming code is at bar.cljs

borkdude15:11:39

can you make a small repro that I can clone and lint?

orestis15:11:39

There's a special invocation that I forget that makes this work

orestis15:11:25

Sure, I'm on my mobile but I will try later tonight. Three separate files or does a text block here work?

borkdude15:11:40

> that I can clone and lint? 

orestis16:11:55

Turns out I can't reproduce. Might have been some cache issue on my local repo....

orestis15:11:44

The case I have in mind is https://clojurescript.org/guides/ns-forms#_implicit_sugar but I will also make a repro later

Jacob Rosenzweig20:11:26

Is there a way to force clj-kondo in vscode to resolve macros from a dep that it just doesn't want to load?

borkdude21:11:09

what is "it" in your question, clj-kondo?

Jacob Rosenzweig21:11:12

The default clojure plugin for VSCode.

borkdude21:11:36

You can probably solve this with {:lint-as {play-clj.core/defscreen clj-kondo.lint-as/def-catch-all}}in your clj-kondo config

Jacob Rosenzweig21:11:24

Oh stupid, I have the wrong root folder opened.

Jacob Rosenzweig21:11:39

But yes, that's unrecognized macros function is neat. Thanks for that nugget.

Jacob Rosenzweig21:11:35

Now that I think about it, it could even just be the linter itself bugging out. Though it shows a clj-kondo error when I hover over it.