Fork me on GitHub
#clj-kondo
<
2022-03-13
>
mindbender13:03:26

What is the correct syntax for specifying configuration in the (ns ...)form?

mindbender13:03:14

I'm trying to turn of clojure-lsp warning messages about unused public vars in Calva IDE

borkdude14:03:26

See config.md. I can post the link when I'm back at a keyboard

borkdude22:03:44

So the config would be something like:

(ns foo
  {:clj-kondo/config '{:linters {clojure-lsp/unused-public-var {:level :warning}}})

Joshua Suskalo15:03:18

should that be a commented form with #_?

borkdude15:03:01

no, not in the ns form

Joshua Suskalo15:03:37

okay, good to know. Is it basically an attrib map for the ns? I don't think I'd seen a map in the ns form before.

borkdude15:03:55

yes, this is a metadata map for a namespace

lread19:03:10

I’m wondering about determining if a macro is part of a cljs api from clj-kondo analysis 🧵

lread19:03:44

I’m looking into this as part of https://github.com/cljdoc/cljdoc/issues/543 but it would also apply to tools like https://github.com/borkdude/api-diff

lread19:03:37

My current understanding is that if :require-macros is used from cljs/cljc namespace x on clj/cljc namespace x then namespace x will have those macros available for use from a cljs client. (And there’s also :refer-macros and :include-macros sugar syntax but let’s leave that out maybe for the moment).

lread19:03:25

But… I might be missing some common way folks include macros for consumption from a cljs api…

lread20:03:02

After I get a grip on how folks do include macros in their cljs apis. I’ll then want to figure out how to glean the cljs API from clj-kondo analysis data.

lread20:03:05

@UKFSJSM38 did you have to make any similar determinations for your lsp work?

ericdallo20:03:56

Not at all, clojure-lsp doesn't need to know that, we always rely on what kondo qualifies as macro or not

lread20:03:27

Ah ok, thanks for letting me know @UKFSJSM38!

lread20:03:30

@U04V15CAJ, do you have any thoughts/wisdom?

borkdude20:03:55

macros are always available from cljs

borkdude20:03:10

perhaps you can give me an example where this would not be the case

lread20:03:35

I guess I’m just trying to learn how cljs/cljc library authors typically expose macros for cljs consumption in their APIs.

borkdude20:03:16

you cannot statically know if a macro is for public consumption or not, unless it's marked with skip-wiki or whatever

borkdude20:03:15

E.g. I'm pretty sure some of these macros are not for public consumption: https://cljdoc.org/d/org.clojure/core.match/1.0.0/api/cljs.core.match Yet they appear in the cljdoc output.

lread20:03:47

Hmm… interesting.

borkdude20:03:21

I don't see why it needs that. Even without that the macros are publically accessible for any other cljs lib.

lread20:03:51

Yeah technically true…

borkdude20:03:27

These macros are even accessible by JVM clojure itself, so you cannot statically infer what is the intention behind those macros

borkdude20:03:32

Any guesses will be wrong

lread20:03:42

Thanks that helps.

lread20:03:57

So all clj macros are part of my cljs API unless :no-doc ed (or marked private).

lread20:03:35

And if I do certain things as a library author, they might be easier to include from a cljs client, but that is besides the point.

lread20:03:54

Well, thanks, so nice to have smart people to ask these types of questions to!

❤️ 1
lread20:03:26

(I am thinking cljdoc cljs load-time analysis might need to be verified now, but am very happy that static analysis stays oh-so simple!)