This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-09-17
Channels
- # announcements (17)
- # aws (2)
- # babashka (21)
- # beginners (67)
- # calva (19)
- # cider (29)
- # clara (3)
- # clj-kondo (6)
- # cljsrn (10)
- # clojure (140)
- # clojure-europe (164)
- # clojure-nl (3)
- # clojure-uk (8)
- # clojurescript (62)
- # conjure (7)
- # core-async (24)
- # cursive (21)
- # datomic (5)
- # docker (40)
- # emacs (14)
- # fulcro (25)
- # gratitude (1)
- # honeysql (6)
- # introduce-yourself (1)
- # jobs (1)
- # jobs-discuss (32)
- # juxt (7)
- # lsp (13)
- # minecraft (2)
- # off-topic (49)
- # pathom (24)
- # practicalli (8)
- # re-frame (18)
- # react (23)
- # remote-jobs (6)
- # reveal (2)
- # shadow-cljs (75)
- # tools-deps (7)
Hey @borkdude love kondo! I’m trying to extend to catch all of my calls to js/console.log
. I figured this would be like any other hook but it doesn’t seem to be picking up the usages in my project
@royalaid the hooks are currently only for clojure code, not for interop. if you could like to find calls like this, you could either use grep or https://github.com/borkdude/grasp or similar.
Yeah it wasn’t getting them so wanted to make sure I wasn’t missing some, seems like your assumptions are correct 😢
Hi everyone. I’ve been struggling for hours to try to build a hook, but I’m really stuck on this one. Any tips to getting something like this working with kondo?
(defmacro for-indexed [[item index coll] & body]
`(for [i# (range (count ~coll))]
(let [~item (nth ~coll i#)
~index i#]
~@body)))
This is how far I’ve been able to get but I still get linting errors. Unused binding coll, item and index
(ns hooks.for-indexed
(:require [clj-kondo.hooks-api :as api]
[clojure.edn :as edn]))
(defn for-indexed [{:keys [:node]}]
(let [[bindings body] (-> node :children rest)
[item index coll] (:children bindings)
new-node (api/list-node
(list*
(api/token-node 'let)
(api/vector-node [item index])
body))]
{:node new-node}))
Any ideas?