Fork me on GitHub
eccentric J18:03:59

Hey there, trying to read the docs on unresolved-symbol but the link seems to be dead.

eccentric J18:03:15

Is there an updated page with that info?

eccentric J18:03:21

Can make a PR to fix it

eccentric J18:03:28

Thanks, will create a pr for that momentarily. So if I am understanding it right in my ~/.clj-kondo/config.edn I can put the following?

{ :linters {:unresolved-symbol {my-app.utils/current-file [ns-resolve]}}}

eccentric J18:03:40

Oops I see my mistake, forgot the exclude part


Thanks for the upcoming PR! Yes, that's right

eccentric J18:03:12

  {:exclude [(my-app.utils [dbg!])]}}
Is there something similar for unused-import? Got a cljs file importing a cljc macro.


unused-import is for classes

eccentric J18:03:54

I see the unused-referred-var now, that makes sense sorry about that!


Can you provide an example? It's unlikely that you will need a config for a referred thing that you actually are using

eccentric J19:03:01

(ns my-app.utils
   [my-app.utils :refer [dbg!]])


Is this .cljs file?


Ah you want the dgb! macro available, yes this makes a lot of sense for the config. I do something similar with timbre

eccentric J19:03:08

Cool, looks like the example is for that too

eccentric J19:03:11

I seem to be running into trouble with the unresolved-symbol exclusion though:


@jayzawrotny If that is a .cljc file then you should use reader conditionals


e.g. *file* is not a thing in CLJS

eccentric J19:03:59

{:lint-as {kitchen-async.promise/-> clojure.core/->
           kitchen-async.promise/let clojure.core/let}
 :skip-comments true
 {:unresolved-symbol {:exclude [(my-app.utils/current-file [ns-resolve])
                                (my-app.utils/dbg! [*file*])]}
  :unused-referred-var {:exclude {my-app.utils [dbg!]}}}}

eccentric J19:03:25

I recall having trouble with that using reader conditionals but I’ll try again


why have it as a .cljc file at all if it only contains clojure code?

eccentric J19:03:01

My understanding was that macros have to be in cljc to be used within cljs?

eccentric J19:03:21

Though I suppose for this branch I can remove the conditional


no that's not the case, you can put your macros in .clj

eccentric J19:03:58

Well it’s intended to work in both clj and cljs

eccentric J19:03:13

The current-file function runs in cljs


yes, but macros are always executed in clojure

eccentric J19:03:28

Ok, I can change it to clj then.


Your current-file function runs during macro-expansion in the JVM


(unless you use self-hosted clojurescript, but even then you can use .clj for macros)


Clj-kondo assumes code in .cljc files to be valid for both Clojure and ClojureScript outside conditionals. E.g. future is unresolved for ClojureScript, hence you write #?(:clj (future :foo) :cljs :foo)


The key point: > First of all - ClojureScript macros are written in Clojure and run during the ClojureScript compilation on the JVM.


He is not suggesting you need .cljc, he only writes that you cannot use reader conditionals to achieve a certain goal

eccentric J19:03:06

I think that’s where I got stuck. Thanks very much!

eccentric J19:03:16

Lints clean now too 🎉

🎉 3
eccentric J19:03:45

btw do you have a sponsorship thing setup for one-off payments? I kind of have an unwritten rule where if I am wasting maintainers time and it turns out to be on me for not understanding or reading the docs: I donate.


haha, don't worry

eccentric J19:03:14

I insist! At least a cup of coffee or a beer. Venmo? Paypal?


If you want to buy me a cup of coffee:


Thanks a lot. I'll be thinking of your beautiful CGI scripts during my coffee tomorrow ;)