Skip to content

Commit

Permalink
Commit clj-kondo settings
Browse files Browse the repository at this point in the history
  • Loading branch information
makinoshi committed Jul 22, 2024
1 parent ad504f7 commit 21b3315
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .clj-kondo/com.github.seancorfield/next.jdbc/config.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{:hooks
{:analyze-call
{next.jdbc/with-transaction
hooks.com.github.seancorfield.next-jdbc/with-transaction}}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
(ns hooks.com.github.seancorfield.next-jdbc
(:require
[clj-kondo.hooks-api :as api]))

(defn with-transaction
"Expands (with-transaction [tx expr opts] body)
to (let [tx expr] opts body) pre clj-kondo examples."
[{:keys [:node]}]
(let [[binding-vec & body] (rest (:children node))
[sym val opts] (:children binding-vec)]
(when-not (and sym val)
(throw (ex-info "No sym and val provided" {})))
(let [new-node (api/list-node
(list*
(api/token-node 'let)
(api/vector-node [sym val])
opts
body))]
{:node new-node})))

0 comments on commit 21b3315

Please sign in to comment.