clj-kondo

agorgl 2024-12-03T07:45:51.651489Z

Hello! Does clj-kondo work with requires inside reader conditionals? I'm getting various unresolved namespace warnings for this reason

borkdude 2024-12-12T16:09:59.956649Z

sorry for losing my attention on this one, I'll try now

borkdude 2024-12-12T16:12:56.871369Z

ah, the issue is that in .cljc files it expects to also have clojurescript when not inside a reader conditional

borkdude 2024-12-12T16:13:27.348539Z

you can configure this with {:cljc {:features [:clj]}} to only lint clj code in .cljc files (it doesn't know about bb)

agorgl 2024-12-12T17:22:36.986869Z

Ah, thanks for the tip!

borkdude 2024-12-03T08:20:50.331459Z

Can you make a repro example?

agorgl 2024-12-03T08:22:42.725079Z

Yes I'll try gimme a sec

agorgl 2024-12-03T08:30:37.440689Z

#!/usr/bin/env bb
(require
 '[clojure.string :as str]
 '[babashka.http-client :as http])
#?(:bb
   (do
     (require '[babashka.pods :as pods])
     (pods/load-pod 'org.babashka/buddy "0.3.4")
     (require
      '[pod.babashka.buddy.core.nonce :as nonce]
      '[pod.babashka.buddy.sign.jwe :as jwe]))
   :clj
   (do
     (require
      '[buddy.core.nonce :as nonce]
      '[buddy.sign.jwe :as jwe])))

(def key32 (nonce/random-bytes 32))
(def data (nonce/random-bytes 1024))

(def message (jwe/encrypt data key32))
(println message)

agorgl 2024-12-03T08:30:42.826499Z

That should do it

agorgl 2024-12-03T08:38:04.642369Z

see the jwe/encrypt line warning