clip icon indicating copy to clipboard operation
clip copied to clipboard

Clip lifecycle metadata integration for clj-kondo

Open jvia opened this issue 2 years ago • 4 comments

Clip lifecycle functions are marked as unused by clj-kondo. This can be resolve by ignoring the form but I think it could be a nicer UX and a clearer intent if clip exported a clj-kondo config such that adding a specific tag to a function disabled the unused check.

Basically something along the lines below. It would ignore that fact that it is unused but it's clear to developers from where this function is being used.

(defn ^:juxt.clip/lifecycle start-component [config] 
  ,,,,)

jvia avatar Mar 23 '23 17:03 jvia

They shouldn't be marked as unused by clj-kondo if they're public functions? They might be marked as unused by clojure-lsp though if it doesn't treat your namespace as a "library"?

SevereOverfl0w avatar Mar 24 '23 14:03 SevereOverfl0w

OK, after some more poking at this, I think it is clojure-lsp that is causing the issue. If I run clj-kondo at the command line I do not see any warnings about the unused public var.

jvia avatar Apr 03 '23 20:04 jvia

Makes sense. I don't know how you would configure clojure-lsp to know a function is "publically exported" internally.

SevereOverfl0w avatar Apr 04 '23 10:04 SevereOverfl0w

https://clojure-lsp.io/settings/#clojure-lspunused-public-var

SevereOverfl0w avatar Apr 04 '23 10:04 SevereOverfl0w