Fork me on GitHub
#clj-kondo
<
2021-05-20
>
grumplet13:05:11

Does anybody have a config.edn that stops cljs-ajax GET and POST being marked as unresolved vars. I’ve tried variants of this so far to no avail:

linters {:unresolved-symbol 
         {:exclude [GET POST]}}

borkdude13:05:00

@grumplet I think this should be fixed if you do {:lint-as {ajax.macros/easy-api clojure.core/def}}

borkdude13:05:15

and then lint the cljs-ajax dependency once again

grumplet13:05:28

Thanks 🙂 - I’ll give it a go!

grumplet14:05:28

@borkdude - yep that worked 🙂 - I had convinced myself that :lint-as def wouldn’t work because my source didn’t refer to the easy-api directly - only to GET and POST.

👍 2
borkdude14:05:14

How it works: when it lints the ajax.core namespace clj-kondo collects the vars and stores them in a cache. but with the macro it doesn't know what to do, unless you have some config for it. using the above config, clj-kondo will also treat the macro as def and so it stores the var names in the cache. So when using the ajax.core namespace, clj-kondo now knows about the GET etc var in the ajax.core namespace and they are no longer unresolved.

Joshua Suskalo18:05:53

Thanks for a great linter! I just added kondo hooks for the macros in https://github.com/IGJoshua/farolero/tree/feature/clj-kondo-config