clean up clj-kondo imports
Signed-off-by: Sean Corfield <sean@corfield.org>
This commit is contained in:
parent
224333abe6
commit
bcc6ad85dd
3 changed files with 42 additions and 1 deletions
|
|
@ -0,0 +1,8 @@
|
|||
{:hooks
|
||||
{:analyze-call
|
||||
{next.jdbc/with-transaction
|
||||
hooks.com.github.seancorfield.next-jdbc/with-transaction
|
||||
next.jdbc/with-transaction+options
|
||||
hooks.com.github.seancorfield.next-jdbc/with-transaction+options}}
|
||||
:lint-as {next.jdbc/on-connection clojure.core/with-open
|
||||
next.jdbc/on-connection+options clojure.core/with-open}}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
(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) per 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})))
|
||||
|
||||
(defn with-transaction+options
|
||||
"Expands (with-transaction+options [tx expr opts] body)
|
||||
to (let [tx expr] opts body) per 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})))
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -6,7 +6,6 @@
|
|||
.calva/repl.calva-repl
|
||||
.classpath
|
||||
.clj-kondo/.cache
|
||||
.clj-kondo/com.github.seancorfield/next.jdbc
|
||||
.cpcache
|
||||
.eastwood
|
||||
.factorypath
|
||||
|
|
|
|||
Loading…
Reference in a new issue