This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-21
Channels
- # announcements (26)
- # aws (1)
- # babashka (40)
- # beginners (36)
- # calva (9)
- # cider (38)
- # clara (5)
- # clj-commons (4)
- # clj-kondo (29)
- # cljs-dev (8)
- # cljsrn (2)
- # clojars (12)
- # clojure (151)
- # clojure-europe (16)
- # clojure-gamedev (1)
- # clojure-nl (2)
- # clojure-uk (7)
- # clojurescript (2)
- # copenhagen-clojurians (2)
- # datalevin (18)
- # fulcro (7)
- # graphql (7)
- # gratitude (9)
- # helix (2)
- # honeysql (3)
- # introduce-yourself (1)
- # jobs (1)
- # lsp (13)
- # malli (10)
- # nextjournal (2)
- # off-topic (13)
- # pathom (1)
- # pedestal (2)
- # portal (4)
- # remote-jobs (1)
- # ring-swagger (1)
- # shadow-cljs (21)
- # specter (1)
- # testing (2)
- # tools-build (6)
- # vim (2)
- # xtdb (5)
Hallo Michiel.
Do we have somewhere a linter idea for the (:refer-clojure :exclude [something])
if there is no something
in the namespace and :exclude
is redundant?
maybe :redundant-refer-exclude
is a better name indeed, since you don't really "use" them
👋 Hello folks. I’m trying to confirm this behaviour with clj-kondo. This should be a reproducible example:
(defn- my-private-fn [])
(defmacro my-with-redefs
[bindings & body]
`(clojure.core/with-redefs ~bindings (f#)
~@body))
#_{:clj-kondo/ignore [:private-call]}
(my-with-redefs [my-private-fn (constantly :ok)]
(+ 1 2))
In other words, I would like clj-kondo to ignore the usage of my-private-fn
but it doesn’t, presumably because of macro machinery?I don't see the error in this specific example, but I do when I refer to the private var from another ns. Is that what you mean?
(ns foo)
(defn- my-private-fn [])
(defmacro my-with-redefs
[bindings & body]
`(clojure.core/with-redefs ~bindings (f#)
~@body))
(ns bar (:require foo))
#_{:clj-kondo/ignore [:private-call]}
(foo/my-with-redefs [foo/my-private-fn (constantly :ok)]
(+ 1 2))
I don't know why the error isn't gone with the annotation, I think that's a bug. Please file an issue. But you can ignore the warning by writing:
(foo/my-with-redefs [#'foo/my-private-fn (constantly :ok)]
(+ 1 2))
Yes, the fn was in another namespace
Thanks @borkdude I’ll file an issue asap 🙂
Hello guys!
I wonder to know what's the best solution to avoid shadowed var in a let destructuring form?
Currently I destructuring a JS object which contains key
that shadowed clojure.core/key
:
(map #(j/let [^:js {:keys [x y height width color data key]} %
...]
Of course, I can do something like:
(map #(j/let [^:js {:keys [x y height width color data] :as bar} %
current-key (:key bar)
...]
@admin055 You can avoid it with explicit named keys destructuring:
{my-other-key :key
:keys [x y z]
}
Perfect, I forgot the syntax, this is what I was trying to do. Thanks @borkdude!
btw, Clojure Extras does not lint my code with built-in clj-kondo anymore. It was installed from the file firstly (and worked), then disabled (because too annoying), then enabled after installing from marketplace (and upgraded twice) — and it does not lint anymore. Removed then installed again — no changes.
Hi, would you mind opening an issue here? https://github.com/brcosta/clj-extras-plugin. It’d help if you can add the versions (intellij, cursive, extras) so that I can also test it here). Thanks 🙂
Got a very bizzare issue cc @borkdude. Here is a minimal reproduction.
1. Define file core.clj
(require '[malli.core])
(require '[malli.experimental])
(require '[potemkin :as pot])
(pot/import-vars [malli.core [form schema =>]
malli.experimental [defn]])
2. Run.
clj-kondo --lint core.clj
3. Result:
core.clj:6:1: warning: redefined var #'user/
linting took 7ms, errors: 0, warnings: 1
clj-kondo v2022.01.15This works for me:
(ns foo (:refer-clojure :exclude [defn]))
(require '[malli.core])
(require '[malli.experimental])
(require '[potemkin :as pot])
(pot/import-vars [malli.core form schema =>]
[malli.experimental defn])
nonetheless, the error message could be better here, feel free to post an issue about this
Thank you for correcting me! My bad! 🙂