Merge pull request #137 from NoahTheDuke/nb/fix-clj-kondo-config-2

Fix clj-kondo config, part 2
This commit is contained in:
Anatoly 2024-11-04 10:19:54 -05:00 committed by GitHub
commit 3fc6c58cd6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,12 +1,11 @@
(ns hooks.defstate (ns hooks.defstate
(:require [clj-kondo.hooks-api :as api])) (:require [clj-kondo.hooks-api :as api]))
(defn defstate [{:keys [:node]}] (defn defstate [{:keys [node]}]
(let [args (rest (:children node)) (let [[n & args] (next (:children node))
args (if (string? (api/sexpr (first args))) [docs args] (if (string? (api/sexpr (first args)))
(next args) [(first args) (next args)]
args) [nil args])
[n & args] args
m (when-let [m (first (:meta n))] m (when-let [m (first (:meta n))]
(api/sexpr m)) (api/sexpr m))
m (if (map? m) m {}) m (if (map? m) m {})
@ -32,10 +31,11 @@
:col (:col (meta n))}) :col (:col (meta n))})
:else :else
{:node (api/list-node {:node (api/list-node
(list (cond-> [(api/token-node 'def) n]
(api/token-node 'def) docs (conj docs)
n true (conj (api/list-node
(api/list-node [(api/token-node 'atom)
(list* (api/list-node
(api/token-node 'do) (list*
args))))}))) (api/token-node 'do)
args))]))))})))