Fork me on GitHub
#clj-kondo
<
2024-06-28
>
borkdude07:06:38

clj-kondo tip of the day: https://x.com/borkdude/status/1806594169529340188 - thanks to who prompted me to write the :redundant-str-call linter, enjoying it a lot :)

πŸŽ‰ 8
πŸ‘ 3
lread12:06:21

Cool! Just tried it on cljdoc and it found a couple things. I really love clj-kondo! ❀️ clj-kondo

πŸŽ‰ 1
hifumi12319:06:34

Is there a way to determine why clj-kondo is triggering a warning for a linter? I have a ClojureScript project that makes use of modules. One namespace in a non-main module requires [helix.hooks :as hooks] and has a component calling hooks/use-effect, yet clj-kondo marks the require as unused. This also happens for re-frame and some subscriptions. Not sure why. It doesn't happen for other libraries required.

borkdude19:06:48

Without a minimal repro it’s hard to say.

hifumi12319:06:00

one of my pages is as small as

(ns web.routes.admin.root
  (:require [helix.core :refer [<>]]
            [helix.hooks :as hooks]
            [re-frame.core :as rf]
            [web.hooks.re-frame :refer [use-sub]]
            [web.utils.render :refer [defnc]]))

(defnc page []
  (let [tenant (use-sub [:router.params/tenant])]
    (hooks/use-effect :once 
      (rf/dispatch [:router/navigate :routes.admin/home {:tenant tenant}])))
  (<>))
and clj-kondo is marking helix.hooks, re-frame.core, and web.hooks.re-frame as unused

hifumi12319:06:42

ive tried making a repro over the past few days but with no luck. i suspect there may be something with shadow-cljs modules triggering this issue, since it only ever happens in files belonging to non-main modules, but not sure yet.

borkdude20:06:50

I guess there is a clj-kondo hook for defnc right?

πŸ‘ 1
borkdude20:06:36

Perhaps the issue is with that

borkdude20:06:52

please also share your deps.edn (at least the helix + re-frame deps)