This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-02-24
Channels
- # announcements (3)
- # babashka (47)
- # beginners (40)
- # biff (21)
- # calva (12)
- # cider (2)
- # clj-kondo (31)
- # cljsrn (8)
- # clojure (14)
- # clojure-berlin (2)
- # clojure-conj (1)
- # clojure-dev (24)
- # clojure-europe (84)
- # clojure-italy (8)
- # clojure-nl (1)
- # clojure-spec (1)
- # clojure-sweden (2)
- # clojure-uk (2)
- # clojurescript (34)
- # clr (3)
- # community-development (1)
- # cursive (14)
- # datalevin (8)
- # datomic (5)
- # defnpodcast (2)
- # dev-tooling (1)
- # etaoin (4)
- # events (3)
- # fulcro (26)
- # graphql (3)
- # honeysql (6)
- # hyperfiddle (45)
- # lsp (40)
- # malli (1)
- # missionary (1)
- # nbb (18)
- # podcasts-discuss (1)
- # reagent (8)
- # reitit (2)
- # releases (2)
- # ring-swagger (1)
- # scittle (78)
- # shadow-cljs (96)
- # vim (7)
- # xtdb (3)
Do people generally exclude imported clj-kondo configs from version control (say, using .gitignore
)? We’ve got one (for a transitive dependency that we’re not using) that happens to always trip our cljfmt runs.
If you're not using that library you could just gitignore it. I do check in configs for libs that I am using, so everyone has the same clj-kondo config, but whatever works best for you. does cljfmt support an ignore setting?
I think probably, but I’m currently working out how lsp and cljfmt work together, so I think I’ll just exclude it in deps.edn. That should prevent the clj-kondo config from being imported, correct?
I agree the cljfmt ignore would be more surgical. And maybe I’ll just submit a patch upstream and see if they take it. Thanks!
I’m looking at some legacy code and found the following form (in thread) which kondo does not like. Is it valid Clojure?
(defprotocol Body
(to-body [x]))
(extend-protocol Body
(class (byte-array 0))
(to-body [this] (RequestBody/fromBytes this)))
Something like this should work:
(defprotocol Body
(to-body [x]))
(extend (class (byte-array 0))
Body {:to-body (fn [this] (RequestBody/fromBytes this))})
In the above thread @U060FKQPN explains why there are issues with code like, but it is not clear if those issues are a bug in the extend-protocol definition, or if that is invalid code
Given that it only works accidentally for one case, but not when you provide some combination of other stuff (in which clj emits an invalid type hint like ^(class (byte-array 0)))
in the expansion) I'd not use it at all at this point, but it would be good if the core team (@U064X3EF3 ?) could shed some light on this if it's supported or a bug.
https://clojure.atlassian.net/browse/CLJ-1381 appears to be this issue, but not a lot of commentary
don't get too attached to the foo*
:)
you can also use the string form in this code I believe
guess not, I thought there was some other workaround but maybe the code up top is what I'm thinking of
but wherever we end up on the class array stuff, that would help regardless