Fork me on GitHub
#clj-kondo
<
2023-09-15
>
Julian Alba08:09:03

Hello, can I set up clj-kondo to analyze .clj files as .cljc or even better change node language in hook? I have clojurescript macro that compiles forms to JS for <script> tag. It works well, except clj-kondo shows clojure (not script) warnings. I was able to write a hook for .cljc as suggested by @borkdude https://clojurians.slack.com/archives/CHY97NXE2/p1667912798502989, but I would like to keep file extensions as is.

(defmacro clojurescript [& forms]
  (emit
   (analyze
    (empty-env)
    (into forms `(do)))))

(clojurescript
  (js/console.log x))

borkdude08:09:32

you can't do this, just suppress certain errors in the clojurescript macro, with:

{:config-in-call {my.ns/clojurescript {:linters {:unresolved-namespace {:exclude [js]}}}}}

Julian Alba09:09:55

Make sense, thanks. By the way, I ❤️ clj-kondo so much, thank you for it!

❤️ 1