has someone posted a linter for the else->>
macro? It's a mind-bending piece of code and I would happily replace better-cond
if it means clj-kondo can better lint my code π https://gist.github.com/borkdude/93efc3f5978a2ed545553a47caaf7aa8
@pithyless I think itβs not hard to write a hook for this
yeah, I figured a hook for this is easier to write, than for parsing better-cond
; I was just hoping someone had already done it ;]
if no one has, I guess I'll take a stab at it later
I'm trying out the new "unresolved var" linter. I'm wondering why it doesn't always work. Repro:
(require '[clojure.tools.namespace.repl :as t.n.r])
(t.n.r/nope)
(require '[clojure.set :as set])
(set/onion)
It reports set/onion
, but not t.n.r/nope
.@flowthing the reason (probably) is, is that clojure.tools.namespace hasn't been analyzed/linted, but clj-kondo knows about a few built-in libraries like clojure.set already
Aha. Is that something I can fix by configuring clj-kondo?
to lint this library, make a .clj-kondo dir in your project root and then lint everything using clj-kondo --no-warnings --parallel --lint <classpath>
where <classpath>
is some build-tool specific thing like $(clojure -Spath)
Thanks! I'll give that a try. Guess I should RTFM. π
If you use clojure-lsp then it will do this for you, I think
any time you open a project
OK β I don't use it at the moment, though, but good to know.
Yeah, your suggestion fixed the issue -- many thanks!
(Also for clj-kondo itself β it's absolutely fantastic.)
π
Hi! I have an issue that after some time of digging on it, did not found a solution. I have a macro that "reexports" some vars, so the code looks like (d/export somens/somesymthatpointstovar)
, now clj-kondo raises the warning about unresolved var when using anything that is exported using this macro. I tried to use it like lint-as
with clojure.core/declare and it does not have any effect (indeed because the warning is not caused by the macro export
; is cause by the use of the results of this macro. There are any hint on how to fix it?
Thanks!
@niwinz There are multiple ways to solve this.
1) You can configure the :unresolved-var
linter to turn off warnings for this namespace. See docs here: https://github.com/clj-kondo/clj-kondo/blob/master/doc/linters.md#unresolved-var.
2) You can write a hook to make clj-kondo understand your macro. See https://github.com/clj-kondo/clj-kondo/blob/master/doc/hooks.md.
hmm i was not aware about hooks for this case, thanks for the hint
@borkdude thanks, that worked