Fork me on GitHub

I'm not sure if this has ever been discussed, has anyone figured out how to share the clj-kondo config effectively between projects? My current team has serveral projects that share a lot of macros etc that need the same config over and over again. It would be great to be able to use a shared config but keep the ability to add project-specific overrides when needed.

馃憤 4

perhaps a combination of a git submodule and a custom file that is then passed in as a command line arg to override things?


@imre In this issue I have suggested writing a script (perhaps using babashka) for merging configs


@imre In clj-kondo itself I've been using an #include reader tag, but this is undocumented, just something I've been playing around with:


I'm not sure in what extent it will work for your purposes, but the scripting option will work for sure


that's an aero thing, right?


something I've implemented myself using data readers


you haven't implemented a #merge reader by any chance, have you? 馃槃


hmno, but I guess we could...


it might need a bit of brainstorming first, I suppose


I guess so yes


thank you very much for the pointers, I'll have a read through these


shared config + include/merge sounds like a declarative enough approach to cover both editor integrations and command line


for our case


Hi, I thought that clj-kondo reported on undefined vars from other namespaces. Did I imagine things?


@mynomoto it does report invalid arities from other namespaces, but it doesn't warn if they don't exist. there is an issue for this though


Ok, thanks. I guess I'm relying more on clj-kondo than I should 馃槄

Cora (she/her)22:02:26

can anyone think of a macro that would work for mount/defstate? it can look like these examples:

(defstate conn :start (create-connection config))
(defstate conn :start (create-conn)
               :stop (disconnect conn))

Cora (she/her)22:02:30

I'm coming up empty

Cora (she/her)22:02:56

I thought deftest might cover it

Cora (she/her)22:02:29

ah shoot it does work

Cora (she/her)22:02:41

I was referring to mount/defstate instead of mount.core/defstate


$ clj-kondo --config '{:lint-as {mount/defstate clojure.core/def}}' --lint - <<< '(ns foo (:require mount x)) (mount/defstate conn :start (x/create-connection x/config))'
linting took 9ms, errors: 0, warnings: 0

Cora (she/her)22:02:29

yeah I was referring to a non-existent namespace


this is just by luck, when clj-kondo would have more strict syntax checking for clojure.core/def this would likely give problems

Cora (she/her)22:02:00

deftest should work, though, right?

Cora (she/her)22:02:10

since that can contain multiple expressions


yeah. this one also works:

$ clj-kondo --config '{:lint-as {mount/defstate clj-kondo.lint-as/def-catch-all}}' --lint - <<< '(ns foo (:require mount x)) (mount/defstate conn :start (x/create-connection x/config))'
linting took 12ms, errors: 0, warnings: 0


this is a thing designed to catch all def-like things that cannot be mapped unto something else


at the cost of not getting some lint warnings inside that call

Cora (she/her)22:02:21

I was wondering why that wasn't working as expected, same problem though with the wrong mount namespace


np, silly mistakes happen. that's why I made this tool in the first place 馃檪

Cora (she/her)22:02:15

it's a great tool, so thanks for it

Cora (she/her)22:02:22

I turned my coworkers on to it and they love it


great to hear 馃檪