Fork me on GitHub
#clj-kondo
<
2022-06-09
>
ikitommi10:06:24

how can I disable warning for unused imports? have user.clj with:

(ns user
  (:require [integrant.repl :refer [clear go halt prep reset reset-all]]
            [integrant.repl.state :as state]))
, which causes (for all of the unused ones):
... warning: #'integrant.repl/clear is referred but never used

borkdude10:06:01

@ikitommi

{:config-in-ns {user {:linters {:unused-referred-var {:level :off}}}}}

ikitommi10:06:47

that’s good, thanks!

jakemcc16:06:28

This would probably be more obvious if I had a dependency that provided a clj-kondo config as I could see what the steps are doing but do steps 3 and 4 of the https://github.com/clj-kondo/clj-kondo/blob/master/doc/config.md#importing section only need to be done with a dependency changes? Results of both committed to your own repo or only step 3?

Joshua Suskalo21:06:55

Has there been a lint considered for putting type hint for return values of protocol definitions on the arglist instead of on the method name like you're supposed to do?

borkdude21:06:29

@suskeyhose There is a linter which does this for normal functions - perhaps it already works for protocol implementations? not sure

Joshua Suskalo21:06:47

yeah, but it has kinda the opposite requirement

Joshua Suskalo21:06:20

(defn blah ^return [arg1 arg2] ...)
(extend-protocol Blah
  Type
  (^return method [arg1 arg2] ...))

borkdude21:06:21

@didibus already posted an issue about this. References to official Clojure docs would be useful and then we can make a linter

Alex Miller (Clojure team)21:06:43

deftype and defrecord inline method impls for sure

Alex Miller (Clojure team)21:06:48

http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/deftype

Method definitions take the form:

(methodname [args*] body)

The argument and return types can be hinted on the arg and
methodname symbols.

Alex Miller (Clojure team)21:06:31

yeah, also in reify docstring

👍 1
Alex Miller (Clojure team)21:06:33

not sure what happens with extend-... - those get expanded into extend calls which don't really have the method name as a symbol anymore, not sure if that type hint is retained anywhere, probably not by just glancing at the code

Alex Miller (Clojure team)21:06:23

I guess there's not really any need for protocols, only for Java interfaces to satisfy the type gods