Fork me on GitHub
#malli
<
2021-12-16
>
borkdude21:12:57

@ikitommi The newest clj-kondo (just released) supports automatically loading configs from .clj-kondo/*/*/config.edn - just saying :)

ikitommi10:12:22

this is great news 🥳 !!

ikitommi12:12:19

file-writing looks like:

#?(:clj
   (defn save! [config]
     (let [cfg-file (io/file ".clj-kondo" "configs" "malli" "config.edn")]
       (io/make-parents cfg-file)
       (spit cfg-file config)
       config)))

borkdude12:12:11

it's recommended to write a directory that looks like:

<org>/<lib>/config.edn

borkdude12:12:25

so then it would be:

<metosin>/<malli>/config.edn

borkdude12:12:53

but this is usually for configs about malli and not provided by malli about other things

borkdude12:12:29

so maybe this would be better and would still give room for malli itself to export config for its own macros too:

<metosin>/<malli-type-anns>/config.edn

borkdude12:12:05

but you are correct that the config isn't necessary anymore on the user's behalf

ikitommi20:12:28

for some reason, the auto-loading doesn’t work for me :thinking_face:

borkdude20:12:54

have you upgraded clj-kondo

ikitommi20:12:25

➜  malli git:(clj-kondo-config-fix) ./bin/kaocha --focus malli.clj-kondo-test
[(.....)]
1 tests, 5 assertions, 0 failures.

➜  malli git:(clj-kondo-config-fix) cat .clj-kondo/configs/metosin/malli/config.edn
{:linters {:unresolved-symbol {:exclude [(malli.core/=>)]}, :type-mismatch {:namespaces {malli.clj-kondo-test {kikka {:arities {1 {:args [:int], :ret :int}, :varargs {:args [:int :int {:op :rest, :spec :int}], :ret :int, :min-arity 2}}}, siren {:arities {2 {:args [:ifn :coll], :ret :map}}}}}}}}%

➜  malli git:(clj-kondo-config-fix) clojure -Sdeps '{:deps {clj-kondo/clj-kondo {:mvn/version "2021.12.16"}}}' -M -m clj-kondo.main --lint test/malli/clj_kondo_test.cljc
linting took 163ms, errors: 0, warnings: 0

➜  malli git:(clj-kondo-config-fix) echo '{:config-paths ["configs/metosin/malli"]}' > .clj-kondo/config.edn

➜  malli git:(clj-kondo-config-fix) clojure -Sdeps '{:deps {clj-kondo/clj-kondo {:mvn/version "2021.12.16"}}}' -M -m clj-kondo.main --lint test/malli/clj_kondo_test.cljc
test/malli/clj_kondo_test.cljc:80:9: error: Expected: integer, received: string.
linting took 200ms, errors: 1, warnings: 0

ikitommi20:12:39

I think that’s the latest one

borkdude20:12:24

you should use the pattern .clj-kondo/*/*/config.edn , you have one dir too many

ikitommi20:12:54

oh, it was not **! 🙂

borkdude20:12:55

.clj-kondo/metosin/malli

borkdude20:12:12

but I would rename this dir, as I said

ikitommi20:12:13

works like a charm, 🙇

🎉 1
ikitommi20:12:22

yes, I will, just trying it out

borkdude20:12:23

.clj-kondo/metosin/malli-types or so

borkdude20:12:35

so you can still export config for malli itself at one point

ikitommi20:12:28

yes, changed that, will merge when tests pass. This is a really good change, makes the newbie user experience so much better.

borkdude20:12:44

I hope so.. :)