babashka 2025-11-03

Hello! It looks like perhaps the clj-kondo config for the babashka.fs/with-temp-dir doesn't match the macro signature. https://github.com/babashka/fs/blob/master/resources/clj-kondo.exports/babashka/fs/config.edn

{:lint-as {babashka.fs/with-temp-dir clojure.core/let}}
๐Ÿงต

excited to see you there (both of you) -- and yes, I forgot to file a ticket but ran into the same issue recently

Did you mean to post the below message in this thread?

I did. And I will. sadpanda

no worries!

% cat src/com/grzm/x/fs_ex.clj                    
(ns com.grzm.x.fs-ex
  (:require [babashka.fs :as fs]))

(defn show-me-the-temp-dir [_]
  (fs/with-temp-dir [dir]
    (println (str dir))))

% clojure -X com.grzm.x.fs-ex/show-me-the-temp-dir
/var/folders/7t/5n6k1ww51qng56y9r_2hszpr0000gn/T/0857b224-d823-4097-859e-dbb285710c238828738234203815657

 % clj-kondo --lint src               
src/com/grzm/x/fs_ex.clj:5:21: error: with-temp-dir binding vector requires even number of forms
linting took 81ms, errors: 1, warnings: 0
https://github.com/babashka/fs/blob/master/src/babashka/fs.cljc#L1180-L1206
(defmacro with-temp-dir
  "docstring elided"
  {:arglists '[[[binding-name] & body]
               [[binding-name options] & body]]}
  [[binding-name options & more] & body]
  {:pre [(empty? more) (symbol? binding-name)]}
  `(let [~binding-name (create-temp-dir ~options)]
     (try
       ~@body
       (finally
         (delete-tree ~binding-name {:force true})))))

I agree, we could make a better hook for this

if you want to make clj-kondo happy, you can insert an empty map as the second arg

๐Ÿ‘ 1

issue welcome!

btw, will you perhaps be at the conj this year?

> if you want to make clj-kondo happy, you can insert an empty map as the second arg Good idea. I've currently added #_:clj-kondo/ignore.

And yup, I'll be there. Are you headed across the Big Water?

you will? great! yes, I'll even be doing a talk :)

Oh, boy! Looking forward to it!

Not currently savvy enough to know how to provide the proper hook.

no worries, I'll figure one out.

if you have time and want to give it a try, you may want to copy a hook from that thread pool library that I forgot the name of

oh yes claypool

but don't worry, I'll figure it out eventually