This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # announcements (2)
- # aws (21)
- # babashka (4)
- # babashka-sci-dev (17)
- # beginners (3)
- # cider (16)
- # clj-kondo (61)
- # clojure (122)
- # clojure-europe (11)
- # clojure-spec (3)
- # clojurescript (2)
- # conjure (19)
- # helix (9)
- # hyperfiddle (2)
- # inf-clojure (18)
- # lsp (12)
- # off-topic (15)
- # react (2)
- # releases (1)
- # shadow-cljs (40)
- # spacemacs (4)
- # tools-deps (5)
- # vim (15)
I've added the "resources" folder to my deps.edn :path vector, per the docs. Here's my project https://github.com/johnmn3/dispacio
I guess the last issue I have is that my
defmethod lint-as thing is not taking effect on subsequent instances of the defined methods:
Here's my config.edn: https://github.com/johnmn3/dispacio/blob/master/resources/clj-kondo.exports/net.clojars.john/dispacio/config.edn
I'm a little scared to bite off implementing a hook. I tried making one that wrapped the body in a do and added a
(declare the-thing-name) at the top of the do form, but I couldn't get it to work
Hmm, here's what I have in Expectations: https://github.com/clojure-expectations/clojure-test/blob/develop/.clj-kondo/com.github.seancorfield/expectations/config.edn -- completely different path to what you have.
I think using a hook is a better option here than linting as + repressing unresolved symbols
@U050PJ2EU Made a pull request which fixes the above issues.
You can execute
clj-kondo --lint .clj-kondo/test.clj to see that it works, with the newest clj-kondo.
Yes. You can try with the clj-kondo vscode extension now if you want btw and disable linting in clojure-lsp
I just pushed to master the bump of clj-kondo on clojure-lsp, if you want you can use a nightly build on #clojure-lsp-builds
We should open a PR there and on other projects to consider that as a clojure file like clojure-lsp itself 😂
When I do switch to
clojure-mode for a
.clj_kondo file, I do get an odd finding for that file:
IIRC that can't parse comes from kondo, probably we need to consider .clj_kondo files as clj ones as well there
.clj-kondo hook files are being picked up and used for linting.
And the enhanced macroexpand hook behaviour seems to be pinpointing errors at their location.
Good question… Here’s the hook source:
And here’s me linting from the cmdline:
(ns etaoin.impl.util) (defmacro defmethods "Declares multimethods in batch. For each dispatch value from dispatch-vals, creates a new method." [multifn dispatch-vals & fn-tail] `(doseq [dispatch-val# ~dispatch-vals] (defmethod ~multifn dispatch-val# ~@fn-tail))) ;; essence only for linting (defmacro with-tmp-file [prefix suffix bind & body] `(let [~bind "somepath"] ~@body))
❯ clj-kondo --version clj-kondo v2022.05.29 ❯ clj-kondo --lint .clj-kondo/hooks/etaoin/impl/util.clj_kondo .clj-kondo/hooks/etaoin/impl/util.clj_kondo:11:26: warning: unused binding prefix .clj-kondo/hooks/etaoin/impl/util.clj_kondo:11:33: warning: unused binding suffix linting took 12ms, errors: 0, warnings: 2
Yup, I think borkdude is onto something there:
❯ clj-kondo --lint .clj-kondo/hooks/etaoin/impl/util.clj_kondo --lang clj_kondo .clj-kondo/hooks/etaoin/impl/util.clj_kondo:0:0: error: Can't parse .clj-kondo/hooks/etaoin/impl/util.clj_kondo, No matching clause: :clj_kondo linting took 6ms, errors: 1, warnings: 0
And my example above shows that I will leave in lint warnings without clj-kondo/lsp help. I am totally dependent.
@U04V15CAJ does it make sense to lint hooks code? I guess so, but would like a borkpinion.
@UKFSJSM38 It depends how you are calling clj-kondo. If you pass just stdin text without a filename, then clj-kondo cannot guess the language, so you can give a hint
--lang cljs or so
But if you just pass the filename with the extension, then clj-kondo will derive the language from that