borkdude / flycheck-clj-kondo

Emacs integration for clj-kondo via flycheck
94 stars 17 forks source link

Support clojure-ts-mode out of the box #25

Closed kommen closed 6 months ago

kommen commented 6 months ago

It would be nice if next to clojure-mode (and its cljs and cljc variants) also clojure-ts-mode and its variants were supported by flycheck-clj-kondo out of the box.

Meanwhile, in my emacs config, I enable with an adapted flycheck-clj-kondo-define-checkers macro.

(defmacro flycheck-clj-kondo-define-ts-checkers (&rest extra-args)
  "Defines all clj-kondo checkers.
Argument EXTRA-ARGS: passes extra arguments to the checkers."
  `(progn
     (flycheck-clj-kondo--define-checker clj-kondo-clj-ts "clj" clojure-ts-mode ,@extra-args)
     (flycheck-clj-kondo--define-checker clj-kondo-cljs-ts "cljs" clojurescript-ts-mode ,@extra-args)
     (flycheck-clj-kondo--define-checker clj-kondo-cljc-ts "cljc" clojurec-ts-mode ,@extra-args)
     (flycheck-clj-kondo--define-checker clj-kondo-edn-ts "edn" clojure-ts-mode ,@extra-args)
     (dolist (element '(clj-kondo-clj-ts clj-kondo-cljs-ts clj-kondo-cljc-ts clj-kondo-edn-ts))
       (add-to-list 'flycheck-checkers element))))

(flycheck-clj-kondo-define-ts-checkers "--cache")
borkdude commented 6 months ago

I'm fine with adding clojure-ts-mode to the list! PR welcome. As I'm not using clojure-ts myself (yet) maybe it's better to have the PR done by someone who does so they can test it out?