clj-kondo

jramosg 2026-01-14T09:23:43.840879Z

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.

borkdude 2026-01-14T09:28:02.535279Z

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

borkdude 2026-01-14T09:28:48.748039Z

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

jramosg 2026-01-14T09:29:36.315449Z

👌🏿 thanks!

borkdude 2026-01-14T09:30:14.513369Z

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

borkdude 2026-01-14T09:31:11.447229Z

This is a similar one for Java classes: https://github.com/clj-kondo/clj-kondo/issues/737

borkdude 2026-01-14T20:03:41.529239Z

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

🔥 2
🎉 3