clj-kondo

https://github.com/clj-kondo/clj-kondo
cjsauer 2021-04-14T00:28:10.254900Z

I think it is, I remember seeing a ticket for it at some point.

Sigve 2021-04-14T08:34:14.257800Z

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

borkdude 2021-04-14T08:34:43.258200Z

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

Sigve 2021-04-14T08:35:52.258800Z

Ok, so kondo should recognise these patterns in theory?

borkdude 2021-04-14T08:36:13.259200Z

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

Sigve 2021-04-14T08:40:21.260700Z

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 Sless 2021-04-14T13:40:20.261400Z

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 Sless 2021-04-14T13:51:50.261500Z

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?

borkdude 2021-04-14T13:55:42.261700Z

this is correct

Ben Sless 2021-04-14T13:57:46.263Z

:thumbsup:

borkdude 2021-04-14T14:06:55.263900Z

@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]
         ))

borkdude 2021-04-14T14:09:15.265300Z

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}}

borkdude 2021-04-14T14:11:48.265500Z

https://github.com/clj-kondo/clj-kondo/issues/1252