This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-10-12
Channels
- # aleph (3)
- # announcements (7)
- # babashka (22)
- # beginners (44)
- # calva (19)
- # chlorine-clover (1)
- # cider (20)
- # clj-kondo (55)
- # clojure (100)
- # clojure-austin (9)
- # clojure-europe (19)
- # clojure-italy (19)
- # clojure-nl (13)
- # clojure-portugal (2)
- # clojure-uk (7)
- # clojurescript (38)
- # community-development (3)
- # conjure (2)
- # cryogen (57)
- # cursive (6)
- # datalog (3)
- # datomic (24)
- # emacs (17)
- # exercism (8)
- # fulcro (3)
- # holy-lambda (8)
- # jobs (6)
- # jobs-discuss (9)
- # joker (3)
- # lambdaisland (5)
- # leiningen (5)
- # music (9)
- # nextjournal (1)
- # nrepl (2)
- # off-topic (9)
- # other-languages (4)
- # pathom (6)
- # polylith (23)
- # re-frame (5)
- # reagent (5)
- # remote-jobs (1)
- # reveal (1)
- # shadow-cljs (3)
- # tools-build (1)
- # tools-deps (3)
- # xtdb (2)
Type inference improvements coming up in the next release: https://twitter.com/borkdude/status/1447920160350916608
that’s cool as hell
Where do I find the definitions of the default linters? I’m specifically interested in Inline def https://github.com/clj-kondo/clj-kondo/blob/master/doc/linters.md#inline-def
It’s still not what I want. 😃 I suck at expressing myself. I’d like to know how clj-kondo goes about determining that something is an inline def. So if I would write a similar linter myself, I could look at the one you’ve done as inspiration.
This is intertwined in the analysis if I remember correctly. If you encounter def
when you already entered another def
or defn
then you know it's "inline"
I am not. 😃 I just used that as a vehicle to clarify my question. I am suggesting at work that we make the default level for this linter to be :error
, and there was worry that we wouldn’t be able to use def
s in some contexts that we do today. Now we know that we can just ban them. 😃
Ah, good that you reminded me. Then I can use that on the only case there is in our current code base, before I understand if I can remove it.
for example: (when false (def x 1))
still creates the var x but it remains uninitialized
The worry I mentioned above was actually exemplified with a def
in a when
. Did you guess that? 😃
if I understand correctly, clj-kondo analysis data includes clj-kondo hard-coded cherry picked metadata of interest only
(asking in support of https://github.com/borkdude/api-diff/issues/4)
There is probably a very good reason that clj-kondo analysis data does not simply include all metadata on var/ns, yeah?
Would a function work like {:analysis {:var-meta (fn [m] ...)}}
work? Syou can just select the extra metadata you want and this will end up in {:var-definitions [{:name ... :meta ...}]
?
@UE21H2HHD I made a comment here: https://github.com/clj-kondo/clj-kondo/issues/1280 A PR for this is welcome or I'll do it myself since the question has come up a couple of times lately.
Oh didn’t answer if I am up for this PR. Sure? Maybe? Why not? Yeah, I can give it a go. Unless you’ve already borkduded it!
I am editing a cljc file, and it seem clj-kondo cannot understand cljs correctly. see picture:
Not sure if its something already known (tried lookin into Github but I didn’t found nothing), but I am having some hard time in clj-kondo recognizing conditional reader macros into metadata annotations. Eg:
(def ^{#?@(:clj [:deprecated "deprecation message"])}
my-deprecated-var
:bla)
Makes the ns
unparsable with the error
missing value for key #?@ (:clj [:deprecated "deprecation message"])
Also using an alternative syntax:
(def ^#?(:clj {:deprecated "deprecation message"})
my-deprecated-var
:bla)
Makes the error go away but the metadata doesn’t seem to be preserved for clj-kondo analysis (is does not complain about the var being deprecated)What about:
(def
#?(:clj ^{:deprecated "reason"} my-deprecated-var
:cljs my-deprecated-var)
:bla)
but clj-kondo should probably support the other way too, so feel free to make an issue about it
It seems to work with this syntax… However I was facing this from another library I had required in my project, so Ideally would be great to have this fixed without needing to change it in the source. I will open an issue anyway, but thanks for the workaround for now 🙂