GitHub - borkdude/flycheck-clj-kondo: Emacs integration for clj-kondo via flyche...
source link: https://github.com/borkdude/flycheck-clj-kondo
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
flycheck-clj-kondo
This package integrates clj-kondo with Emacs via flycheck.
Installation
Before installing the Emacs package, make sure the clj-kondo
is on your
path. For installation instructions, see https://github.com/borkdude/clj-kondo.
MELPA
Install from MELPA:
M-x package-install flycheck-clj-kondo
Then add the following to your init.el:
(require 'flycheck-clj-kondo)
use-package
Install via use-package:
;; First install the package: (use-package flycheck-clj-kondo :ensure t) ;; then install the checker as soon as `clojure-mode' is loaded (use-package clojure-mode :ensure t :config (require 'flycheck-clj-kondo))
el-get
Install via el-get:
(el-get-bundle flycheck-clj-kondo :url "https://raw.githubusercontent.com/borkdude/flycheck-clj-kondo/master/flycheck-clj-kondo.el" (require 'flycheck-clj-kondo))
Multiple linters
To set up multiple linters, e.g. in combination with flycheck-joker, add this after you required the linter packages:
(dolist (checker '(clj-kondo-clj clj-kondo-cljs clj-kondo-cljc clj-kondo-edn)) (setq flycheck-checkers (cons checker (delq checker flycheck-checkers))))
This ensures that the clj-kondo checkers are the first ones in the flycheck-checkers
list. This is needed to make the chain work. To create the chain, also add the following code:
(dolist (checkers '((clj-kondo-clj . clojure-joker) (clj-kondo-cljs . clojurescript-joker) (clj-kondo-cljc . clojure-joker) (clj-kondo-edn . edn-joker))) (flycheck-add-next-checker (car checkers) (cons 'error (cdr checkers))))
Troubleshooting
clj-kondo is on my PATH but Flycheck still says it's disabled (M-x flycheck-verify-setup)
Check your PATH according to Emacs: M-x shell
, then echo $PATH
. If there are any differences between that PATH and the one you are able to run clj-kondo from (e.g., your PATH according to Terminal on macOS), add them by including them in your Emacs config. For example, if you needed to include /usr/local/bin
, you could add to init.el:
(setenv "PATH" (concat (getenv "PATH") ":/usr/local/bin")) (setq exec-path (append exec-path '("/usr/local/bin")))
Then, restart Emacs.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK