clj-kondo

https://github.com/clj-kondo/clj-kondo
grumplet 2021-05-20T13:53:11.032600Z

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

borkdude 2021-05-20T13:57:00.033200Z

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

borkdude 2021-05-20T13:57:15.033600Z

and then lint the cljs-ajax dependency once again

grumplet 2021-05-20T13:57:28.033900Z

Thanks 🙂 - I’ll give it a go!

grumplet 2021-05-20T14:09:28.036500Z

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

👍 1
borkdude 2021-05-20T14:11:14.038Z

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.

2021-05-20T18:54:53.039300Z

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

borkdude 2021-05-20T18:56:03.039400Z

Great :)