From 8151dcc05ff93d44b5c89fb784335d72a3915b68 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Thu, 18 Nov 2021 16:43:52 +0100 Subject: [PATCH] :paperclip: Improve services defmethod linter hook. --- .clj-kondo/hooks/export.clj | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.clj-kondo/hooks/export.clj b/.clj-kondo/hooks/export.clj index e8acc8e11..f66d02783 100644 --- a/.clj-kondo/hooks/export.clj +++ b/.clj-kondo/hooks/export.clj @@ -51,18 +51,28 @@ (defn service-defmethod [{:keys [:node]}] - (let [[rnode rtype & other] (:children node) + (let [[rnode rtype ?meta & other] (:children node) rsym (gensym (name (:k rtype))) result (api/list-node [(api/token-node (symbol "do")) (api/list-node [(api/token-node (symbol "declare")) (api/token-node rsym)]) + (if (= :map (:tag ?meta)) + (api/list-node + [(api/token-node (symbol "reset-meta!")) + (api/token-node rsym) + ?meta]) + (api/list-node + [(api/token-node (symbol "comment")) + (api/token-node rsym)])) (api/list-node (into [(api/token-node (symbol "defmethod")) (api/token-node rsym) rtype] - other))])] + (cons ?meta other)))])] + ;; (prn "==============" rtype (into {} ?meta)) + ;; (prn (api/sexpr result)) {:node result}))