add flycheck-clj-kondo as an optional package

This commit is contained in:
Luo Tianj 2019-08-10 16:11:07 +08:00 committed by smile13241324
parent 145f7e56cc
commit b71c78655f
2 changed files with 22 additions and 4 deletions

View file

@ -18,6 +18,8 @@
- [[#usage][Usage]]
- [[#cheatsheet][Cheatsheet]]
- [[#linting][Linting]]
- [[#squiggly-linter][Squiggly linter]]
- [[#clj-kondo-linter][clj-kondo linter]]
- [[#structuraly-safe-editing][Structuraly safe editing]]
- [[#key-bindings][Key bindings]]
- [[#working-with-clojure-files-barfage-slurpage--more][Working with clojure files (barfage, slurpage & more)]]
@ -189,10 +191,21 @@ some functions that deal with sorting maps.
** Linting
Linting works via flycheck and disabled by default.
You can enable it like this:
*** Squiggly linter
It uses [[https://github.com/clojure-emacs/squiggly-clojure][squiggly-clojure]] behind the scene. You can enable it like this:
#+BEGIN_SRC emacs-lisp
(setq clojure-enable-linters t)
(setq clojure-enable-linters 'squiggly)
#+END_SRC
*** clj-kondo linter
This linter based on static syntax check, require [[https://github.com/borkdude/clj-kondo][clj-kondo]] installed on your PATH. Detailed installation instructions can be found [[https://github.com/borkdude/clj-kondo/blob/master/doc/install.md][here]].
#+BEGIN_SRC emacs-lisp
(setq clojure-enable-linters 'clj-kondo)
#+END_SRC
Make sure to read the [[https://github.com/clojure-emacs/squiggly-clojure#warnings][warnings section]].

View file

@ -20,7 +20,8 @@
eldoc
evil-cleverparens
flycheck
(flycheck-clojure :toggle clojure-enable-linters)
(flycheck-clojure :toggle (eq clojure-enable-linters 'squiggly))
(flycheck-clj-kondo :toggle (eq clojure-enable-linters 'clj-kondo))
ggtags
counsel-gtags
helm-gtags
@ -173,7 +174,7 @@
(with-eval-after-load 'golden-ratio
(add-to-list 'golden-ratio-extra-commands 'cider-popup-buffer-quit-function))
;; setup linters. NOTE: It must be done after both CIDER and Flycheck are loaded.
(when clojure-enable-linters
(when (eq clojure-enable-linters 'squiggly)
(with-eval-after-load 'flycheck (flycheck-clojure-setup)))
;; add support for evil
(evil-set-initial-state 'cider-stacktrace-mode 'motion)
@ -433,3 +434,7 @@
(defun clojure/init-flycheck-clojure ()
(use-package flycheck-clojure
:if (configuration-layer/package-usedp 'flycheck)))
(defun clojure/init-flycheck-clj-kondo ()
(use-package flycheck-clj-kondo
:if (configuration-layer/package-usedp 'flycheck)))