Fork me on GitHub
#clj-kondo
<
2022-11-25
>
pez14:11:25

Should the unused public var linter flag when a var is referenced quoted?

(def foo :foo)
(def foo-q 'foo)
foo is flagged as unused. Maybe it should, come to think of it...

borkdude14:11:09

@pez quoted symbols naming vars do not count as var references, currently. but we talked recently about this, that it might be interesting for clojure-lsp to do regard it as a reference for navigation purposes

☝️ 1
🙏 1
borkdude14:11:00

It does count when you write foo` since syntax quote will use the environment to resolve the var so in that sense the var is "used"

til 1
Søren Sjørup23:11:33

I have a ns with many unused public vars, as I bind them dynamically. How do I ignore the :clojure-lsp/unused-public-var warning for the entire ns? #_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]} in front of each def works as expected.

borkdude07:11:09

See Clojure-LSP config docs

Søren Sjørup15:11:50

Ah that did it, thank you! I was setting :level :off didn’t realize I could just exclude the linter as such.

👍 1