Fork me on GitHub

Even though kondo added Core.match support in 2021.02.13 i still get errors on _ and variable binding. Anything i can do about this?

src/language.cljs:52:17: error: Unresolved symbol: _
src/language.cljs:148:66: error: Unresolved symbol: last-type
src/language.cljs:149:74: error: Unresolved symbol: opt


Well, the first step would be to provide a valid repro


Ok, so kondo should recognise these patterns in theory?


in depends: I can't see where these errors are coming from by the text you posted


Of course, sorry: around line 52:

(match [word-class source-type (h/import-type ast) last-valid first-failure expr-settings]
               [_ _ _ (_ :guard (partial h/empty-command? command)) _ _] [:command]

around line 148:
(match [word-class (h/empty-word? word) source-type last-valid first-failure expr-settings option-settings]

          [:option false _ _ _ _ {:inside-paren? true :last-type last-type}]   #{last-type}
          [:option _ _ _ _ _     {:parenopt? true :closed? false :option opt}] #{(h/opt-param-type command (:name opt))}


Ben Sless13:04:20

Hey, I believe I'm missing it in the documentation, but how do I register macros with lint-as in a namespace's metadata?

Ben Sless13:04:50

I think I figured it out, noting it here for posterity: :clj-kondo/config in the ns form takes a quoted map. for it to work the linted-as symbol needs to be fully qualified. Is there anything I missed?


this is correct


@sigve.nordgaard I don't get any lint warnings using this:

(require '[clojure.core.match :refer [match]])

(let [command :foo]
  (match []
         [_ _ _ (_ :guard (partial apply command)) _ _] [:command]


But you are in .cljs I see. Never tested that case, it seems the libspec is different there:

[cljs.core.match :refer [match]]
I will fix that, but for now you can use {:lint-as {cljs.core.match/match clojure.core.match/match}}