This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-08-21
Channels
- # announcements (1)
- # beginners (30)
- # calva (3)
- # cider (23)
- # clerk (5)
- # clj-kondo (16)
- # clojure (39)
- # clojure-brasil (3)
- # clojure-europe (19)
- # clojure-nl (1)
- # clojure-norway (54)
- # clojure-seattle (1)
- # clojure-uk (2)
- # clojurescript (9)
- # cursive (3)
- # datahike (13)
- # datomic (4)
- # emacs (7)
- # events (1)
- # fulcro (32)
- # hyperfiddle (17)
- # jobs-discuss (3)
- # meander (5)
- # missionary (132)
- # music (2)
- # nyc (1)
- # off-topic (33)
- # polylith (22)
- # proletarian (3)
- # scittle (106)
- # shadow-cljs (23)
I'm seeing a false positive with a java import in the clj reader conditional of a babashka file. It's showing unused. (See thread.)
Here's asdf.cljc
(ns asdf
(:import
(java.math BigDecimal)))
#?(:clj
(do
(defn ->decimal
(^BigDecimal
[value]
(if (string? value)
(BigDecimal. ^String value)
(bigdec value))))))
> clj-kondo --lint /tmp/asdf/asdf.cljc
/tmp/asdf/asdf.cljc:3:15: warning: Unused import BigDecimal
linting took 11ms, errors: 0, warnings: 1
> clj-kondo --version
clj-kondo v2023.07.13
I'm happy to file an issue, just configure this one away, or whatever you recommend.
This is because the :import
is not in a :clj
reader conditional. It won't work in CLJS anyway
But also, babashka files use the clj branch of the bb branch isnโt encountered first
Yo Noah!
Yes, we have this in our source code here:
#?(:clj ;; bb will load :clj code if no :bb implementation is defined. The following code is compatible with clj and bb, but not cljs.
We've got bb and clj in our stack, but not cljs, so cljs incompatibility is not a problem for us.๐ 2