clj-kondo 2026-01-14

What do you all think about adding a linter for cases like this:

(require '[clj-kondo.impl.utils :as utils :refer [sexpr]])
(utils/sexpr "")
(sexpr "")
The linter would check for redundant :refer usage when the same function is already being accessed via the namespace alias (e.g., utils/sexpr and sexpr both being used). I think this would be helpful for organizing require and :refer statements, making the code cleaner and easier to maintain. We have two possible suggestions: • removing the :refer [sexpr] from the require and always using the namespaced version (utils/sexpr) • keeping the :refer [sexpr] and using the unqualified version (sexpr) consistently.

Personally I prefer to keep :refer limited and use an alias, in general (but there are always exceptions). In clj-kondo we're initially not concerned with "how to fix it" but "how to warn about it" and "why". How to fix it is more a clojure-lsp concern, although it's important to keep that in mind as well. I think it makes sense to "warn" about referred vars accessed via an alias as isn't something that's not consistent. The name of the linter could be :aliased-refered-var or so

People can decide for themselves what to do with the warning: remove the refer, or the alias

👌🏿 thanks!

Please do check the names of the other linters to see if this name is somewhat consistent with other existing ones

New on master: I came across this issue yesterday when fixing a CLJS issue in editscript. Thanks @jonurnieta for implementing it.

🔥 2
🎉 3