Live linting with clj-kondo
clj-kondo is a linter that can be called from flycheck, providing live static code analysis on your Clojure code as you type. Simple open any Clojure file (.clj
, .cljs
, .cljc
, .edn
) and start typing.
clj-kondo does not need a running Clojure REPL to work.
When errors are detected by the lint tool, a mark appears in the margin showing the line. A wavy underscore shows where on the line the issue is. Moving the cursor to the underscore will show a pop-up describing the error.
The total number of errors and warnings are show in in the Space bar.
Navigating linting errors
SPC e L
opens a window with a buffer containing the list of linting errors for the current file. Navigate between linting errors using j
and k
. RET
to select an error, focusing the cursor in the other buffer on that error
SPC b x
to close the buffer and window when you have finished.
Keeping the flycheck buffer open will update as you move to linting errors in the source code buffer.
Not all error menu commands work
Some commands in the error menu do not currently work with linting in Clojure.
Configure Spacemacs Clojure layer with clj-kondo
Requirements for using clj-kondo as a live linter:
syntax-checking
layer is present indotspacemacs-configuration-layers
, which provides flycheck.clj-kondo
is available on PATH (see clj-kondo install instructions).- Spacemacs
develop
branch as of September 2019 or later
Add a variable called clojure-enable-linters
to the clojure
with the value 'clj-kondo.
(clojure :variables
clojure-enable-linters 'clj-kondo)
SPC q r
to restart Spacemacs (or simply SPC f e R
to reload the configuration)
Conflicts
Using the unofficial clojure-lint
layer will cause conflicts and may interfere with clj-kondo live linting.