add flycheck-clojure

This commit is contained in:
JAremko 2019-01-14 10:19:14 +02:00 committed by Eugene Yaremenko
parent ababcef041
commit 5cc823cc0f
4 changed files with 31 additions and 0 deletions

View File

@ -1083,6 +1083,7 @@ Other:
**** Clojure
- New packages:
- Added =sayid= debugger (thanks to Daniel Manila and Arne Brasseur)
- Added =flycheck-clojure= linters (thanks to Eugene Yaremenko)
- Improvements:
- Store cider REPL history in spacemacs cache (thanks to Ryan Fowler)
- Remove backtick from smartparens pairs for Clojure

View File

@ -17,6 +17,7 @@
- [[#more-details][More details]]
- [[#usage][Usage]]
- [[#cheatsheet][Cheatsheet]]
- [[#linting][Linting]]
- [[#structuraly-safe-editing][Structuraly safe editing]]
- [[#key-bindings][Key bindings]]
- [[#working-with-clojure-files-barfage-slurpage--more][Working with clojure files (barfage, slurpage & more)]]
@ -50,6 +51,7 @@ This layer adds support for [[https://clojure.org/][Clojure]] language using [[h
- REPL via [[https://github.com/clojure-emacs/cider][CIDER]]
- Code formatting via [[https://github.com/clojure-emacs/cider][CIDER]] using [[https://github.com/weavejester/cljfmt][Cljfmt]]
- Refactoring via [[https://github.com/clojure-emacs/clj-refactor.el][clj-refactor]]
- Linting via [[https://github.com/clojure-emacs/squiggly-clojure][squiggly-clojure]]
- Aligning of code forms via [[https://github.com/clojure-emacs/clojure-mode][clojure-mode]]
- Debugging with [[https://github.com/clojure-emacs/sayid][sayid]]
- Clojure cheatsheet
@ -186,6 +188,18 @@ Type ~SPC m h c~ to display the cheatsheet then type in some terms (space
separated) to narrow down the list. For example, try typing in sort map to see
some functions that deal with sorting maps.
** Linting
Linting works via flycheck and disabled by default.
You can enable it like this:
#+BEGIN_SRC emacs-lisp
(setq clojure-enable-linters t)
#+END_SRC
Make sure to read the [[https://github.com/clojure-emacs/squiggly-clojure#warnings][warnings section]].
If you have a problem peek into [[https://github.com/clojure-emacs/squiggly-clojure#debugging-and-bug-reporting][debugging and bug reporting]] then try to reproduce in the [[https://github.com/clojure-emacs/squiggly-clojure/tree/master/sample-project][sample project]].
NOTE: With the default linter configs you should add =org.clojure/core.typed= to the development dependencies.
** Structuraly safe editing
This layer adds support for =evil-cleverparens= which allows to safely edit
lisp code by keeping the s-expressions balanced.

View File

@ -25,3 +25,6 @@
(defvar clojure-enable-clj-refactor nil
"If non-nil, the clj-refactor is enabled.")
(defvar clojure-enable-linters nil
"If non-nil, enable clojure linters.")

View File

@ -19,6 +19,8 @@
company
eldoc
evil-cleverparens
flycheck
(flycheck-clojure :toggle clojure-enable-linters)
ggtags
counsel-gtags
helm-gtags
@ -162,6 +164,9 @@
;; add support for golden-ratio
(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
(with-eval-after-load 'flycheck (flycheck-clojure-setup)))
;; add support for evil
(evil-set-initial-state 'cider-stacktrace-mode 'motion)
(evil-set-initial-state 'cider-popup-buffer-mode 'motion)
@ -412,3 +417,11 @@
(defun clojure/post-init-parinfer ()
(add-hook 'clojure-mode-hook 'parinfer-mode))
(defun clojure/post-init-flycheck ()
(spacemacs|forall-clojure-modes m
(spacemacs/enable-flycheck m)))
(defun clojure/init-flycheck-clojure ()
(use-package flycheck-clojure
:if (configuration-layer/package-usedp 'flycheck)))