I’m seeing warnings about “unused default for binding <sym>” for destructured argument bindings that absolutely are used in the function body that follows. Is this a known issue and/or recently fixed?
not known to me
Sharing work code via DM.
I’m having some trouble with Unresolved symbol
errors happening inside of custom macros that are themselves inside of reader conditional forms. I have the following set in my config.edn
file:
{:lint-as {mount.core/defstate clojure.core/def
taoensso.encore/if-let clojure.core/let
com.wsscode.pathom.connect/defresolver clojure.core/defn
com.fulcrologic.fulcro.components/defsc clojure.core/defn
com.fulcrologic.fulcro.routing.dynamic-routing/defrouter clojure.core/defn
com.fulcrologic.fulcro.mutations/defmutation clojure.core/defn
com.fulcrologic.guardrails.core/>defn clojure.core/defn
com.fulcrologic.rad.attributes/defattr clojure.core/def}
:linters
{:unresolved-symbol
{:exclude
[(com.fulcrologic.fulcro.mutations/defmutation)]}}}
I thought the exclusion above would solve it, and it solved some of them, but I’m still seeing params
linted incorrectly (see image)
you are using lint-as and unresolved-symbol config for the same macro
I'm not sure if that works
try {:lint-as {com.fulcrologic.fulcro.mutations/defmutation clj-kondo.lint-as/def-catch-all}
and remove the :exclude
Ah! That worked, but only for the forms inside of the #?(:cljs …)
forms…the ones inside of #?(:clj …)
are still showing the same unresolved symbol error :thinking_face:
Something with the reader conditionals is confusing kondo. I see a whole bunch of “unused namespace” warnings too, but those are clearly used by the :cljs
forms
@cjsauer if only the :cljs
branch is using those namespaces, you should put the :require
of that namespace in a :cljs
branch too, else clj-kondo will tell you it's unused (namely in the JVM invocation of that .cljc file)
the model that clj-kondo uses for linting .cljc files is: 1) lint once for .clj, reading everything but not .cljs branches 2) lint once for .cljs, reading everything, but not .clj branches
I'll be afk now, it's getting late. Feel free to post an issue if nobody else helps you out in the coming few hours.
That solved the unused namespace warnings! No prob, thank you @borkdude
Actually, using the :lint-as
and unresolved-symbol configurations together does almost seem to work. That removes all errors, except the unresolved symbols defined by the macros themselves.
Ah there we go! Here is the config that ended up working ☝️
> you are using lint-as and unresolved-symbol config for the same macro This seems to work just fine…although maybe that’s just a happy accident..