Fork me on GitHub

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 or similar.


So it won’t pick up forms like the ones in the js ns?


I don't think so (but worth a try :P)


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#]
       [email protected])))
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
                   (api/token-node 'let)
                   (api/vector-node [item index])
    {:node new-node}))
Any ideas?