juxt / clip

Light structure and support for dependency injection
MIT License
228 stars 15 forks source link

Clip lifecycle metadata integration for clj-kondo #35

Open jvia opened 1 year ago

jvia commented 1 year ago

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] 
  ,,,,)
SevereOverfl0w commented 1 year ago

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"?

jvia commented 1 year ago

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.

SevereOverfl0w commented 1 year ago

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

SevereOverfl0w commented 1 year ago

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