Closed holyjak closed 5 months ago
To help clj-kondo understand defstate in your Clojure code, you can add the following configuration to your deps.edn file:
ruby Copy code {:aliases {:lint {:extra-deps {vlaaad/clj-kondo {:mvn/version "RELEASE"}} :main-opts ["-c" "clj-kondo.config/your-config.edn"]}}} And in your your-config.edn file, you can add the following:
ruby Copy code {:lint-as {:defstate :special-form} :vars {:defstate {:lint-as :dynamic-var}}} This configuration tells clj-kondo to recognize defstate as a special form instead of a regular function, and also to lint it as a dynamic variable instead of a regular variable.
Note that you may need to adjust the configuration to match your specific use case, and that this configuration assumes you are using clj-kondo version RELEASE.
This last comment appears to be made by a bot.
Maybe one of us could raise a PR for this feature? I have no idea how to do that. Will be back when I get more info.
+1 I am getting a diagnostic from my LSP that says:
(defstate xt-node
:start (start-xtdb!)
:stop (.close xt-node))
Unresolved symbol: xt-node
Hello! Clj-kondo is more and more popular, and e.g. VS Code + Calva use it by default. As is, it will complain about any
defstate <name>
that the name is an unknown symbol. It is as simple to fix ashowever it would be much nicer if Mount came with the config so that it can be added to kondo automatically (in the case of Calva) or simply manually with kondo's config import.
It is as simple as providing
src/clj-kondo.exports/mount/mount/config.edn
with that configuration.