Fork me on GitHub
#clj-kondo
<
2021-01-14
>
didibus01:01:50

So, @seancorfield made me realize that if you change the arity of a fn in one namespace, and use it with the wrong arity in another namespace clj-kondo will catch the error. But, if the fn is deleted from the other namespace, or renamed, it won't catch those. Is that normal? Would it be possible for clj-kondo to warn on those as well? It seems to me if it can track the arity, it must also track what var is defined in each namespace no ?

borkdude08:01:45

Work in progress. I worked on this issue but it requires more work. It is something that I want to support eventually though.

3
didibus19:01:22

So I assume there is already an issue for it and I shouldn't create one?

Aleksander Rendtslev15:01:19

Hi, This might be a naive question, but I haven’t been able to figure it out: How do I import library provided configs? Eg. Pathom comes with a .clj-kondo/config.edn, but my editor doesn’t pick it up. The guide of the config repo worked fine. So I got it to work for rum/fulcro etc. But I can’t figure out how to do it for everything outside of that (I’m still pretty new to Clojure so this is probably a rookie mistake)

borkdude15:01:54

@aleksander990 There is a difference between a config that a project itself uses and the config that is needed for consuming the code of that project.

Aleksander Rendtslev16:01:25

yeah, I think I got that part. Eg: Adding the fulcro config to .clj-kondo/config/fulcro/config.edn (by following the instructions in the config repo) and then adding that to config-paths in my own config.edn. I just can’t figure out how to do the same for pathom (outside of simply copy pasting the config from their repo) No worries. clj-kondo feels like a lifesaver and is absolutely great for beginners. So I figured my ignorance might be of some help

Aleksander Rendtslev16:01:51

I did read through the guide below, but still can’t wrap my head around it

borkdude15:01:23

You can read more about this here: https://github.com/clj-kondo/clj-kondo/blob/master/doc/config.md#exporting-and-importing-configuration I'm going into a meeting now, but I'd be happy to answer more questions later.

Aleksander Rendtslev16:01:03

Sounds good. Thank you for being so responsive!

borkdude16:01:59

ok, I'm back.

Aleksander Rendtslev17:01:45

So my question is: How do I add an external libraries configuration to my linter? (in this particular case pathom) https://github.com/wilkerlucio/pathom I followed this guide to add the ones provided in this repo, and I figured I just have to tweak the approach for pathom? https://github.com/clj-kondo/config I just haven’t been able to figure out how

borkdude17:01:08

So what pathom should do in this case is export the config for its library in a clj-kondo.exports directory that will be part of the library artifact

borkdude17:01:30

and preferable it should only export config for itself, not for other libraries (like fulcro, because fulcro is not part of pathom)

borkdude17:01:10

But for now you could also copy this config to clj-kondo/config, if pathom isn't doing this in the foreseeable future. Or just copy the relevant bits to your own config.edn file.

Aleksander Rendtslev17:01:39

Ok, so it’s the clj-kondo.export part that’s missing. That makes sense. Thanks! I’ll copy it over for now

wilkerlucio17:01:10

cool, sounds nice, I'll take a time to check on it later today 👍

borkdude18:01:53

@U066U8JQJ Looks right to me!

wilkerlucio19:01:03

cool, does this works with deps dependencies too?

borkdude19:01:12

it works with whatever build tool, as long as its on the classpath

borkdude19:01:30

So anyone who has pathom on their classpath, should get a hint about the config with:

clj-kondo --no-warnings --lint "$(clojure -Spath -Sdeps)"

wilkerlucio19:01:58

I was playing with it here

wilkerlucio19:01:08

I updated my async library to provide those

wilkerlucio19:01:35

and then add as a dep, when I used the clj-kondo --no-warnings --lint "$(clojure -Spath -A:provided)" --parallel, it copied the file, as expected

wilkerlucio19:01:01

but, if I get the same library, and add it via deps (instead of the clojars), then when I run the lint, no copy happens

wilkerlucio19:01:19

I guess because in the second case the clj-kondo.exports isn't at the root, but at resources instead

borkdude19:01:39

it depends on your deps.edn, does it have "resources" in its :paths ?

wilkerlucio19:01:54

good point, let me check that

wilkerlucio20:01:13

that was the missing bit! now that resources in the classpath its working 👍 thanks!

wilkerlucio20:01:01

should a library commit those loaded external kondo configs, or leave ignored in the repo?

borkdude20:01:38

I think it's good to commit so anyone working on that project gets it automatically

wilkerlucio20:01:34

@aleksander990 released in pathom 2.3.1

didibus19:01:48

Can you teach clj-kondo to recognize data_readers ?

borkdude19:01:02

@didibus I don't think there is any logic for that yet.

borkdude19:01:12

Feel free to create an issue

3