Fork me on GitHub
#clj-kondo
<
2022-10-01
>
Matthew Davidson (kingmob)06:10:22

Maybe a silly question, but is :lint-as meant to be transitive? E.g., if I have in the lint-as map:

{outside.lib/foo clojure.core/def
 outside.lib/bar outside.lib/foo}
and I use outside.lib/bar, shouldn’t clj-kondo be able to ultimately resolve outside.lib/bar as clojure.core/def?

borkdude07:10:47

It’s currently not transitive

Matthew Davidson (kingmob)07:10:22

What about if a hook existed instead for outside.lib/foo ?

borkdude07:10:26

That might work

borkdude07:10:44

I’d have to look it up, but afk. You could test it out

Matthew Davidson (kingmob)07:10:12

It’s not a lot of work to fix, I was just surprised that wasn’t already how kondo worked

Matthew Davidson (kingmob)08:10:43

Is there a config scenario where .clj-kondo/config.edn is ignored, or the config-paths entry inside it is? I’ve been tearing my hair out trying to figure out why my changes to resources/clj-kondo.exports/potemkin/potemkin/config.edn weren’t getting picked up. In desperation, I copied the same config lines to .clj-kondo/config.edn , and lo and behold, it worked. I had what I thought was a valid config paths entry: :config-paths ["../resources/clj-kondo.exports/potemkin/potemkin/"], but it didn’t seem to have any effect. I also had an older config.edn in .clj-kondo/potemkin/potemkin/config.edn (iirc), and deleting it seemed to fix the situation, but I haven’t found anything in the docs to explain what was going on.

borkdude08:10:56

Maybe try deleting the trailing slash. I am afk today but will look later tonight

Matthew Davidson (kingmob)08:10:40

I tried with and without the slash earlier, and it didn’t seem to make a difference, but I’ll double-check

Matthew Davidson (kingmob)08:10:39

Thanks for all your help, btw

borkdude09:10:54

Normally what you had with ../resources without the trailing slash should work

borkdude09:10:21

There are various other examples of this in a clj-Kondo issue

borkdude09:10:33

Which I can’t link to because phone

Matthew Davidson (kingmob)09:10:45

I tried again, and found no difference. FWIW, it seems to be working now, once I removed .clj-kondo/potemkin/potemkin/config.edn

borkdude09:10:32

Makes sense

Matthew Davidson (kingmob)09:10:32

Now I’m trying to figure out why kondo is finding potemkin.namespaces/ in the top-level potemkin, but *not anything else…when it seems like it shouldn’t find anything…not that that’s helpful for potemkin consumers, but I’m a bit confused

Matthew Davidson (kingmob)10:10:29

…really doubting whether linting many of the potemkin types is worth it.

borkdude10:10:14

Clj-kondo has built-in support for the most frequently used thing in Potemkin: import-vars

Matthew Davidson (kingmob)10:10:43

Yeah. I was most interested in supporting Aleph’s usage, but it looks like handling stuff like def-abstract-type and def-map-type will be seriously nontrivial. If Potemkin had more use, I might slog thru, but it’s getting really hard to justify the more esoteric uses.

borkdude10:10:26

Yeah agreed. You could just use def-catch-all for those

Matthew Davidson (kingmob)10:10:28

How does def-catch-all compare to deftype, which several of these bottom out at?

borkdude10:10:35

It only registers the var and ignores everything else

Matthew Davidson (kingmob)10:10:13

Got it. Still, that might be preferable for things like def-map-type, which keeps causing “Invalid arity” warnings, because it thinks the assoc definition is a call to clojure.core/assoc…let me try that out…

Matthew Davidson (kingmob)10:10:01

Michiel, thanks for all your help. I think I’ll try to cut a release for some very basic kondo support for potemkin, and then set it aside

👍 1